aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.cpp
blob: 74b1adfc2b4dd27d0c1b6f146e3a036f0203936b (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*********************************/
/*   THRESHOLD        (  //      */
/*   main              ( )/      */
/*   by salade         )(/       */
/*  ________________  ( /)       */
/* ()__)____________)))))   :^}  */
/*********************************/


#include "window.hpp"
#include "gameplay.hpp"
#include <iostream>

gameState gs = TITLE;

Game* game = new Game("../meta/maps/stage_1_start.bfm");

int main(void) {
  initWindow();

  // Main game loop
  while (!WindowShouldClose()) /* Detect window close button or ESC key */
  {
    switch (gs) {
        case (TITLE):
        {
            if (IsKeyPressed(KEY_ENTER))
            {
                gs = GAMEPLAY;
                game->start();
            }
            break ;
        }
        case (GAMEPLAY):
        {
            break ;
        }
        case (ENDING):
        {
            if (IsKeyPressed(KEY_ENTER))
            {
                gs = TITLE;
                delete game;
                game = new Game("../meta/maps/stage_1_start.bfm");
            }
            break ;
        }
    }
    BeginDrawing();

    ClearBackground(RAYWHITE);

    switch (gs) {
        case (TITLE):
        {
            DrawText("THRESHOLD", (SCREENWIDTH / 2) - 150, SCREENHEIGHT / 2, 40, RED);
            DrawText("PRESS ENTER", (SCREENWIDTH / 2) - 150, (SCREENHEIGHT / 2) + 50, 40, MAROON);
            break ;
        }
        case (GAMEPLAY):
        {
            if (game->getKeys()) {
                gs = ENDING;
            }
            game->draw();
            break ;
        }
        case (ENDING):
        {
            DrawCircle(SCREENWIDTH / 2, SCREENHEIGHT / 2, 200, BLACK);
            DrawText("GOOD BYE", (SCREENWIDTH / 2) - 100, SCREENHEIGHT / 2, 40, WHITE);
            break ;
        }
    }
    EndDrawing();
  }
  CloseWindow();
  return 0;
}