CorsixTH engine (the C++ part)
Open source implementation of Theme Hospital
Loading...
Searching...
No Matches
Public Member Functions | List of all members
animation Class Reference

#include <th_gfx.h>

Inheritance diagram for animation:
animation_base drawable link_list

Public Member Functions

 animation ()
 
void set_parent (animation *parent_anim, bool use_primary)
 
void tick ()
 
void draw (render_target *canvas, const xy_pair &draw_pos)
 
void draw_morph (render_target *canvas, const xy_pair &draw_pos)
 
void draw_child (render_target *canvas, const xy_pair &draw_pos, bool use_primary)
 
void draw_fn (render_target *canvas, const xy_pair &draw_pos) override
 Draw the object at a specific point on a render target.
 
bool hit_test (const xy_pair &draw_pos, const xy_pair &obj_pos)
 
bool hit_test_morph (const xy_pair &draw_pos, const xy_pair &obj_pos)
 
bool hit_test_child (const xy_pair &draw_pos, const xy_pair &obj_pos)
 
bool hit_test_fn (const xy_pair &draw_pos, const xy_pair &obj_pos) override
 Perform a hit test against the object.
 
bool is_multiple_frame_animation_fn () override
 
link_listget_previous ()
 
size_t get_animation () const
 
bool get_primary_marker (int *pX, int *pY)
 
bool get_secondary_marker (int *pX, int *pY)
 
size_t get_frame () const
 
int get_crop_column () const
 
void set_animation (animation_manager *mgr, size_t anim)
 
void set_morph_target (animation *target, int duration=1)
 
void set_frame (size_t new_frame)
 
void set_speed (int x, int y)
 
void set_crop_column (int column)
 
void persist (lua_persist_writer *writer) const
 
void depersist (lua_persist_reader *reader)
 
void set_patient_effect (animation_effect patient_effect)
 
void set_animation_kind (animation_kind anim_kind)
 
animation_kind get_animation_kind ()
 
animation_managerget_animation_manager ()
 
- Public Member Functions inherited from animation_base
 animation_base ()
 
void remove_from_tile ()
 
void attach_to_tile (const xy_pair &tile_pos, map_tile *node, int layer)
 
uint32_t get_flags () const
 
const xy_pairget_pixel_offset () const
 
const xy_pairget_tile () const
 
void set_flags (uint32_t iFlags)
 
void set_tile (const xy_pair &tile_pos)
 
void set_pixel_offset (int x, int y)
 
void set_layer (int iLayer, int iId)
 
void set_layers_from (const animation_base *pSrc)
 
- Public Member Functions inherited from drawable
 drawable ()=default
 
int get_drawing_layer ()
 
void set_drawing_layer (int layer)
 

Additional Inherited Members

- Public Attributes inherited from drawable
uint32_t flags {0}
 Drawing flags (zero or more list flags from draw_flags).
 
- Protected Attributes inherited from animation_base
xy_pair tile {-1, -1}
 Tile containing the animation. A negative x or y means it is not active.
 
xy_pair pixel_offset {0, 0}
 Offset in pixels relative to the center of the animation tile.
 
::layers layers {}
 

Constructor & Destructor Documentation

◆ animation()

animation::animation ( )

Member Function Documentation

◆ depersist()

void animation::depersist ( lua_persist_reader reader)

◆ draw()

void animation::draw ( render_target canvas,
const xy_pair draw_pos 
)

◆ draw_child()

void animation::draw_child ( render_target canvas,
const xy_pair draw_pos,
bool  use_primary 
)

◆ draw_fn()

void animation::draw_fn ( render_target canvas,
const xy_pair draw_pos 
)
inlineoverridevirtual

Draw the object at a specific point on a render target.

Can also "draw" the object to the speakers, i.e. play sounds.

Implements drawable.

◆ draw_morph()

void animation::draw_morph ( render_target canvas,
const xy_pair draw_pos 
)

◆ get_animation()

size_t animation::get_animation ( ) const
inline

◆ get_animation_kind()

animation_kind animation::get_animation_kind ( )
inline

◆ get_animation_manager()

animation_manager * animation::get_animation_manager ( )
inline

◆ get_crop_column()

int animation::get_crop_column ( ) const
inline

◆ get_frame()

size_t animation::get_frame ( ) const
inline

◆ get_previous()

link_list * animation::get_previous ( )
inline

◆ get_primary_marker()

bool animation::get_primary_marker ( int pX,
int pY 
)

◆ get_secondary_marker()

bool animation::get_secondary_marker ( int pX,
int pY 
)

◆ hit_test()

bool animation::hit_test ( const xy_pair draw_pos,
const xy_pair obj_pos 
)

◆ hit_test_child()

bool animation::hit_test_child ( const xy_pair draw_pos,
const xy_pair obj_pos 
)

◆ hit_test_fn()

bool animation::hit_test_fn ( const xy_pair draw_pos,
const xy_pair obj_pos 
)
inlineoverridevirtual

Perform a hit test against the object.

Should return true if when the object is drawn at draw_pos on a canvas, the point obj_pos is within / on the object.

Implements drawable.

◆ hit_test_morph()

bool animation::hit_test_morph ( const xy_pair draw_pos,
const xy_pair obj_pos 
)

◆ is_multiple_frame_animation_fn()

bool animation::is_multiple_frame_animation_fn ( )
inlineoverridevirtual

Returns true if instance is a multiple frame animation. Should be overloaded in derived class.

Implements drawable.

◆ persist()

void animation::persist ( lua_persist_writer writer) const

◆ set_animation()

void animation::set_animation ( animation_manager mgr,
size_t  anim 
)

◆ set_animation_kind()

void animation::set_animation_kind ( animation_kind  anim_kind)

◆ set_crop_column()

void animation::set_crop_column ( int  column)
inline

◆ set_frame()

void animation::set_frame ( size_t  new_frame)

◆ set_morph_target()

void animation::set_morph_target ( animation target,
int  duration = 1 
)

◆ set_parent()

void animation::set_parent ( animation parent_anim,
bool  use_primary 
)

◆ set_patient_effect()

void animation::set_patient_effect ( animation_effect  patient_effect)

◆ set_speed()

void animation::set_speed ( int  x,
int  y 
)
inline

◆ tick()

void animation::tick ( )

Member Data Documentation

◆ parent

animation* animation::parent

Some animations are tied to the primary or secondary marker of another animation and hence have a parent rather than a speed.

◆ speed

xy_pair animation::speed {}

Speed in pixels per tick.


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