summaryrefslogtreecommitdiff
path: root/src/main.c
blob: 1955e35f3058de82c1fdd659e4e47ebf466895fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>

#include "editor.h"
#include "raylib.h"
#include "screens.h"
#include "xd.h"

int main() {
  SetConfigFlags(FLAG_WINDOW_RESIZABLE);
  InitWindow(800, 600, "sillyeditor");
  SetTargetFPS(60);

  // Getting list of files
  XdData* datas[] = {};
  FilePathList list = LoadDirectoryFilesEx("datas", ".xd", true);

  for (int i = 0; i < list.count; i++) {
    XdData data = Xd_LoadFromFile(list.paths[i]);
    printf("%s\n", data.name);
    datas[i] = &data;
  }

  UnloadDirectoryFiles(list);

  XdData* data = NULL;
  Editor editor = {data, {0, 0, 0, NULL, {0, 0, 0, 0}, {0, 0}, NULL, {}}};

  Camera2D camera = {0};
  camera.target = (Vector2){0.0f, 0.0f};
  camera.offset = (Vector2){0.0f, 0.0f};
  camera.rotation = 0.0f;
  camera.zoom = 4.0f;

  GameScreen currentScreen = SCREEN_MENU;

  while (!WindowShouldClose()) {
    switch (currentScreen) {
      case SCREEN_MENU: {
        SE_DrawMenuScreen(&currentScreen, &editor, data, datas);
        break;
      }
      case SCREEN_EDITOR: {
        SE_DrawEditorScreen(&currentScreen, &editor, &camera);
        break;
      }
      default:
        break;
    }
  }

  return 0;
}