# AnimationBase< Tbase, Tspec, Tobj, GetCallback > 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, const Tobj *obj, TileIndex tile, bool random_animation)
| Animate a single tile.
static void | ChangeAnimationFrame (CallbackID cb, const Tspec *spec, const Tobj *obj, TileIndex tile, uint32 random_bits, uint32 trigger)
| Check a callback to determine what the next animation step is and execute that step.

## Detailed Description

### template<typename Tbase, typename Tspec, typename Tobj, uint16(*)(CallbackID callback, uint32 param1, uint32 param2, const Tspec *statspec, const Tobj *st, TileIndex tile) GetCallback>
struct AnimationBase< Tbase, Tspec, Tobj, GetCallback >

Helper class for a unified approach to NewGRF animation.

Template Parameters:

  | Tbase | Instantiation of this class.
  | Tspec | NewGRF specification related to the animated tile.
  | Tobj | Object related to the animated tile.
  | GetCallback | The callback function pointer.

Definition at line 29 of file newgrf_animation_base.h.

## Member Function Documentation

template<typename Tbase, typename Tspec, typename Tobj, uint16(*)(CallbackID callback, uint32 param1, uint32 param2, const Tspec *statspec, const Tobj *st, TileIndex tile) GetCallback>

static void AnimationBase< Tbase, Tspec, Tobj, GetCallback >::AnimateTile | ( | const Tspec * | spec,
|  | const Tobj * | obj,
|  | TileIndex | tile,
|  | bool | random_animation |
| ) |  |  | `[inline, static]`

Animate a single tile.

Parameters:

  | cb | The callback to actually call.
  | spec | Specification related to the tile.
  | obj | Object related to the tile.
  | tile | Tile to animate changes for.
  | random_animation | Whether to pass random bits to the "next frame" callback.

Definition at line 38 of file newgrf_animation_base.h.

template<typename Tbase, typename Tspec, typename Tobj, uint16(*)(CallbackID callback, uint32 param1, uint32 param2, const Tspec *statspec, const Tobj *st, TileIndex tile) GetCallback>

static void AnimationBase< Tbase, Tspec, Tobj, GetCallback >::ChangeAnimationFrame | ( | CallbackID | cb,
|  | const Tspec * | spec,
|  | const Tobj * | obj,
|  | TileIndex | tile,
|  | uint32 | random_bits,
|  | uint32 | trigger |
| ) |  |  | `[inline, static]`

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:

  | cb | The callback to actually call.
  | spec | Specification related to the tile.
  | obj | Object related to the tile.
  | tile | Tile to consider animation changes for.
  | random_bits | Random bits for this update. To be passed as parameter to the NewGRF.
  | trigger | What triggered this update? To be passed as parameter to the NewGRF.

Definition at line 113 of file newgrf_animation_base.h.

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

- src/newgrf_animation_base.h