mirror of
https://github.com/MadeOfJelly/MushMachine.git
synced 2025-06-19 03:06:37 +02:00
update to entt v3.9.0
This commit is contained in:
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user