12#define M_PI 3.14159265358979323846
32 const auto entity = pair.first;
36 (velocity !=
nullptr) && (rect !=
nullptr))
39 float angle = std::atan2(velocity->y, velocity->x);
41 const bool isIdle = (std::abs(velocity->x) < 0.1f && std::abs(velocity->y) < 0.1f);
50 angle += 2.0f *
static_cast<float>(
M_PI);
52 if (angle >= 0 && angle <
M_PI / 4)
56 else if (angle >=
M_PI / 4 && angle < 3 *
M_PI / 4)
60 else if (angle >= 3 *
M_PI / 4 && angle < 5 *
M_PI / 4)
64 else if (angle >= 5 *
M_PI / 4 && angle < 7 *
M_PI / 4)
79 const int current_row =
static_cast<int>(
82 frame_y = skin_offset + frame_y;
84 rect->pos_x =
static_cast<float>(frame_x);
85 rect->pos_y =
static_cast<float>(frame_y);
This file contains the component definitions.
Configuration constants for the multiplayer game.
This file contains the interface for systems.
This file contains the Registry class declaration.
Abstract class for system.
Class for managing entities and their components.
std::unordered_map< Entity, T > & getAll()
T * getComponent(Entity e)
~PlayerDirectionSystem() override=default
PlayerDirectionSystem(PlayerDirectionSystem &&)=delete
PlayerDirectionSystem()=default
PlayerDirectionSystem(const PlayerDirectionSystem &)=delete
void update(ecs::Registry ®istry, float) override
PlayerDirectionSystem & operator=(PlayerDirectionSystem &&)=delete
PlayerDirectionSystem & operator=(const PlayerDirectionSystem &)=delete
constexpr float SPRITE_HEIGHT
constexpr float SPRITE_WIDTH
constexpr int FRAMES_PER_ROW