 |
Gorgon Game Engine
|
Go to the documentation of this file.
3 #include "../Animation.h"
27 unsigned int left = 0;
virtual bool IsControlled() const override
This method allows clients to determine if the progress is controlled.
Definition: ControlledTimer.h:21
void Animate()
Definition: Animation.cpp:31
virtual void Progress(unsigned int) override
Definition: ControlledTimer.h:25
This class stores animations as a part of itself so that it can be moved around as a value rather tha...
Definition: Storage.h:21
virtual ~ControllerBase()
Destructor.
Definition: Animation.cpp:54
virtual ~Governor()
Destroys this governor. If it is the active governor, default governor will be activated.
Definition: Animation.cpp:21
bool islooping
Looping state.
Definition: Animation.h:267
Governor * governor
Definition: Animation.h:117
double progress
Floating point progress to avoid precision loss due to speed.
Definition: Animation.h:276
Definition: TextureAnimation.h:137
basic_TextureAnimationProvider< Bitmap, basic_TextureAnimation, basic_AnimationFrame< Bitmap > > BitmapAnimationProvider
Definition: TextureAnimation.h:520
virtual GID::Type GetGID() const =0
This function shall return Gorgon ID of this resource.
constexpr Type Null
Null resource.
Definition: GID.h:105
void save(Writer &writer) const override
Definition: Animation.cpp:92
Controllers are required to progress animations.
Definition: Animation.h:65
Event< Controller > FinishedEvent
Will be fired when the controller reaches the finished state.
Definition: Animation.h:259
Controller(double progress=0.0)
Default constructor.
Definition: Animation.cpp:114
void WriteChunkHeader(GID::Type type, unsigned long size)
Writes the header of a chunk.
Definition: Writer.h:364
static void SaveThis(Writer &writer, const Graphics::Bitmap &bmp, GID::Type type=GID::Image)
This function can be used to save a bitmap as image resource without modifying it.
Definition: Image.cpp:171
virtual void Remove(Base &animation)
Removes the given animation.
Definition: Animation.cpp:78
bool ispaused
Paused state.
Definition: Animation.h:264
static void SaveThis(Writer &writer, const Graphics::BitmapAnimationProvider &anim, GID::Type type=GID::Animation, std::function< void(Writer &writer)> extra={})
Saves the given animation as a resource.
Definition: Animation.cpp:100
virtual unsigned int GetProgress() const override
Returns the current progress of the timer.
Definition: ControlledTimer.h:40
unsigned length
Length of the animations controlled by this controller.
Definition: Animation.h:279
constexpr Type Image
Image resource.
Definition: GID.h:149
Marker WriteObjectStart(const Base &base)
Writes the start of an object. Should have a matching WriteEnd with the returned marker.
Definition: File.cpp:211
void SetProgress(float value)
Sets the progress of this controlled timer.
Definition: ControlledTimer.h:73
virtual void Progress(unsigned timepassed) override final
Progresses this controller by the given time.
Definition: Animation.cpp:118
unsigned long DeltaTime()
Returns the time passed since the last frame.
Definition: Time.h:258
Utils::Logger log
Definition: Animation.cpp:11
virtual void Delete(Base &animation)
Deletes the given animation.
Definition: Animation.cpp:90
This class is a timer that has its progression strictly controlled.
Definition: ControlledTimer.h:19
Root namespace for Gorgon Game Engine.
Definition: Any.h:19
virtual void Progress(unsigned timepassed) override final
Progresses this timer by moving the timer timepassed milliseconds forwards.
Definition: Animation.cpp:98
Marker WriteChunkStart(GID::Type type)
Writes the start of a chunk. Should have a matching WriteEnd.
Definition: Writer.h:351
This is the base class for all animations.
Definition: Animation.h:306
float speed
Current speed.
Definition: Animation.h:270
#define LOG
Definition: Animation.cpp:14
#define ASSERT(expression, message,...)
Replaces regular assert to allow messages and backtrace.
Definition: Assert.h:161
Eases logging procedure by appending necessary information to the given data and streams to a standar...
Definition: Logging.h:19
virtual void Pause()
Pauses the controller, until a Resume or Reset is issued.
Definition: Animation.cpp:212
int curind
Definition: ControlledTimer.h:84
float progress
Definition: ControlledTimer.h:83
This class governs the progress of animations.
Definition: Animation.h:26
unsigned progress
Amount of time passed since the start of the animation.
Definition: Animation.h:160
constexpr Type Animation
Definition: GID.h:187
This class is the base for all Gorgon Resources.
Definition: Base.h:20
bool collectable
Whether this controller should be collected by the garbage collector when its task is finished.
Definition: Animation.h:115
unsigned int GetProgress(int ind) const
Returns the progress of the given animation.
Definition: ControlledTimer.h:56
virtual void Animate() const
Animates the animations within this governor.
Definition: Animation.cpp:35
static bool LoadResourceWith(Animation &anim, std::weak_ptr< File > file, std::shared_ptr< Reader > reader, unsigned long size, std::function< Base *(std::weak_ptr< File > file, std::shared_ptr< Reader > reader, GID::Type, unsigned long)> loadfn)
This function allows loading animation with a function to load unknown resources.
Definition: Animation.cpp:8
Graphics::BitmapAnimationProvider & MoveOutProvider() override
Definition: Animation.cpp:150
virtual void Reset() override
Resets the controller to start from the beginning.
Definition: Animation.cpp:204
This class allows resource objects to save their data to a stream.
Definition: Writer.h:59
virtual ~Base()
Virtual destructor.
Definition: Animation.cpp:216
const Containers::Collection< Base >::ConstIterator cbegin() const
Beginning of children.
Definition: Base.h:110
constexpr Type Animation_Durations
Definition: GID.h:189
virtual void Play()
Starts this controller to run once.
Definition: Animation.cpp:172
virtual void Add(Base &animation)
This function attaches the given animation to this controller.
Definition: Animation.cpp:73
void WriteEnd(Marker &marker)
This function performs writes necessary to end a chunk that is represented by the marker.
Definition: Writer.h:373
ControllerBase()
Default constructor.
Definition: Animation.cpp:44
Gorgon::Animation::basic_Storage< RectangularAnimationProvider > RectangularAnimationStorage
Definition: Animations.h:374
void WriteInt32(long value)
Writes a 32-bit integer to the stream.
Definition: Writer.h:149
static Governor & Active()
Returns the current governor.
Definition: Animation.h:52
virtual void SetController(ControllerBase &controller)
Sets the controller to the given controller.
Definition: Animation.h:334
virtual void Reset() override
Resets the animation to the start.
Definition: ControlledTimer.h:36
Type to store GID information.
Definition: GID.h:23
void savedata(Writer &writer) const
Definition: Animation.cpp:79
Containers::Collection< Base > children
Child objects that this resource object have.
Definition: Base.h:162
virtual void SetGovernor(Governor &governor)
Changes the governor of this controller.
Definition: Animation.cpp:63
virtual void SetProgress(unsigned progress)
Sets the current progress of the controller.
Definition: Animation.h:184
Graphics::BitmapAnimationProvider MoveOutAsBitmap()
Moves the animation out of the resource system. Use Prepare and Discard before moving out to avoid co...
Definition: Animation.cpp:124
Containers::Collection< Base > animations
List of animations this controller holds.
Definition: Animation.h:120
ControllerBase * controller
Controller of this animation.
Definition: Animation.h:388
int GetCount() const override
Returns number of frames.
Definition: TextureAnimation.h:209
unsigned duration
Definition: TextureAnimation.h:446
std::vector< basic_AnimationFrame< T_ > > frames
Definition: TextureAnimation.h:445
float GetProgressRate() const
Returns the progress of this controlled timer.
Definition: ControlledTimer.h:78
const Containers::Collection< Base >::ConstIterator cend() const
End of children.
Definition: Base.h:115
This resource contains images.
Definition: Image.h:23
void Add(T_ &image, unsigned duration=42, bool own=false)
Adds the given image to the end of the animation.
Definition: TextureAnimation.h:281
virtual Graphics::RectangularAnimationStorage animmoveout() override
Definition: Animation.cpp:154
bool isfinished
Whether the controller is finished.
Definition: Animation.h:273
This class represents an animation resource.
Definition: Animation.h:19