From 5abebc5f1e81506b0d978154ab6d030b376c3f4b Mon Sep 17 00:00:00 2001 From: salaaad2 Date: Fri, 7 Jan 2022 17:36:36 +0100 Subject: interface work in progress --- src/main.cpp | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) (limited to 'src/main.cpp') 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 +#include +#include gameState gs = TITLE; @@ -19,18 +21,29 @@ 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) { case (TITLE): + { + 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()) { -- cgit v1.2.3