diff --git a/CMakeLists.txt b/CMakeLists.txt index 5cc80c6c..6110a686 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -135,6 +135,7 @@ set(SOURCES sources/Runner/SettingsMenuScene.cpp sources/Runner/CreditScene.cpp sources/Runner/LobbyScene.cpp + sources/Runner/HowToPlayScene.cpp ) add_executable(bomberman sources/main.cpp diff --git a/sources/Models/GameState.hpp b/sources/Models/GameState.hpp index 4bb271b5..2e7bdc11 100644 --- a/sources/Models/GameState.hpp +++ b/sources/Models/GameState.hpp @@ -26,6 +26,7 @@ namespace BBM LobbyScene, TitleScreenScene, CreditScene, + HowToPlayScene, }; diff --git a/sources/Runner/HowToPlayScene.cpp b/sources/Runner/HowToPlayScene.cpp new file mode 100644 index 00000000..434c5d7c --- /dev/null +++ b/sources/Runner/HowToPlayScene.cpp @@ -0,0 +1,81 @@ +#include +#include +#include "Runner.hpp" +#include +#include "Component/Music/MusicComponent.hpp" +#include "Component/Sound/SoundComponent.hpp" +#include "Component/Controllable/ControllableComponent.hpp" +#include "Component/Position/PositionComponent.hpp" +#include "Component/Keyboard/KeyboardComponent.hpp" +#include "Component/Renderer/Drawable2DComponent.hpp" +#include "Component/Button/ButtonComponent.hpp" +#include "Drawables/2D/Text.hpp" + +namespace RAY2D = RAY::Drawables::Drawables2D; + +namespace BBM +{ + std::shared_ptr Runner::loadHowToPlayScene() + { + auto scene = std::make_shared(); + static const std::map sounds = { + {SoundComponent::JUMP, "assets/sounds/click.ogg"} + }; + + addMenuControl(*scene); + scene->addEntity("Control entity") + .addComponent("assets/musics/music_player_select.ogg") + .addComponent(sounds); + scene->addEntity("background") + .addComponent() + .addComponent("assets/plain_menu_background.png"); + scene->addEntity("scene title text") + .addComponent(1920 / 3, 100, 0) + .addComponent("How To Play?", 120, RAY::Vector2(), ORANGE); + + scene->addEntity("select text") + .addComponent(1920 / 8, 1080 / 3, 0) + .addComponent("Select:", 60, RAY::Vector2(), ORANGE); + scene->addEntity("select") + .addComponent(1920 / 7, 1080 / 2.5, 0) + .addComponent("Space/A Button", 35, RAY::Vector2(), BLACK); + scene->addEntity("change skin text") + .addComponent(1920 / 8, 1080 / 2, 0) + .addComponent("Change Skin/Drop Bomb:", 60, RAY::Vector2(), ORANGE); + scene->addEntity("change skin") + .addComponent(1920 / 7, 1080 / 1.75, 0) + .addComponent("E/B Button", 35, RAY::Vector2(), BLACK); + scene->addEntity("move text") + .addComponent(1920 / 1.75, 1080 / 3, 0) + .addComponent("Move:", 60, RAY::Vector2(), ORANGE); + scene->addEntity("move") + .addComponent(1920 / 1.75, 1080 / 2.5, 0) + .addComponent("Q-Z-S-D/Arrow/Joystick", 35, RAY::Vector2(), BLACK); + scene->addEntity("back text") + .addComponent(1920 / 1.75, 1080 / 2, 0) + .addComponent("Back/Pause:", 60, RAY::Vector2(), ORANGE); + scene->addEntity("back") + .addComponent(1920 / 1.75, 1080 / 1.75, 0) + .addComponent("Esc / Controller's Home button:", 35, RAY::Vector2(), BLACK); + auto &back = scene->addEntity("back to menu") + .addComponent(10, 1080 - 85, 0) + .addComponent("assets/buttons/button_back.png") + .addComponent([](WAL::Entity &entity, WAL::Wal &) + { + gameState.nextScene = BBM::GameState::SceneID::LobbyScene; + }) + .addComponent([](WAL::Entity &entity, WAL::Wal &) + { + RAY::Texture *texture = dynamic_cast(entity.getComponent().drawable.get()); + + texture->use("assets/buttons/button_back.png"); + }) + .addComponent([](WAL::Entity &entity, WAL::Wal &) + { + RAY::Texture *texture = dynamic_cast(entity.getComponent().drawable.get()); + + texture->use("assets/buttons/button_back_hovered.png"); + }); + return scene; + } +} \ No newline at end of file diff --git a/sources/Runner/LobbyScene.cpp b/sources/Runner/LobbyScene.cpp index 3de21ab9..139a663a 100644 --- a/sources/Runner/LobbyScene.cpp +++ b/sources/Runner/LobbyScene.cpp @@ -90,7 +90,7 @@ namespace BBM .addComponent("assets/buttons/button_htp.png") .addComponent([](WAL::Entity &entity, WAL::Wal &) { - gameState.nextScene = BBM::GameState::SceneID::MainMenuScene; + gameState.nextScene = BBM::GameState::SceneID::HowToPlayScene; }) .addComponent([](WAL::Entity &entity, WAL::Wal &) { diff --git a/sources/Runner/Runner.cpp b/sources/Runner/Runner.cpp index 6af5e04c..ca96ba16 100644 --- a/sources/Runner/Runner.cpp +++ b/sources/Runner/Runner.cpp @@ -120,6 +120,7 @@ namespace BBM gameState._loadedScenes[GameState::SceneID::CreditScene] = loadCreditScene(); gameState._loadedScenes[GameState::SceneID::SplashScreen] = loadSplashScreenScene(); gameState._loadedScenes[GameState::SceneID::LobbyScene] = loadLobbyScene(); + gameState._loadedScenes[GameState::SceneID::HowToPlayScene] = loadHowToPlayScene(); } int Runner::run() diff --git a/sources/Runner/Runner.hpp b/sources/Runner/Runner.hpp index dd225e1e..5c8872b7 100644 --- a/sources/Runner/Runner.hpp +++ b/sources/Runner/Runner.hpp @@ -59,6 +59,9 @@ namespace BBM //! @brief load all data related to splash screen static std::shared_ptr loadSplashScreenScene(); + //! @brief load how to play screen + static std::shared_ptr loadHowToPlayScene(); + //! @brief loads all scenes in the game state static void loadScenes(); };