V-Gears 0
Free Final Fantasy VII engine.
Background2DAnimation.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2022 The V-Gears Team
3 *
4 * This file is part of V-Gears
5 *
6 * V-Gears is free software: you can redistribute it and/or modify it under
7 * terms of the GNU General Public License as published by the Free Software
8 * Foundation, version 3.0 (GPLv3) of the License.
9 *
10 * V-Gears is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#pragma once
17
18#include <OgreString.h>
19#include <Ogre.h>
20#include <vector>
21#include "map/VGearsTile.h"
22
23class Background2D;
24
29
30 public:
31
40 const Ogre::String& name, Background2D* background,
41 const int tile_index
42 );
43
47 virtual ~Background2DAnimation();
48
52 enum State{
53
58
62 LOOPED
63 };
64
71 void AddTime(const float time);
72
78 const Ogre::String& GetName() const;
79
86 void SetTime( const float time );
87
94 float GetTime() const;
95
102 void SetLength(const float time);
103
110 float GetLength() const;
111
117 virtual void AddUVKeyFrame(const VGears::KeyFrame key_frame);
118
126 virtual void AddUVKeyFrame(const float time, const Ogre::Vector4& uv);
127
138 virtual void AddUVKeyFrame(
139 const float time,
140 const float u1, const float v1, const float u2, const float v2
141 );
142
143 private:
144
149
154
159
164
168 float time_;
169
173 float length_;
174
179
183 float time;
184
188 float u1;
189
193 float v1;
194
198 float u2;
199
203 float v2;
204 };
205
209 std::vector<Background2DKeyFrameUV> uv_;
210};
211
An animation in the background of a field.
Definition: Background2DAnimation.h:28
Background2DAnimation()
Constructor.
const Ogre::String & GetName() const
Retrieves the animation name.
Definition: Background2DAnimation.cpp:53
State
Repetition status of the animation.
Definition: Background2DAnimation.h:52
@ ONCE
The animation must be played once.
Definition: Background2DAnimation.h:57
@ LOOPED
The animation must loop indefinitely.
Definition: Background2DAnimation.h:62
void SetTime(const float time)
Sets the time the animation has been running.
Definition: Background2DAnimation.cpp:55
void AddTime(const float time)
Adds time, so the animation state is changed according to it.
Definition: Background2DAnimation.cpp:32
std::vector< Background2DKeyFrameUV > uv_
Keyframe list.
Definition: Background2DAnimation.h:209
void SetLength(const float time)
Sets the duration of the animation.
Definition: Background2DAnimation.cpp:59
float GetTime() const
Retrieves the time the animation has been running.
Definition: Background2DAnimation.cpp:57
float length_
The duration of the animation.
Definition: Background2DAnimation.h:173
Background2D * background_
The background the animation belongs to.
Definition: Background2DAnimation.h:158
virtual void AddUVKeyFrame(const VGears::KeyFrame key_frame)
Adds a keyframe to the animation.
Definition: Background2DAnimation.cpp:63
float time_
The animation current time.
Definition: Background2DAnimation.h:168
Ogre::String name_
The animation name.
Definition: Background2DAnimation.h:153
virtual ~Background2DAnimation()
Destructor.
Definition: Background2DAnimation.cpp:30
float GetLength() const
Retrieves the duration of the animation.
Definition: Background2DAnimation.cpp:61
int tile_index_
The index of the tile tha animation applies to.
Definition: Background2DAnimation.h:163
A field background.
Definition: Background2D.h:29
Ogre::String String
Definition: TypeDefine.h:37
A keyframe.
Definition: Background2DAnimation.h:178
float u1
Keyframe vector component.
Definition: Background2DAnimation.h:188
float v2
Keyframe vector component.
Definition: Background2DAnimation.h:203
float u2
Keyframe vector component.
Definition: Background2DAnimation.h:198
float v1
Keyframe vector component.
Definition: Background2DAnimation.h:193
float time
Keyframe time.
Definition: Background2DAnimation.h:183
A tile key frame.
Definition: VGearsTile.h:44