From 74f85373acd2a42de7538d88e392ab1c5fc8d866 Mon Sep 17 00:00:00 2001 From: HENRY Benjamin Date: Fri, 18 Jun 2021 16:12:01 +0200 Subject: [PATCH] added some ui in resumelobbyscene --- sources/Runner/MainMenuScene.cpp | 4 ++-- sources/Runner/ResumeLobbyScene.cpp | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/sources/Runner/MainMenuScene.cpp b/sources/Runner/MainMenuScene.cpp index aa06ca8d..ece61be6 100644 --- a/sources/Runner/MainMenuScene.cpp +++ b/sources/Runner/MainMenuScene.cpp @@ -77,13 +77,13 @@ namespace BBM ParserYAML::load(gameScene); } catch (std::exception const &err) { std::cout << err.what() << std::endl; - Runner::gameState._loadedScenes[GameState::SceneID::MainMenuScene]->addEntity("Error message parser") + Runner::gameState._loadedScenes[GameState::SceneID::GameScene]->addEntity("Error message parser") .addComponent(1920 / 5, 2 * 1080 / 4.25, 0) .addComponent(3s, [](WAL::Entity &myEntity, WAL::Wal &wal) { myEntity.scheduleDeletion(); }) .addComponent(err.what(), 50, RAY::Vector2(), RED); - gameState.nextScene = BBM::GameState::SceneID::MainMenuScene; + gameState.nextScene = BBM::GameState::SceneID::GameScene; return; } Runner::gameState._loadedScenes[GameState::SceneID::GameScene] = gameScene; diff --git a/sources/Runner/ResumeLobbyScene.cpp b/sources/Runner/ResumeLobbyScene.cpp index 767d9ed4..b67013e6 100644 --- a/sources/Runner/ResumeLobbyScene.cpp +++ b/sources/Runner/ResumeLobbyScene.cpp @@ -41,6 +41,9 @@ namespace BBM scene->addEntity("background") .addComponent() .addComponent("assets/backgrounds/menu.png"); + scene->addEntity("white background") + .addComponent(200, 300, 0) + .addComponent(Vector2f(), Vector2f(1525, 325), RAY::Color(WHITE).setA(150)); scene->addEntity("lobby text") .addComponent(1920 / 2.75, 100, 0) .addComponent("Get Ready", 120, RAY::Vector2(), ORANGE); @@ -84,6 +87,25 @@ namespace BBM texture->use("assets/buttons/button_back_hovered.png"); }); + auto &howToPlay = scene->addEntity("to to play") + .addComponent(1920 - 10 - 75, 1080 - 85, 0) + .addComponent("assets/buttons/button_htp.png") + .addComponent([](WAL::Entity &entity, WAL::Wal &) + { + gameState.nextScene = BBM::GameState::SceneID::HowToPlayScene; + }) + .addComponent([](WAL::Entity &entity, WAL::Wal &) + { + RAY::Texture *texture = dynamic_cast(entity.getComponent().drawable.get()); + + texture->use("assets/buttons/button_htp.png"); + }) + .addComponent([](WAL::Entity &entity, WAL::Wal &) + { + RAY::Texture *texture = dynamic_cast(entity.getComponent().drawable.get()); + + texture->use("assets/buttons/button_htp_hovered.png"); + }); scene->addEntity("camera") .addComponent(8, 20, 7) .addComponent(Vector3f(8, 0, 8));