diff options
author | salaaad2 <arthurdurant263@gmail.com> | 2022-01-14 01:49:11 +0100 |
---|---|---|
committer | salaaad2 <arthurdurant263@gmail.com> | 2022-01-14 01:49:11 +0100 |
commit | 42a5777b370853f8957c101956a300d7991977e5 (patch) | |
tree | a1092b8e45358accbeff2926f28ca4b4967c6190 /src/main.cpp | |
parent | background can now be specified in map file (diff) | |
download | threshold-42a5777b370853f8957c101956a300d7991977e5.tar.gz threshold-42a5777b370853f8957c101956a300d7991977e5.tar.bz2 threshold-42a5777b370853f8957c101956a300d7991977e5.tar.xz threshold-42a5777b370853f8957c101956a300d7991977e5.tar.zst threshold-42a5777b370853f8957c101956a300d7991977e5.zip |
add license, better next screen and begin savestate
Diffstat (limited to '')
-rw-r--r-- | src/main.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/main.cpp b/src/main.cpp index 56ad3e5..ab6e60c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -8,6 +8,7 @@ #include <raylib.h> // basic libs #include <iostream> +#include <fstream> #include "gameplay.hpp" #include "window.hpp" @@ -24,6 +25,7 @@ int main(void) { auto nPick = 0; Texture2D background; Game* game = nullptr; + std::ofstream ifs("../meta/maps/savestate"); std::string path = "../meta/maps"; @@ -81,6 +83,7 @@ int main(void) { if (IsKeyPressed(KEY_ENTER)) { std::string next("../meta/maps/"); next += game->getNext(); + ifs << game->getCurrent() ; delete game; CloseAudioDevice(); @@ -153,17 +156,23 @@ int main(void) { gs = NEXT; } } - BeginMode2D(game->cam); + // BeginMode2D(game->cam); // I think this might be useless + // NOTE: it was lol game->draw(); break; } case (NEXT): { - DrawCircle(SCREENWIDTH / 2, SCREENHEIGHT / 2, 200, BLACK); - DrawText("STAGE CLEARED\nNEXT LEVEL :", - (SCREENWIDTH / 2) - 200, 200, 40, - WHITE); - DrawText(game->getNext().c_str(), (SCREENWIDTH / 2) - 100, - (SCREENHEIGHT / 2) + 60, 40, WHITE); + ClearBackground(COOLPURPLE); + 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("CONGRATULATIONS\n", 350, 240, 30, COOLPURPLE); + DrawText("KILLS :", 350, 280, 30, COOLPURPLE); + auto kills = std::to_string(game->getKills()).c_str(); + DrawText(kills, 460, 280, 30, RED); + DrawText("TIME\n", 350, 320, 30, COOLPURPLE); + break; } case (ENDING): { @@ -175,6 +184,7 @@ int main(void) { } EndDrawing(); } + ifs.close(); CloseWindow(); return 0; } |