Reworking drawable components

This commit is contained in:
Zoe Roux
2021-06-02 16:18:26 +02:00
parent 1cc6907ff0
commit 09d8b1a90b
15 changed files with 118 additions and 268 deletions
+12 -15
View File
@@ -4,16 +4,16 @@
#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/2D/Rectangle.hpp>
#include <TraceLog.hpp>
#include <System/Renderer/Renderer3DSystem.hpp>
#include "Component/Position/PositionComponent.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"
@@ -36,23 +36,20 @@ 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<Render2DScreenSystem>(window)
.addSystem<Renderer2DSystem<RAY2D::Rectangle>>();
wal.addSystem<RenderScreenSystem>(window);
wal.addSystem<RenderSystem>(wal, window);
}
std::shared_ptr<WAL::Scene> loadGameScene()
{
// Drawable2DComponent cmp = Drawable2DComponent(Vector2f(), Vector2f(), RED);
auto scene = std::make_shared<WAL::Scene>();
scene->addEntity("cube")
.addComponent<PositionComponent>()
.addComponent<Drawable2DComponent<RAY2D::Rectangle>>(Vector2f(), Vector2f(10, 10), RED);
// scene->addEntity("cube")
// .addComponent<PositionComponent>()
// .addComponent<Drawable2DComponent>(Vector2f(), Vector2f(10, 10), RED);
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"));
scene->addEntity("camera")
.addComponent<PositionComponent>(10, 10, 10)
.addComponent<CameraComponent>();