diff options
author | Aki <please@ignore.pl> | 2022-12-23 01:22:34 +0100 |
---|---|---|
committer | Aki <please@ignore.pl> | 2022-12-23 01:22:34 +0100 |
commit | 76f0c4a9c7171fb223d0a793197b2dcce0f8819c (patch) | |
tree | 8141c659f06abf1c3fdb1a070a30227ca8addd3c | |
parent | d3a4459071b561d2ee50fa1dfcbdf62590c5758e (diff) | |
download | kurator-76f0c4a9c7171fb223d0a793197b2dcce0f8819c.zip kurator-76f0c4a9c7171fb223d0a793197b2dcce0f8819c.tar.gz kurator-76f0c4a9c7171fb223d0a793197b2dcce0f8819c.tar.bz2 |
Added simple main menu
-rw-r--r-- | kurator/src/Title.cpp | 19 | ||||
-rw-r--r-- | kurator/src/Title.h | 1 |
2 files changed, 19 insertions, 1 deletions
diff --git a/kurator/src/Title.cpp b/kurator/src/Title.cpp index 5778ac8..3ada1d5 100644 --- a/kurator/src/Title.cpp +++ b/kurator/src/Title.cpp @@ -4,6 +4,7 @@ #include <utility> #include <raylib.h> +#include <imgui.h> #include "Session.h" #include "Battle.h" @@ -22,8 +23,17 @@ Title::Title(std::shared_ptr<Session> _session) : void Title::update(const float) { + ImGui::SetNextWindowSize({GetScreenWidth()/3.0f, 0.0f}, ImGuiCond_Once); + ImGui::SetNextWindowPos({GetScreenWidth()/2.0f, GetScreenHeight()/2.0f}, ImGuiCond_Once, {0.5f, 0.4f}); + if (ImGui::Begin("Main Menu", nullptr, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse)) { + if (ImGui::Button("Start", {-1.0f, 0.0f})) + start_battle(); + if (ImGui::Button("Exit", {-1.0f, 0.0f})) + session->quit(); + } + ImGui::End(); if (IsKeyPressed(KEY_SPACE)) - session->set(std::make_shared<Battle>(session)); + start_battle(); } @@ -38,4 +48,11 @@ Title::draw() const } +void +Title::start_battle() +{ + session->set(std::make_shared<Battle>(session)); +} + + } // namespace kurator diff --git a/kurator/src/Title.h b/kurator/src/Title.h index c29dc99..b350196 100644 --- a/kurator/src/Title.h +++ b/kurator/src/Title.h @@ -18,6 +18,7 @@ public: void draw() const override; private: std::shared_ptr<Session> session; + void start_battle(); }; |