diff options
author | salaaad2 <arthurdurant263@gmail.com> | 2022-01-07 17:36:36 +0100 |
---|---|---|
committer | salaaad2 <arthurdurant263@gmail.com> | 2022-01-07 17:36:36 +0100 |
commit | 5abebc5f1e81506b0d978154ab6d030b376c3f4b (patch) | |
tree | fe48ff7c7d61699caf63fa7009a98a99b72b673a | |
parent | display next level (diff) | |
download | threshold-5abebc5f1e81506b0d978154ab6d030b376c3f4b.tar.gz threshold-5abebc5f1e81506b0d978154ab6d030b376c3f4b.tar.bz2 threshold-5abebc5f1e81506b0d978154ab6d030b376c3f4b.tar.xz threshold-5abebc5f1e81506b0d978154ab6d030b376c3f4b.tar.zst threshold-5abebc5f1e81506b0d978154ab6d030b376c3f4b.zip |
interface work in progress
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/main.cpp | 37 | ||||
-rw-r--r-- | src/window.hpp | 2 |
3 files changed, 36 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 025c271..5d9e149 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,8 @@ find_package(raylib 3.0 REQUIRED) # Requires at least version 3.0 set(CMAKE_C_STANDARD 11) # Requires C11 standard +set (CMAKE_CXX_STANDARD 17) + add_executable(${PROJECT_NAME} src/main.cpp src/window.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 <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_ |