OpenTTD Source  20240919-master-gdf0233f4c2
AnimationBase< Tbase, Tspec, Tobj, Textra, GetCallback, Tframehelper > Struct Template Reference

Helper class for a unified approach to NewGRF animation. More...

#include <newgrf_animation_base.h>

Static Public Member Functions

static void AnimateTile (const Tspec *spec, Tobj *obj, TileIndex tile, bool random_animation, Textra extra_data=0)
 Animate a single tile. More...
 
static void ChangeAnimationFrame (CallbackID cb, const Tspec *spec, Tobj *obj, TileIndex tile, uint32_t random_bits, uint32_t trigger, Textra extra_data=0)
 Check a callback to determine what the next animation step is and execute that step. More...
 

Detailed Description

template<typename Tbase, typename Tspec, typename Tobj, typename Textra, uint16_t(*)(CallbackID callback, uint32_t param1, uint32_t param2, const Tspec *statspec, Tobj *st, TileIndex tile, Textra extra_data) GetCallback, typename Tframehelper>
struct AnimationBase< Tbase, Tspec, Tobj, Textra, GetCallback, Tframehelper >

Helper class for a unified approach to NewGRF animation.

Template Parameters
TbaseInstantiation of this class.
TspecNewGRF specification related to the animated tile.
TobjObject related to the animated tile.
TextraCustom extra callback data.
GetCallbackThe callback function pointer.
TframehelperThe animation frame get/set helper.

Definition at line 43 of file newgrf_animation_base.h.

Member Function Documentation

◆ AnimateTile()

template<typename Tbase , typename Tspec , typename Tobj , typename Textra , uint16_t(*)(CallbackID callback, uint32_t param1, uint32_t param2, const Tspec *statspec, Tobj *st, TileIndex tile, Textra extra_data) GetCallback, typename Tframehelper >
static void AnimationBase< Tbase, Tspec, Tobj, Textra, GetCallback, Tframehelper >::AnimateTile ( const Tspec *  spec,
Tobj *  obj,
TileIndex  tile,
bool  random_animation,
Textra  extra_data = 0 
)
inlinestatic

Animate a single tile.

Parameters
specSpecification related to the tile.
objObject related to the tile.
tileTile to animate changes for.
random_animationWhether to pass random bits to the "next frame" callback.
extra_dataCustom extra callback data.

Definition at line 52 of file newgrf_animation_base.h.

◆ ChangeAnimationFrame()

template<typename Tbase , typename Tspec , typename Tobj , typename Textra , uint16_t(*)(CallbackID callback, uint32_t param1, uint32_t param2, const Tspec *statspec, Tobj *st, TileIndex tile, Textra extra_data) GetCallback, typename Tframehelper >
static void AnimationBase< Tbase, Tspec, Tobj, Textra, GetCallback, Tframehelper >::ChangeAnimationFrame ( CallbackID  cb,
const Tspec *  spec,
Tobj *  obj,
TileIndex  tile,
uint32_t  random_bits,
uint32_t  trigger,
Textra  extra_data = 0 
)
inlinestatic

Check a callback to determine what the next animation step is and execute that step.

This includes stopping and starting animations as well as updating animation frames and playing sounds.

Parameters
cbThe callback to actually call.
specSpecification related to the tile.
objObject related to the tile.
tileTile to consider animation changes for.
random_bitsRandom bits for this update. To be passed as parameter to the NewGRF.
triggerWhat triggered this update? To be passed as parameter to the NewGRF.
extra_dataCustom extra data for callback processing.

Definition at line 131 of file newgrf_animation_base.h.


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