summaryrefslogtreecommitdiff
path: root/src/main.c
blob: ca3a4ad1085261873886bca5346b8b4034c558a3 (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
#include "level.h"
#include "raylib.h"

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

  int gridSize = 32;

  Level *level = SE_CreateLevel(30, 30);

  while (!WindowShouldClose()) {
    BeginDrawing();
    ClearBackground(RAYWHITE);
    DrawText("hi world!", GetScreenWidth() / 2 - 16 * 4,
             GetScreenHeight() / 2 - 16, 32, BLACK);

    SE_RenderLevel(level);

    // Drawing grid
    for (int x = 0; x <= level->width; x++) {
      DrawLine(x * gridSize, 0, x * gridSize, GetScreenHeight(), LIGHTGRAY);
    }

    for (int y = 0; y <= level->height; y++) {
      DrawLine(0, y * gridSize, GetScreenWidth(), y * gridSize, LIGHTGRAY);
    }

    EndDrawing();
  }

  SE_FreeLevel(level);

  return 0;
}