From f4e80b726ad306a4ea8a5921e0829b7f003f431f Mon Sep 17 00:00:00 2001 From: Aki Date: Mon, 7 Nov 2022 20:44:27 +0100 Subject: Simplified currently available scenes pool --- kurator/CMakeLists.txt | 1 - kurator/src/GameOver.cpp | 35 ----------------------------------- kurator/src/GameOver.h | 24 ------------------------ kurator/src/SkyboxTest.cpp | 8 +++----- kurator/src/Title.cpp | 11 ++++++----- 5 files changed, 9 insertions(+), 70 deletions(-) delete mode 100644 kurator/src/GameOver.cpp delete mode 100644 kurator/src/GameOver.h diff --git a/kurator/CMakeLists.txt b/kurator/CMakeLists.txt index cf37f69..0aa2712 100644 --- a/kurator/CMakeLists.txt +++ b/kurator/CMakeLists.txt @@ -1,7 +1,6 @@ project(kurator) add_executable( ${PROJECT_NAME} - src/GameOver.cpp src/main.cpp src/Session.cpp src/Skybox.cpp diff --git a/kurator/src/GameOver.cpp b/kurator/src/GameOver.cpp deleted file mode 100644 index 9646c17..0000000 --- a/kurator/src/GameOver.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include "GameOver.h" - -#include -#include - -#include - -#include "Session.h" - - -namespace kurator -{ - - -GameOver::GameOver(std::shared_ptr _session) : - session {std::move(_session)} -{ -} - - -void -GameOver::update(const float) -{ -} - - -void -GameOver::draw() const -{ - ClearBackground(GRAY); - DrawText("Bye", 100, 100, 20, BLACK); -} - - -} // namespace kurator diff --git a/kurator/src/GameOver.h b/kurator/src/GameOver.h deleted file mode 100644 index 70b5c31..0000000 --- a/kurator/src/GameOver.h +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -#include - -#include "Session.h" -#include "Scene.h" - - -namespace kurator -{ - - -class GameOver : public Scene -{ -public: - explicit GameOver(std::shared_ptr _session); - void update(float dt) override; - void draw() const override; -private: - std::shared_ptr session; -}; - - -} // namespace kurator diff --git a/kurator/src/SkyboxTest.cpp b/kurator/src/SkyboxTest.cpp index 85809f4..3d8241e 100644 --- a/kurator/src/SkyboxTest.cpp +++ b/kurator/src/SkyboxTest.cpp @@ -5,8 +5,8 @@ #include -#include "GameOver.h" #include "Session.h" +#include "Title.h" namespace kurator @@ -26,10 +26,8 @@ void SkyboxTest::update(const float) { UpdateCamera(&camera); - if (IsKeyPressed(KEY_SPACE)) { - auto next = std::make_shared(session); - session->set(next); - } + if (IsKeyPressed(KEY_SPACE)) + session->set(std::make_shared(session)); } diff --git a/kurator/src/Title.cpp b/kurator/src/Title.cpp index 92d0b4d..1ff5a12 100644 --- a/kurator/src/Title.cpp +++ b/kurator/src/Title.cpp @@ -22,10 +22,8 @@ Title::Title(std::shared_ptr<Session> _session) : void Title::update(const float) { - if (IsKeyPressed(KEY_SPACE)) { - auto next = std::make_shared<SkyboxTest>(session); - session->set(next); - } + if (IsKeyPressed(KEY_SPACE)) + session->set(std::make_shared<SkyboxTest>(session)); } @@ -33,7 +31,10 @@ void Title::draw() const { ClearBackground(BLACK); - DrawText("Hey", 100, 100, 20, GRAY); + constexpr const char* text = "Kurator"; + const int width = GetScreenWidth(); + const int title = MeasureText(text, 20); + DrawText(text, (width - title) / 2, 100, 20, GRAY); } -- cgit v1.1