ST_engine  0.3-ALPHA
Public Member Functions | Public Attributes | List of all members
ST::entity Class Reference

This class represents all static or dynamic objects in the game (excluding text, see ST::text) More...

#include <entity.hpp>

Public Member Functions

int32_t get_col_x () const
 
int32_t get_col_y () const
 
int16_t get_col_y_offset () const
 
int16_t get_col_x_offset () const
 
bool collides (const entity &) const
 
void set_collision_box (int16_t, int16_t, int16_t, int16_t)
 
bool is_active () const
 
bool is_static () const
 
bool is_visible () const
 
bool is_affected_by_physics () const
 
void set_active (bool active)
 
void set_static (bool static_)
 
void set_visible (bool visible)
 
void set_affected_by_physics (bool affected)
 

Public Attributes

int32_t x = 0
 
int32_t y = 0
 
float tex_scale_x = 1
 
float tex_scale_y = 1
 
uint16_t tex_w = 0
 
uint16_t tex_h = 0
 
uint8_t sprite_num = 1
 
uint8_t animation = 1
 
int8_t velocity_x = 0
 
int8_t velocity_y = 0
 
uint8_t toggles = 0
 
uint8_t animation_num = 1
 
uint16_t texture = 0xffff
 

Detailed Description

This class represents all static or dynamic objects in the game (excluding text, see ST::text)

Contains all the data for an entity. Texture and animation information, position as well as various other options.

Definition at line 24 of file entity.hpp.

Member Function Documentation

◆ collides()

bool ST::entity::collides ( const entity other) const
inline

//TODO: Can't move this to the physics manager because of entityCollidesLua(), but it does not belong here. Tells if two entities are colliding or not.

Parameters
otherEntity to test collision against.
Returns
True if colliding, false otherwise.

Definition at line 210 of file entity.hpp.

◆ get_col_x()

int32_t ST::entity::get_col_x ( ) const
inline

Get the horizontal length of the collision box.

Returns
A int32_t representing the length.

Definition at line 162 of file entity.hpp.

◆ get_col_x_offset()

int16_t ST::entity::get_col_x_offset ( ) const
inline

Get the horizontal offset for the collision box.

Returns
The offset relative to the current position.

Definition at line 178 of file entity.hpp.

◆ get_col_y()

int32_t ST::entity::get_col_y ( ) const
inline

Get the vertical length of the collision box.

Returns
A int32_t representing the length.

Definition at line 170 of file entity.hpp.

◆ get_col_y_offset()

int16_t ST::entity::get_col_y_offset ( ) const
inline

Get the vertical offset for the collision box.

Returns
The offset relative to the current position.

Definition at line 186 of file entity.hpp.

◆ set_collision_box()

void ST::entity::set_collision_box ( int16_t  offsetX,
int16_t  offsetY,
int16_t  col_x_,
int16_t  col_y_ 
)
inline

Set the collision box for the entity, relative to the current position.

Parameters
offsetXThe horizontal offset for the collision box.
offsetYThe vertical offset for the collision box.
XThe horizontal length of the collision box.
YThe vertical length of the collision box.

Definition at line 197 of file entity.hpp.


The documentation for this class was generated from the following file: