|
|
@@ -22,29 +22,29 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
#include <stdio.h>
|
|
|
|
|
|
#include "vnrs_parser.h"
|
|
|
+#include "text_utils.h"
|
|
|
|
|
|
#define MAIN_ENGINE 1
|
|
|
#define MAIN_PARSER 2
|
|
|
#define MAIN MAIN_ENGINE
|
|
|
|
|
|
-typedef struct {
|
|
|
- Texture2D img;
|
|
|
- Vector2 pos; // In percents
|
|
|
-} Layer;
|
|
|
-
|
|
|
-typedef struct {
|
|
|
- Layer layers[10];
|
|
|
- int layers_count;
|
|
|
-
|
|
|
- char *name;
|
|
|
- Color name_color;
|
|
|
- int name_size;
|
|
|
-
|
|
|
- char *text;
|
|
|
- Color text_color;
|
|
|
- int text_size;
|
|
|
-} GameState;
|
|
|
-
|
|
|
+void get_cur_state(GameState *cur_state)
|
|
|
+{
|
|
|
+ cur_state->name = "Sumi";
|
|
|
+ cur_state->name_color = RAYWHITE;
|
|
|
+ cur_state->name_size = 40;
|
|
|
+
|
|
|
+ cur_state->text = strdup("Hello, World!");
|
|
|
+ cur_state->text_color = RAYWHITE;
|
|
|
+ cur_state->text_size = 30;
|
|
|
+
|
|
|
+ /*
|
|
|
+ cur_state->layers[0].img = LoadTexture("assets/spiral_atlas/bedroom.jpg");
|
|
|
+ cur_state->layers[0].pos = (Vector2){0.5, 0.5};
|
|
|
+ cur_state->layers[1].img = LoadTexture("assets/sumi/smile.png");
|
|
|
+ cur_state->layers[1].pos = (Vector2){0.5, 0.5}; */
|
|
|
+ cur_state->layers_count = 0;
|
|
|
+}
|
|
|
|
|
|
int main(void)
|
|
|
{
|
|
|
@@ -59,27 +59,21 @@ int main(void)
|
|
|
|
|
|
|
|
|
GameState cur_state = {0};
|
|
|
-
|
|
|
- cur_state.name = "Sumi";
|
|
|
- cur_state.name_color = RAYWHITE;
|
|
|
- cur_state.name_size = 40;
|
|
|
-
|
|
|
- cur_state.text = "Hello, World!";
|
|
|
- cur_state.text_color = RAYWHITE;
|
|
|
- cur_state.text_size = 30;
|
|
|
-
|
|
|
- cur_state.layers[0].img = LoadTexture("assets/spiral_atlas/bedroom.jpg");
|
|
|
- cur_state.layers[0].pos = (Vector2){0.5, 0.5};
|
|
|
- cur_state.layers[1].img = LoadTexture("assets/sumi/smile.png");
|
|
|
- cur_state.layers[1].pos = (Vector2){0.5, 0.5};
|
|
|
- cur_state.layers_count += 2;
|
|
|
-
|
|
|
-
|
|
|
+ get_cur_state(&cur_state);
|
|
|
+ FILE *f;
|
|
|
+ f = fopen("assets/test.vnrs", "r");
|
|
|
+ if (!f) {
|
|
|
+ perror("assets/test.vnrs");
|
|
|
+ return 2;
|
|
|
+ }
|
|
|
|
|
|
while (!WindowShouldClose())
|
|
|
{
|
|
|
+ if (IsKeyPressed(KEY_SPACE))
|
|
|
+ get_next_state(f, &cur_state);
|
|
|
+
|
|
|
BeginDrawing();
|
|
|
- ClearBackground(RAYWHITE);
|
|
|
+ ClearBackground(BLACK);
|
|
|
|
|
|
for (int i = 0; i < cur_state.layers_count; i++) {
|
|
|
DrawTexture(cur_state.layers[i].img,
|