-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0d75f3a
commit 4463a99
Showing
8 changed files
with
32 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
quad | ||
1 | ||
q,1432423 | ||
0 0 0, 1 0 0, 1 1 0, 0 1 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
|
||
#include "quad.h" | ||
|
||
quad* quads; | ||
extern quad* quads; | ||
|
||
void display(); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
#include <GL/glu.h> | ||
#include <stdio.h> | ||
|
||
#include "main.h" | ||
#include "display.h" | ||
#include "parse.h" | ||
|
||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,37 @@ | ||
//parses a save file and sets global variables accordingly | ||
|
||
#include <stdio.h> | ||
#include <string.h> | ||
|
||
#include "display.h" | ||
#include "parse.h" | ||
#include "display.h" | ||
|
||
void parse(char** file) | ||
void parse(char* file) | ||
{ | ||
FILE* data = fopen(file, "r"); | ||
|
||
char readBuffer[100]; | ||
|
||
while (fgets(readBuffer, sizeof(readBuffer), data) != NULL) | ||
{ | ||
printf("%s", readBuffer); | ||
if (!isdigit(readBuffer[0])) | ||
{ | ||
char *buff = (char*)malloc(10 * sizeof(char)); | ||
memcpy(buff, &readBuffer[2], strlen(readBuffer) - 2); | ||
quads = (quad*)malloc(atoi(buff) * sizeof(quad)); //assign quad# from float in buff | ||
free(buff); | ||
} | ||
int i = 0; | ||
while (readBuffer[i] != '\n') | ||
{ | ||
|
||
} | ||
} | ||
} | ||
} | ||
|
||
/* | ||
string->float | ||
float f; | ||
f = strtof(buff, NULL); | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#ifndef PARSE_H | ||
#define PARSE_H | ||
|
||
void parse(char** file); | ||
void parse(char* file); | ||
|
||
#endif |