mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-06-06 19:22:20 +00:00
merge develop
This commit is contained in:
+19
-14
@@ -24,6 +24,7 @@
|
||||
#include "Runner.hpp"
|
||||
#include "Models/GameState.hpp"
|
||||
#include <System/Timer/TimerSystem.hpp>
|
||||
#include <System/Timer/TimerUISystem.hpp>
|
||||
#include <System/BombHolder/BombHolderSystem.hpp>
|
||||
#include <System/Event/EventSystem.hpp>
|
||||
#include <System/Health/HealthSystem.hpp>
|
||||
@@ -32,6 +33,9 @@
|
||||
#include <System/IntroAnimation/IntroAnimationSystem.hpp>
|
||||
#include <System/Levitate/LevitateSystem.hpp>
|
||||
#include <System/Bonus/PlayerBonusSystem.hpp>
|
||||
#include "System/Shaders/ShaderSystem.hpp"
|
||||
#include "System/Shaders/ShaderDrawable2DSystem.hpp"
|
||||
#include "System/Shaders/ShaderModelSystem.hpp"
|
||||
#include "System/Animation/AnimationsSystem.hpp"
|
||||
#include "Map/Map.hpp"
|
||||
#include "System/IAControllable/IAControllableSystem.hpp"
|
||||
@@ -46,6 +50,7 @@
|
||||
#include "System/Score/ScoreSystem.hpp"
|
||||
#include "System/EndCondition/EndConditionSystem.hpp"
|
||||
#include "Component/Lobby/LobbyComponent.hpp"
|
||||
#include "System/Bonus/BonusUISystem.hpp"
|
||||
|
||||
namespace BBM
|
||||
{
|
||||
@@ -57,14 +62,11 @@ namespace BBM
|
||||
auto &view = engine.getScene()->view<ControllableComponent>();
|
||||
if (RAY::Window::getInstance().shouldClose())
|
||||
engine.shouldClose = true;
|
||||
if (gameState.currentScene == GameState::SceneID::GameScene || gameState.currentScene == GameState::SceneID::SplashScreen) {
|
||||
if (gameState.currentScene == GameState::SceneID::GameScene) {
|
||||
for (auto &[_, component]: engine.getScene()->view<ControllableComponent>()) {
|
||||
if (component.pause && gameState.currentScene == GameState::SceneID::GameScene) {
|
||||
gameState.nextScene = GameState::SceneID::PauseMenuScene;
|
||||
break;
|
||||
} else if (gameState.currentScene == GameState::SceneID::SplashScreen && component.select) {
|
||||
gameState.nextScene = GameState::SceneID::TitleScreenScene;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -80,6 +82,7 @@ namespace BBM
|
||||
void Runner::addSystems(WAL::Wal &wal)
|
||||
{
|
||||
wal.addSystem<TimerSystem>()
|
||||
.addSystem<TimerUISystem>()
|
||||
.addSystem<KeyboardSystem>()
|
||||
.addSystem<GamepadSystem>()
|
||||
.addSystem<IAControllableSystem>()
|
||||
@@ -89,6 +92,7 @@ namespace BBM
|
||||
.addSystem<BombHolderSystem>()
|
||||
.addSystem<EventSystem>()
|
||||
.addSystem<HealthSystem>()
|
||||
.addSystem<BonusUISystem>()
|
||||
.addSystem<CollisionSystem>()
|
||||
.addSystem<LevitateSystem>()
|
||||
.addSystem<PlayerBonusSystem>()
|
||||
@@ -99,6 +103,9 @@ namespace BBM
|
||||
.addSystem<IntroAnimationSystem>()
|
||||
.addSystem<GravitySystem>()
|
||||
.addSystem<BumperTimerSystem>()
|
||||
.addSystem<ShaderSystem>()
|
||||
.addSystem<ShaderModelSystem>()
|
||||
.addSystem<ShaderDrawable2DSystem>()
|
||||
.addSystem<EndConditionSystem>()
|
||||
.addSystem<ScoreSystem>()
|
||||
.addSystem<MusicSystem>();
|
||||
@@ -107,23 +114,26 @@ namespace BBM
|
||||
void Runner::enableRaylib(WAL::Wal &wal)
|
||||
{
|
||||
RAY::TraceLog::setLevel(LOG_WARNING);
|
||||
RAY::Window &window = RAY::Window::getInstance(1920, 1080, "Bomberman");
|
||||
RAY::Window &window = RAY::Window::getInstance(1920, 1080, "Bomberman", FLAG_WINDOW_RESIZABLE);
|
||||
wal.addSystem<AnimationsSystem>()
|
||||
.addSystem<AnimatorSystem>()
|
||||
.addSystem<RenderSystem>(window);
|
||||
}
|
||||
|
||||
void Runner::addMenuControl(WAL::Scene &scene)
|
||||
void Runner::addMenuControl(WAL::Scene &scene, const std::map<SoundComponent::SoundIndex, std::string> &sounds)
|
||||
{
|
||||
scene.addEntity("Keyboard default control")
|
||||
.addComponent<ControllableComponent>()
|
||||
.addComponent<SoundComponent>(sounds)
|
||||
.addComponent<KeyboardComponent>();
|
||||
scene.addEntity("Keyboard second control")
|
||||
.addComponent<ControllableComponent>()
|
||||
.addComponent<SoundComponent>(sounds)
|
||||
.addComponent<KeyboardComponent>(ControllableComponent::Layout::KEYBOARD_1);
|
||||
for (int i = 0; i < 4; i++) {
|
||||
scene.addEntity("Gamepad controller")
|
||||
.addComponent<ControllableComponent>()
|
||||
.addComponent<SoundComponent>(sounds)
|
||||
.addComponent<GamepadComponent>(i);
|
||||
}
|
||||
}
|
||||
@@ -137,6 +147,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()
|
||||
@@ -147,13 +158,7 @@ namespace BBM
|
||||
Runner::enableRaylib(wal);
|
||||
Runner::loadScenes();
|
||||
wal.changeScene(Runner::gameState._loadedScenes[GameState::SceneID::SplashScreen]);
|
||||
|
||||
try {
|
||||
wal.run<GameState>(Runner::updateState, Runner::gameState);
|
||||
return 0;
|
||||
} catch (const std::exception &ex) {
|
||||
std::cerr << ex.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
wal.run<GameState>(Runner::updateState, Runner::gameState);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user