43 float tex_scale_x = 1;
44 float tex_scale_y = 1;
51 uint8_t sprite_num = 1;
52 uint8_t animation = 1;
55 int8_t velocity_x = 0;
56 int8_t velocity_y = 0;
66 uint8_t animation_num = 1;
69 uint16_t texture = 0xffff;
72 toggles |= (1U << 0U);
73 toggles &= ~(1U << 1U);
74 toggles |= (1U << 2U);
75 toggles &= ~(1U << 3U);
90 [[nodiscard]]
bool is_active()
const;
92 [[nodiscard]]
bool is_static()
const;
94 [[nodiscard]]
bool is_visible()
const;
96 [[nodiscard]]
bool is_affected_by_physics()
const;
98 void set_active(
bool active);
100 void set_static(
bool static_);
102 void set_visible(
bool visible);
104 void set_affected_by_physics(
bool affected);
110 inline bool ST::entity::is_active()
const {
111 return static_cast<bool>(toggles & (1U << 0U));
114 inline bool ST::entity::is_static()
const {
115 return static_cast<bool>(toggles & (1U << 1U));
118 inline bool ST::entity::is_visible()
const {
119 return static_cast<bool>(toggles & (1U << 2U));
122 inline bool ST::entity::is_affected_by_physics()
const {
123 return static_cast<bool>(toggles & (1U << 3U));
126 inline void ST::entity::set_active(
bool active) {
128 toggles |= (1U << 0U);
130 toggles &= ~(1U << 0U);
134 inline void ST::entity::set_static(
bool static_) {
136 toggles |= (1U << 1U);
138 toggles &= ~(1U << 1U);
142 inline void ST::entity::set_visible(
bool visible) {
144 toggles |= (1U << 2U);
146 toggles &= ~(1U << 2U);
150 inline void ST::entity::set_affected_by_physics(
bool affected) {
152 toggles |= (1U << 3U);
154 toggles &= ~(1U << 3U);
198 this->col_x = col_x_;
199 this->col_y = -col_y_;
211 return !((y + offset_y <= other.y + other.col_y + other.offset_y) ||
212 (y + col_y + offset_y >= other.y + other.offset_y)
213 || (x + offset_x >= other.x + other.col_x + other.offset_x) ||
214 (x + col_x + offset_x <= other.x + other.offset_x));
217 static_assert(
sizeof(
ST::entity) == 36,
"class 'entity' is not sized properly, maybe you have misaligned the fields");
This class represents all static or dynamic objects in the game (excluding text, see ST::text)
int32_t get_col_y() const
void set_collision_box(int16_t, int16_t, int16_t, int16_t)
bool collides(const entity &) const
int16_t get_col_x_offset() const
int16_t get_col_y_offset() const
int32_t get_col_x() const