Switching SceneItems to smarts
This commit is contained in:
38
archive/animation/Animation.hpp
Normal file
38
archive/animation/Animation.hpp
Normal file
@ -0,0 +1,38 @@
|
||||
// Copyright (c) 2022 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#pragma once
|
||||
#include "state/StateEvent.hpp"
|
||||
|
||||
namespace Dawn {
|
||||
struct Animation {
|
||||
public:
|
||||
bool_t loop = false;
|
||||
bool_t finished = false;
|
||||
float_t time = 0;
|
||||
float_t duration = 0;
|
||||
StateEvent<> eventAnimationEnd;
|
||||
|
||||
/**
|
||||
* Ticks the animation along. Delta is whatever you want to update the
|
||||
* animation by (in seconds). Animations can overshoot if necessary and
|
||||
* will not be clamped (by default). Subclasses may interpret ticks in
|
||||
* different ways.
|
||||
*
|
||||
* @param delta Time delta (in seconds) to tick the animaiton by.
|
||||
*/
|
||||
virtual void tick(const float_t delta) = 0;
|
||||
|
||||
/**
|
||||
* Restart a running animation.
|
||||
*/
|
||||
virtual void restart();
|
||||
|
||||
/**
|
||||
* Clears an animaton of all its animation items and keyframes.
|
||||
*/
|
||||
virtual void clear();
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user