Merging with develop and reworking all systems

This commit is contained in:
Zoe Roux
2021-06-04 01:04:05 +02:00
41 changed files with 661 additions and 333 deletions
+20 -22
View File
@@ -4,15 +4,13 @@
#include <Wal.hpp>
#include <iostream>
#include <System/Movable/MovableSystem.hpp>
#include <System/Renderer/RenderScreenSystem.hpp>
#include <System/Renderer/Render2DScreenSystem.hpp>
#include <System/Renderer/Renderer2DSystem.hpp>
#include "System/Movable/MovableSystem.hpp"
#include "System/Renderer/RenderSystem.hpp"
#include <Model/Model.hpp>
#include <Drawables/3D/Cube.hpp>
#include <Drawables/2D/Rectangle.hpp>
#include <Drawables/3D/Cube.hpp>
#include <TraceLog.hpp>
#include <System/Renderer/Renderer3DSystem.hpp>
#include <System/Keyboard/KeyboardSystem.hpp>
#include <System/Controllable/ControllableSystem.hpp>
#include <System/Collision/CollisionSystem.hpp>
@@ -23,8 +21,13 @@
#include <System/Gamepad/GamepadSystem.hpp>
#include "Models/Vector2.hpp"
#include "Component/Renderer/CameraComponent.hpp"
#include "Component/Renderer/Drawable2DComponent.hpp"
#include "Component/Renderer/Drawable3DComponent.hpp"
#include "Runner.hpp"
#include "Models/GameState.hpp"
#include <Model/ModelAnimations.hpp>
#include "Component/Animation/AnimationsComponent.hpp"
#include "System/Animation/AnimationsSystem.hpp"
#include "Map/Map.hpp"
namespace RAY2D = RAY::Drawables::Drawables2D;
@@ -47,7 +50,7 @@ namespace BBM
wal.addSystem<KeyboardSystem>()
.addSystem<GamepadSystem>()
.addSystem<ControllableSystem>()
.addSystem<CollisionSystem>(wal)
.addSystem<CollisionSystem>()
.addSystem<MovableSystem>();
}
@@ -55,13 +58,7 @@ namespace BBM
{
RAY::TraceLog::setLevel(LOG_WARNING);
RAY::Window &window = RAY::Window::getInstance(600, 400, "Bomberman", FLAG_WINDOW_RESIZABLE);
wal.addSystem<Renderer3DSystem<RAY3D::Model>>();
wal.addSystem<Renderer3DSystem<RAY3D::Cube>>();
wal.addSystem<Render2DScreenSystem>(window)
.addSystem<Renderer2DSystem<RAY2D::Rectangle>>();
wal.addSystem<RenderScreenSystem>(window);
wal.addSystem<RenderSystem>(window);
}
std::shared_ptr<WAL::Scene> loadGameScene(WAL::Wal &wal)
@@ -69,24 +66,25 @@ namespace BBM
auto scene = std::make_shared<WAL::Scene>();
scene->addEntity("player")
.addComponent<PositionComponent>()
.addComponent<Drawable3DComponent<RAY3D::Model>>("assets/player/player.iqm", std::make_pair(MAP_DIFFUSE, "assets/player/blue.png"))
.addComponent<Drawable3DComponent, RAY3D::Model>("assets/player/player.iqm", std::make_pair(MAP_DIFFUSE, "assets/player/blue.png"))
.addComponent<ControllableComponent>()
.addComponent<KeyboardComponent>()
.addComponent<AnimationsComponent>(RAY::ModelAnimations("assets/player/player.iqm"), 1)
.addComponent<CollisionComponent>(2)
.addComponent<MovableComponent>();
scene->addEntity("cube")
.addComponent<PositionComponent>(-5, 0, -5)
.addComponent<Drawable3DComponent<RAY3D::Cube>>(Vector3f(-5, 0, -5), Vector3f(3, 3, 3), RED)
.addComponent<Drawable3DComponent, RAY3D::Cube>(Vector3f(-5, 0, -5), Vector3f(3, 3, 3), RED)
.addComponent<ControllableComponent>()
.addComponent<KeyboardComponent>()
.addComponent<CollisionComponent>([](WAL::Entity &, const WAL::Entity &){},
[](WAL::Entity &actual, const WAL::Entity &) {
try {
auto &mov = actual.getComponent<MovableComponent>();
mov.resetVelocity();
} catch (std::exception &e) { };
}, 3);
[](WAL::Entity &actual, const WAL::Entity &) {
try {
auto &mov = actual.getComponent<MovableComponent>();
mov.resetVelocity();
} catch (std::exception &e) { }
}, 3);
scene->addEntity("camera")
.addComponent<PositionComponent>(8, 20, 7)
.addComponent<CameraComponent>(Vector3f(8, 0, 8));