sound playing at end of intro

This commit is contained in:
arthur.jamet
2021-06-12 14:59:40 +02:00
parent b5d33751af
commit 5b45158d26
3 changed files with 41 additions and 6 deletions
+14 -4
View File
@@ -60,11 +60,14 @@ namespace BBM
{
if (RAY::Window::getInstance().shouldClose())
engine.shouldClose = true;
if (gameState.currentScene == GameState::SceneID::GameScene) {
if (gameState.currentScene == GameState::SceneID::GameScene || gameState.currentScene == GameState::SceneID::SplashScreen) {
for (auto &[_, component]: engine.getScene()->view<ControllableComponent>()) {
if (component.pause) {
if (component.pause && gameState.currentScene == GameState::SceneID::GameScene) {
gameState.nextScene = GameState::SceneID::PauseMenuScene;
break;
} else if (gameState.currentScene == GameState::SceneID::SplashScreen && component.jump) {
gameState.nextScene = GameState::SceneID::TitleScreenScene;
break;
}
}
}
@@ -609,12 +612,19 @@ namespace BBM
{
auto scene = std::make_shared<WAL::Scene>();
auto &splashComponent = scene->addEntity("animation component")
.addComponent<IntroAnimationComponent>();
.addComponent<IntroAnimationComponent>()
.addComponent<ControllableComponent>()
.addComponent<KeyboardComponent>();
auto &background = scene->addEntity("background")
.addComponent<PositionComponent>(0, 0, 0)
.addComponent<Drawable2DComponent, RAY2D::Rectangle>(RAY::Vector2(), RAY::Vector2(1920, 1080));
auto &text = scene->addEntity("powered by text")
.addComponent<PositionComponent>(1920 / 2 - 200, 1080 / 2 - 180, 0)
.addComponent<Drawable2DComponent, RAY2D::Text>("powered by", 30, RAY::Vector2(), BLACK);
auto &skipText = scene->addEntity("Press space to skip")
.addComponent<PositionComponent>(1920 - 250, 1080 - 30, 0)
.addComponent<Drawable2DComponent, RAY2D::Text>("Press space to skip", 20, RAY::Vector2(), BLACK);
return scene;
}