aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp37
-rw-r--r--src/window.hpp2
2 files changed, 34 insertions, 5 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 92cdc56..009ff9a 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -10,6 +10,8 @@
#include "window.hpp"
#include "gameplay.hpp"
#include <iostream>
+#include <filesystem>
+#include <raylib.h>
gameState gs = TITLE;
@@ -19,7 +21,7 @@ int main(void) {
// Main game loop
InitWindow(SCREENWIDTH, SCREENHEIGHT, "WIP -- coolspace");
- Game* game = new Game("../meta/maps/stage_1_start.bfm");
+ Game* game = nullptr;
while (!WindowShouldClose()) /* Detect window close button or ESC key */
{
switch (gs) {
@@ -27,10 +29,21 @@ int main(void) {
{
if (IsKeyPressed(KEY_ENTER))
{
+ gs = PICK;
+ }
+ break ;
+ }
+ case (PICK):
+ {
+ if (IsKeyPressed(KEY_ENTER))
+ {
gs = GAMEPLAY;
game->start();
}
- break ;
+ if (IsKeyPressed(KEY_DOWN))
+ {
+ // pick++
+ }
}
case (GAMEPLAY):
{
@@ -72,11 +85,27 @@ int main(void) {
switch (gs) {
case (TITLE):
{
- DrawRectangle((SCREENWIDTH / 2), (SCREENHEIGHT / 2), 200, 200, BLACK);
- DrawText("THRESHOLD", (SCREENWIDTH / 2) - 140, SCREENHEIGHT / 2, 40, RED);
+ DrawRectangle(200, 100, 1200, 700, RAYWHITE);
+ DrawRectangle(250, 150, 1100, 600, COOLPURPLE);
+ DrawRectangle(300, 200, 1000, 500, RAYWHITE);
+ DrawText("THRESHOLD", 260, 160, 30, RAYWHITE);
DrawText("PRESS ENTER", (SCREENWIDTH / 2) - 140, (SCREENHEIGHT / 2) + 50, 40, MAROON);
break ;
}
+ case (PICK):
+ {
+ std::string path = "../meta/maps";
+ int i = 0;
+ DrawRectangle(200, 100, 1200, 700, RAYWHITE);
+ DrawRectangle(250, 150, 1100, 600, COOLPURPLE);
+ DrawRectangle(300, 200, 1000, 500, RAYWHITE);
+ for (const auto & entry : std::filesystem::directory_iterator(path)) {
+ DrawText("TEST", SCREENWIDTH / 2, (SCREENHEIGHT / 2) + i * 40, 40, COOLPURPLE);
+ i++;
+ }
+ DrawText("THRESHOLD", 260, 160, 30, RAYWHITE);
+ break ;
+ }
case (GAMEPLAY):
{
if (auto code = game->getKeys()) {
diff --git a/src/window.hpp b/src/window.hpp
index bba7c07..24d6f4c 100644
--- a/src/window.hpp
+++ b/src/window.hpp
@@ -17,7 +17,7 @@ int initWindow(void);
#define SCREENHEIGHT 900
typedef enum gameState {
-TITLE = 0, GAMEPLAY, NEXT, ENDING
+TITLE = 0, PICK, GAMEPLAY, NEXT, ENDING
} gameState ;
#endif // WINDOW_H_