added some ui in resumelobbyscene

This commit is contained in:
HENRY Benjamin
2021-06-18 16:12:01 +02:00
parent a253578d8a
commit 74f85373ac
2 changed files with 24 additions and 2 deletions
+2 -2
View File
@@ -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<PositionComponent>(1920 / 5, 2 * 1080 / 4.25, 0)
.addComponent<TimerComponent>(3s, [](WAL::Entity &myEntity, WAL::Wal &wal) {
myEntity.scheduleDeletion();
})
.addComponent<Drawable2DComponent, RAY2D::Text>(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;
+22
View File
@@ -41,6 +41,9 @@ namespace BBM
scene->addEntity("background")
.addComponent<PositionComponent>()
.addComponent<Drawable2DComponent, RAY::Texture>("assets/backgrounds/menu.png");
scene->addEntity("white background")
.addComponent<PositionComponent>(200, 300, 0)
.addComponent<Drawable2DComponent, RAY2D::Rectangle>(Vector2f(), Vector2f(1525, 325), RAY::Color(WHITE).setA(150));
scene->addEntity("lobby text")
.addComponent<PositionComponent>(1920 / 2.75, 100, 0)
.addComponent<Drawable2DComponent, RAY2D::Text>("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<PositionComponent>(1920 - 10 - 75, 1080 - 85, 0)
.addComponent<Drawable2DComponent, RAY::Texture>("assets/buttons/button_htp.png")
.addComponent<OnClickComponent>([](WAL::Entity &entity, WAL::Wal &)
{
gameState.nextScene = BBM::GameState::SceneID::HowToPlayScene;
})
.addComponent<OnIdleComponent>([](WAL::Entity &entity, WAL::Wal &)
{
RAY::Texture *texture = dynamic_cast<RAY::Texture *>(entity.getComponent<Drawable2DComponent>().drawable.get());
texture->use("assets/buttons/button_htp.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_htp_hovered.png");
});
scene->addEntity("camera")
.addComponent<PositionComponent>(8, 20, 7)
.addComponent<CameraComponent>(Vector3f(8, 0, 8));