mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-05-27 16:22:09 +00:00
added speed to the save
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include <Wal.hpp>
|
||||
#include "Runner.hpp"
|
||||
#include <map>
|
||||
#include <Parser/ParserYaml.hpp>
|
||||
#include "Component/Music/MusicComponent.hpp"
|
||||
#include "Component/Sound/SoundComponent.hpp"
|
||||
#include "Component/Controllable/ControllableComponent.hpp"
|
||||
@@ -52,6 +53,26 @@ namespace BBM
|
||||
{
|
||||
gameState.nextScene = BBM::GameState::SceneID::GameScene;
|
||||
});
|
||||
auto &save = scene->addEntity("save & quit button")
|
||||
.addComponent<PositionComponent>(1920 / 2.5, 1080 - 240, 0)
|
||||
.addComponent<Drawable2DComponent, RAY::Texture>("assets/buttons/button_save.png")
|
||||
.addComponent<OnIdleComponent>([](WAL::Entity &entity, WAL::Wal &)
|
||||
{
|
||||
RAY::Texture *texture = dynamic_cast<RAY::Texture *>(entity.getComponent<Drawable2DComponent>().drawable.get());
|
||||
|
||||
texture->use("assets/buttons/button_save.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_save_hovered.png");
|
||||
})
|
||||
.addComponent<OnClickComponent>([](WAL::Entity &entity, WAL::Wal &)
|
||||
{
|
||||
ParserYAML::save(Runner::gameState._loadedScenes[GameState::SceneID::GameScene]);
|
||||
gameState.nextScene = BBM::GameState::SceneID::MainMenuScene;
|
||||
});
|
||||
auto &settings = scene->addEntity("settings button")
|
||||
.addComponent<PositionComponent>(1920 / 2.5, 1080 - 360, 0)
|
||||
.addComponent<Drawable2DComponent, RAY::Texture>("assets/buttons/button_settings.png")
|
||||
@@ -72,7 +93,7 @@ namespace BBM
|
||||
gameState.nextScene = BBM::GameState::SceneID::SettingsScene;
|
||||
});
|
||||
auto &exit = scene->addEntity("exit button")
|
||||
.addComponent<PositionComponent>(1920 / 1.5, 1080 - 360, 0)
|
||||
.addComponent<PositionComponent>(1920 / 1.55, 1080 - 360, 0)
|
||||
.addComponent<Drawable2DComponent, RAY::Texture>("assets/buttons/button_exit.png")
|
||||
.addComponent<OnIdleComponent>([](WAL::Entity &entity, WAL::Wal &)
|
||||
{
|
||||
@@ -92,9 +113,10 @@ namespace BBM
|
||||
});
|
||||
//needed material
|
||||
//music
|
||||
play.getComponent<OnClickComponent>().setButtonLinks(nullptr, nullptr, nullptr, &settings);
|
||||
settings.getComponent<OnClickComponent>().setButtonLinks(nullptr, nullptr, &play, &exit);
|
||||
exit.getComponent<OnClickComponent>().setButtonLinks(nullptr, nullptr, &settings, nullptr);
|
||||
save.getComponent<OnClickComponent>().setButtonLinks(&play);
|
||||
play.getComponent<OnClickComponent>().setButtonLinks(nullptr, &save, nullptr, &settings);
|
||||
settings.getComponent<OnClickComponent>().setButtonLinks(nullptr, &save, &play, &exit);
|
||||
exit.getComponent<OnClickComponent>().setButtonLinks(nullptr, &save, &settings, nullptr);
|
||||
return scene;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user