OpenTTD Source: src/newgrf_animation_type.h Source File

OpenTTD Source 15.0-RC2

newgrf_animation_type.h
Go to the documentation of this file.
1/*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
6 */
7
10#ifndef NEWGRF_ANIMATION_TYPE_H
11#define NEWGRF_ANIMATION_TYPE_H
12
13 enum class AnimationStatus : uint8_t {
14 NonLooping = 0x00,
15 Looping = 0x01,
16 NoAnimation = 0xFF,
17};
18
20template <class AnimationTriggers>
21 struct AnimationInfo {
22 uint8_t frames = 0;
23 AnimationStatus status = AnimationStatus::NoAnimation;
24 uint8_t speed = 2;
25 AnimationTriggers triggers;
26};
27
28template <>
29 struct AnimationInfo<void> {
30 uint8_t frames = 0;
31 AnimationStatus status = AnimationStatus::NoAnimation;
32 uint8_t speed = 2;
33};
34
35#endif /* NEWGRF_ANIMATION_TYPE_H */
AnimationStatus
AnimationStatus
Definition newgrf_animation_type.h:13
AnimationStatus::NonLooping
@ NonLooping
Animation is not looping.
AnimationStatus::Looping
@ Looping
Animation is looping.
AnimationStatus::NoAnimation
@ NoAnimation
There is no animation.
AnimationInfo
Information about animation.
Definition newgrf_animation_type.h:21
AnimationInfo::status
AnimationStatus status
Status.
Definition newgrf_animation_type.h:23
AnimationInfo::speed
uint8_t speed
The speed: time between frames = 2^speed ticks.
Definition newgrf_animation_type.h:24
AnimationInfo::frames
uint8_t frames
The number of frames.
Definition newgrf_animation_type.h:22
AnimationInfo::triggers
AnimationTriggers triggers
The enabled animation triggers.
Definition newgrf_animation_type.h:25