update to entt v3.9.0

This commit is contained in:
2021-12-13 18:42:22 +01:00
parent 494912ce8a
commit 81043264d2
12 changed files with 66 additions and 34 deletions

View File

@ -1,15 +1,11 @@
cmake_minimum_required(VERSION 3.2)
project(simple_velocity_system CXX)
set(HPP_FILES
add_library(simple_velocity_system
src/mm/systems/simple_velocity_system2d.hpp
src/mm/systems/simple_velocity_system2d.cpp
)
set(CPP_FILES
)
add_library(simple_velocity_system ${CPP_FILES} ${HPP_FILES})
target_include_directories(simple_velocity_system PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/src")
target_link_libraries(simple_velocity_system

View File

@ -0,0 +1,22 @@
#include "./simple_velocity_system2d.hpp"
#include <entt/entity/registry.hpp>
namespace MM::Systems {
void simple_velocity(
entt::view<entt::get_t<
Components::Transform2D,
const Components::Velocity2D
>> view,
const Components::TimeDelta& td
) {
view.each([delta = td.tickDelta](auto, auto& t, auto& v) {
t.position += v.velocity * delta;
t.rotation += v.rotation * delta;
}
);
}
} // MM::Systems

View File

@ -1,7 +1,5 @@
#pragma once
#include <functional>
#include <mm/components/velocity2d.hpp>
#include <mm/components/transform2d.hpp>
#include <mm/components/time_delta.hpp>
@ -9,12 +7,14 @@
#include <mm/services/scene_service_interface.hpp>
namespace MM::Systems {
inline void simple_velocity(entt::view<entt::exclude_t<>, Components::Transform2D, const Components::Velocity2D> view, const Components::TimeDelta& td) {
view.each([delta = td.tickDelta](auto, auto& t, auto& v) {
t.position += v.velocity * delta;
t.rotation += v.rotation * delta;
}
);
}
}
void simple_velocity(
entt::view<entt::get_t<
Components::Transform2D,
const Components::Velocity2D
>> view,
const Components::TimeDelta& td
);
} // MM::Systems