renderer system is started

This commit is contained in:
Clément Le Bihan
2021-05-24 10:06:25 +02:00
parent b9ced20b96
commit 4ef7f7543a
3 changed files with 86 additions and 21 deletions
+21 -21
View File
@@ -4,27 +4,27 @@ project(wal)
set(CMAKE_CXX_STANDARD 20)
add_library(wal
sources/Entity/Entity.hpp
sources/Component/Component.hpp
sources/System/System.hpp
sources/Wal.cpp
sources/Wal.hpp
sources/Scene/Scene.cpp
sources/Scene/Scene.hpp
sources/Exception/WalError.cpp
sources/Exception/WalError.hpp
sources/Entity/Entity.cpp
sources/Component/Component.cpp
sources/Component/Position/PositionComponent.cpp
sources/Component/Position/PositionComponent.hpp
sources/Models/Vector3.hpp
sources/Component/Movable/MovableComponent.cpp
sources/Component/Movable/MovableComponent.hpp
sources/System/Movable/MovableSystem.cpp
sources/System/Movable/MovableSystem.hpp
sources/System/System.cpp
sources/Models/Callback.hpp
)
sources/Entity/Entity.hpp
sources/Component/Component.hpp
sources/System/System.hpp
sources/Wal.cpp
sources/Wal.hpp
sources/Scene/Scene.cpp
sources/Scene/Scene.hpp
sources/Exception/WalError.cpp
sources/Exception/WalError.hpp
sources/Entity/Entity.cpp
sources/Component/Component.cpp
sources/Component/Position/PositionComponent.cpp
sources/Component/Position/PositionComponent.hpp
sources/Models/Vector3.hpp
sources/Component/Movable/MovableComponent.cpp
sources/Component/Movable/MovableComponent.hpp
sources/System/Movable/MovableSystem.cpp
sources/System/Movable/MovableSystem.hpp
sources/System/System.cpp
sources/Models/Callback.hpp
sources/System/Movable/RendererSystem.cpp sources/System/Movable/RendererSystem.hpp)
target_include_directories(wal PUBLIC sources)
@@ -0,0 +1,32 @@
//
// Created by cbihan on 24/05/2021.
//
#include "RendererSystem.hpp"
#include "Component/Position/PositionComponent.hpp"
namespace WAL
{
void RendererSystem::onUpdate(Entity &entity, std::chrono::nanoseconds dtime)
{
System::onUpdate(entity, dtime);
}
void RendererSystem::onFixedUpdate(Entity &entity)
{
System::onFixedUpdate(entity);
}
void RendererSystem::onSelfUpdate()
{
System::onSelfUpdate();
}
RendererSystem::RendererSystem()
: System({
typeid(PositionComponent)
})
{
}
}
@@ -0,0 +1,33 @@
//
// Created by cbihan on 24/05/2021.
//
#pragma once
#include "System/System.hpp"
namespace WAL
{
class RendererSystem : public System
{;
//! @brief Update the corresponding component of the given entity
//! @param entity The entity to update.
//! @param dtime The delta time.
void onUpdate(Entity &entity, std::chrono::nanoseconds dtime) override;
//! @brief An alternative of onUpdate that is called every 8ms (120 times per seconds). If the system slow down, it will try to catch up.
//! @remark This should be used for Physics, AI and everything that could be imprecise due to float rounding.
//! @param entity The entity to update.
void onFixedUpdate(Entity &entity) override;
//! @brief A method called after all entities that this system manage has been updated.
void onSelfUpdate() override;
public:
RendererSystem();
RendererSystem(const RendererSystem &) = default;
~RendererSystem() override = default;
RendererSystem &operator=(const RendererSystem &) = default;
};
}