aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.cpp
diff options
context:
space:
mode:
authorsalaaad2 <arthurdurant263@gmail.com>2022-01-07 17:36:36 +0100
committersalaaad2 <arthurdurant263@gmail.com>2022-01-07 17:36:36 +0100
commit5abebc5f1e81506b0d978154ab6d030b376c3f4b (patch)
treefe48ff7c7d61699caf63fa7009a98a99b72b673a /src/main.cpp
parentdisplay next level (diff)
downloadthreshold-5abebc5f1e81506b0d978154ab6d030b376c3f4b.tar.gz
threshold-5abebc5f1e81506b0d978154ab6d030b376c3f4b.tar.bz2
threshold-5abebc5f1e81506b0d978154ab6d030b376c3f4b.tar.xz
threshold-5abebc5f1e81506b0d978154ab6d030b376c3f4b.tar.zst
threshold-5abebc5f1e81506b0d978154ab6d030b376c3f4b.zip
interface work in progress
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp37
1 files changed, 33 insertions, 4 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()) {