mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-05-06 21:27:37 +00:00
create blank scene for score scene
This commit is contained in:
@@ -139,6 +139,7 @@ set(SOURCES
|
||||
sources/System/EndCondition/EndConditionSystem.hpp
|
||||
sources/System/EndCondition/EndConditionSystem.cpp
|
||||
sources/Runner/LobbyScene.cpp
|
||||
sources/Runner/ScoreScene.cpp
|
||||
)
|
||||
add_executable(bomberman
|
||||
sources/main.cpp
|
||||
|
||||
@@ -59,6 +59,11 @@ namespace BBM
|
||||
//! @brief load all data related to splash screen
|
||||
static std::shared_ptr<WAL::Scene> loadSplashScreenScene();
|
||||
|
||||
//! @brief load all data related to score scene screen
|
||||
//! @param gameScene scene containing players (to know the scores)
|
||||
static std::shared_ptr<WAL::Scene> loadScoreScene(WAL::Scene &gameScene);
|
||||
|
||||
|
||||
//! @brief loads all scenes in the game state
|
||||
static void loadScenes();
|
||||
};
|
||||
|
||||
50
sources/Runner/ScoreScene.cpp
Normal file
50
sources/Runner/ScoreScene.cpp
Normal file
@@ -0,0 +1,50 @@
|
||||
|
||||
#include <Wal.hpp>
|
||||
#include "Runner.hpp"
|
||||
#include <map>
|
||||
#include "Component/Button/ButtonComponent.hpp"
|
||||
#include "Component/Music/MusicComponent.hpp"
|
||||
#include "Component/Position/PositionComponent.hpp"
|
||||
#include "Component/Renderer/Drawable2DComponent.hpp"
|
||||
#include "Component/Sound/SoundComponent.hpp"
|
||||
#include "Drawables/Texture.hpp"
|
||||
|
||||
namespace RAY2D = RAY::Drawables::Drawables2D;
|
||||
|
||||
namespace BBM
|
||||
{
|
||||
std::shared_ptr<WAL::Scene> Runner::loadScoreScene(WAL::Scene &gameScene)
|
||||
{
|
||||
auto scene = std::make_shared<WAL::Scene>();
|
||||
static const std::map<SoundComponent::SoundIndex, std::string> sounds = {
|
||||
{SoundComponent::JUMP, "assets/sounds/click.ogg"}
|
||||
};
|
||||
|
||||
scene->addEntity("Control entity")
|
||||
.addComponent<MusicComponent>("assets/musics/music_result.ogg")
|
||||
.addComponent<SoundComponent>(sounds);
|
||||
scene->addEntity("background")
|
||||
.addComponent<PositionComponent>()
|
||||
.addComponent<Drawable2DComponent, RAY::Texture>("assets/plain_menu_background.png");
|
||||
scene->addEntity("back to main menu")
|
||||
.addComponent<PositionComponent>(10, 1080 - 85, 0)
|
||||
.addComponent<Drawable2DComponent, RAY::Texture>("assets/buttons/button_back.png")
|
||||
.addComponent<OnClickComponent>([](WAL::Entity &entity, WAL::Wal &)
|
||||
{
|
||||
gameState.nextScene = BBM::GameState::SceneID::MainMenuScene;
|
||||
})
|
||||
.addComponent<OnIdleComponent>([](WAL::Entity &entity, WAL::Wal &)
|
||||
{
|
||||
RAY::Texture *texture = dynamic_cast<RAY::Texture *>(entity.getComponent<Drawable2DComponent>().drawable.get());
|
||||
|
||||
texture->use("assets/buttons/button_back.png");
|
||||
})
|
||||
.addComponent<OnHoverComponent>([](WAL::Entity &entity, WAL::Wal &)
|
||||
{
|
||||
RAY::Texture *texture = dynamic_cast<RAY::Texture *>(entity.getComponent<Drawable2DComponent>().drawable.get());
|
||||
|
||||
texture->use("assets/buttons/button_back_hovered.png");
|
||||
});
|
||||
return scene;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user