openarras/objects.hpp
2023-05-30 21:03:04 +08:00

32 lines
540 B
C++

#ifndef HEADER_OBJECTS_HPP
#define HEADER_OBJECTS_HPP
#include "2d.h"
#include <entt/entt.hpp>
namespace arras {
struct Transform {
Vec2 position;
};
struct Velocity {
Vec2 velocity;
};
struct EngineAcceleration {
Vec2 ideal_velocity;
Float acceleration;
};
inline entt::entity makeTank(entt::registry &r, Vec2 position) {
const auto e = r.create();
r.emplace<Transform>(e, Transform{position});
r.emplace<Velocity>(e, Velocity{{0, 0}});
r.emplace<EngineAcceleration>(e, EngineAcceleration{{0, 0}, 1});
return e;
}
}
#endif