62 registry.
emplace<PlayerShip>(ship, speed);
Handle to an entity: 32 bits made of a 24-bit index and an 8-bit generation.
Definition entity.hpp:23
Entry point of the ECS: creates entities and stores their components.
Definition registry.hpp:34
Entity create()
Creates an entity without components.
Component & emplace(Entity entity, Args &&... args)
Gives an entity a component built in place.
Definition registry.hpp:76
View< Components... > view()
View on the entities that own all the listed components.
Definition registry.hpp:222
Collision detection: a uniform grid finds the entities close enough to collide (broad phase),...
Components shared by the client and the server.
Generational entity handle: an index into the component pools plus a generation.
Vector and matrix types of the engine (GLM behind engine names).
Movement: the direction of a player's input, velocities applied each tick, sine motions on top of the...
Vec2 direction_of(const PlayerInput &input) noexcept
Direction a player's input points to.
Definition movement.hpp:23
Vec2 half_extent_of(const Registry ®istry, Entity entity)
Half size of what must stay visible of an entity.
Definition movement.hpp:98
Vec2 clamp_into(Vec2 position, Vec2 half, const Aabb &area) noexcept
Keeps a position inside an area, with a margin on each side.
Definition movement.hpp:115
Shoot'em up building blocks on top of the ECS: player ships, their controls, weapons and their shots....
Definition components.hpp:5
void clamp_player_ships(ecs::Registry ®istry, const ecs::Aabb &area)
Keeps every player ship inside the play area.
Definition ships.hpp:40
void steer_player_ships(ecs::Registry ®istry, const ecs::Tick &tick)
Sets the velocity of every player ship from its input.
Definition ships.hpp:23
ecs::Entity spawn_player_ship(ecs::Registry ®istry, Vec2 position, float speed=PlayerShip{}.speed)
Creates a player ship ready to be steered.
Definition ships.hpp:56
glm::vec2 Vec2
2D vector of floats: positions, velocities, sizes (glm::vec2).
Definition math.hpp:19
Registry: owns the entities and one component pool per component type.
Components of the shoot'em up module: player ships and weapons.
Axis-aligned box given by its two corners, in logical pixels.
Definition collision.hpp:20
One simulation step, as the systems see it.
Definition system.hpp:23
How fast an entity moves.
Definition components.hpp:25
Vec2 value
Speed in logical pixels per second.
Definition components.hpp:27
Ship steered by a player's input (ecs::PlayerInput).
Definition components.hpp:8
float speed
Speed in logical pixels per second, the same in every direction.
Definition components.hpp:10
Systems and the scheduler that updates them in order, once per tick.