 |
Gorgon Game Engine
|
Go to the documentation of this file.
3 #pragma warning(disable:4250)
6 #include "../Animation.h"
7 #include "../Animation/Discrete.h"
8 #include "../Animation/Instance.h"
9 #include "../Animation/Storage.h"
101 bool Progress(
unsigned &)
override {
return true; }
122 virtual auto MoveOutProvider() -> decltype(*
this)
override {
123 auto ret =
new typename std::remove_reference<decltype(*
this)>::type(std::move(*
this));
140 if(me.HasAnimation())
141 return me->GetSize();
146 int GetWidth()
const {
return GetSize().Width; }
147 int GetHeight()
const {
return GetSize().Height; }
156 auto ret =
new typename std::remove_reference<decltype(*
this)>::type(std::move(*
this));
173 if(me.HasAnimation())
174 return me->GetSize();
182 if(me.HasAnimation())
188 if(me.HasAnimation())
189 me->Insert(frame, before);
192 virtual void MoveBefore(
unsigned index,
int before)
override {
194 if(me.HasAnimation())
195 me->MoveBefore(index, before);
198 virtual void Remove(
unsigned index)
override {
200 if(me.HasAnimation())
206 if(me.HasAnimation())
207 return me->FrameAt(index);
209 throw std::runtime_error(
"Animation storage is empty");
212 virtual unsigned StartOf(
unsigned frame)
const override {
214 if(me.HasAnimation())
215 return me->StartOf(frame);
222 if(me.HasAnimation())
223 return me->GetDuration();
230 if(me.HasAnimation())
231 return me->GetDuration(frame);
238 if(me.HasAnimation())
244 if(me.HasAnimation())
245 return me->GetCount();
254 virtual bool Progress(
unsigned &leftover)
override {
256 if(me.HasAnimation())
264 if(me.HasAnimation())
272 if(me.HasAnimation())
278 if(me.HasAnimation())
286 if(!HasController()) {
287 throw std::runtime_error(
"Animation does not have a controller");
296 if(me.HasAnimation())
304 if(me.HasAnimation())
305 me->Draw(target, p, color);
314 if(me.HasAnimation())
315 me->Draw(target, p1, p2, p3, p4, tex1, tex2, tex3, tex4, color);
322 if(me.HasAnimation())
323 me->Draw(target, p1, p2, p3, p4);
328 if(me.HasAnimation())
329 me->DrawStretched(target, r, color);
334 if(me.HasAnimation())
335 me->DrawIn(target, r, color);
340 if(me.HasAnimation())
341 me->DrawIn(target, controller, r, color);
346 if(me.HasAnimation())
347 return me->CalculateSize(area);
354 if(me.HasAnimation())
355 return me->CalculateSize(controller, s);
362 if(me.HasAnimation())
363 return me->GetSize();
virtual int GetDuration() const =0
Returns the duration of the animation if it is a known apriori.
virtual Graphics::DiscreteAnimation & CreateAnimation(Gorgon::Animation::ControllerBase &timer) const override
This function should create a new animation with the given controller and if owner parameter is set t...
Definition: Animations.h:161
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 void drawin(Graphics::TextureTarget &target, const Geometry::Rectanglef &r, Graphics::RGBAf color) const override
This function should draw the object to the target area.
Definition: Animations.h:332
This class allows control over a sizable object.
Definition: Graphics.h:161
virtual Graphics::DiscreteAnimation & CreateAnimation(bool create=true) const override
This function should create and animation and depending on the create parameter, it should create its...
Definition: Animations.h:166
virtual ControllerBase & GetController() const override
Returns the controller of this animation.
Definition: Animations.h:284
virtual unsigned GetDuration(unsigned frame) const override
Returns the duration of the given frame.
Definition: Animations.h:228
This class allows storing an animation instance regarless of its underlying type as a value.
Definition: Instance.h:20
virtual auto MoveOutProvider() -> decltype(*this) override
This function moves this animation provider into a new provider.
Definition: Animations.h:155
virtual Geometry::Size GetSize() const override
Definition: Animations.h:171
virtual void Insert(const Frame &frame, int before) override
Adds a frame to the specified point the animation.
Definition: Animations.h:186
virtual Geometry::Size calculatesize(const Geometry::Size &area) const override
This function should return the size of the object when it is requested to be drawn in the given area...
Definition: Animations.h:344
A regular drawable animation provider.
Definition: Animations.h:28
virtual Animation & CreateAnimation(bool create=true) const override=0
This function should create and animation and depending on the create parameter, it should create its...
Controllers are required to progress animations.
Definition: Animation.h:65
virtual unsigned StartOf(unsigned frame) const override
Returns the starting time of the given frame.
Definition: Animations.h:212
virtual void Add(const Frame &frame) override
Adds a frame to the end of the animation.
Definition: Animations.h:180
T_ Height
Height of this size object.
Definition: Size.h:261
virtual int GetCount() const override
Returns number of frames.
Definition: Animations.h:242
virtual void RemoveController() override
Removes the controller of this animation.
Definition: Animations.h:294
Represents a four channel 32 bit float per channel color information.
Definition: Color.h:373
virtual RectangularAnimation & CreateAnimation(bool create=true) const override=0
This function should create and animation and depending on the create parameter, it should create its...
virtual void draw(Graphics::TextureTarget &target, const Geometry::Pointf &p1, const Geometry::Pointf &p2, const Geometry::Pointf &p3, const Geometry::Pointf &p4, const Geometry::Pointf &tex1, const Geometry::Pointf &tex2, const Geometry::Pointf &tex3, const Geometry::Pointf &tex4, Graphics::RGBAf color) const override
This method should draw to object inside the given quad with the given texture coordinates.
Definition: Animations.h:308
int GetWidth() const
Definition: Animations.h:66
virtual const Frame & FrameAt(int index) const override
Returns the frame at specific point.
Definition: Animations.h:204
bool Progress(unsigned &) override
When used as animation, an image is always persistent and it never finishes.
Definition: Animations.h:101
int GetHeight() const
Definition: Animations.h:67
This class provides discrete and rectangular animation which is suitable for bitmap and texture anima...
Definition: Animations.h:71
ImageProvider & CreateAnimation(Gorgon::Animation::ControllerBase &) const override
This function should create a new animation with the given controller and if owner parameter is set t...
Definition: Animations.h:88
void Remove()
Removes the animation stored in the container, if the container owns the animation,...
Definition: Storage.h:103
Root namespace for Gorgon Game Engine.
Definition: Any.h:19
This class represents a 2D geometric size.
Definition: Size.h:23
virtual void SetController(ControllerBase &controller) override
Sets the controller to the given controller.
Definition: Animations.h:270
virtual Animation & CreateAnimation(Gorgon::Animation::ControllerBase &timer) const override=0
This function should create a new animation with the given controller and if owner parameter is set t...
This interface marks a class as animation provider.
Definition: Animation.h:283
virtual bool Progress(unsigned &leftover) override
This function should progress the animation.
Definition: Animations.h:254
virtual AnimationProvider & MoveOutProvider() override=0
This function moves this animation provider into a new provider.
virtual RectangularAnimationProvider & MoveOutProvider() override=0
This function moves this animation provider into a new provider.
This is the base class for all animations.
Definition: Animation.h:306
This is an interface for solid texture based image.
Definition: Drawables.h:511
Rectangular drawable animation.
Definition: Animations.h:19
virtual void draw(Graphics::TextureTarget &target, const Geometry::Pointf &p1, const Geometry::Pointf &p2, const Geometry::Pointf &p3, const Geometry::Pointf &p4, Graphics::RGBAf color) const override
This function should draw the object inside the given quad.
Definition: Animations.h:318
ImageProvider & CreateAnimation(bool=false) const override
This function should create and animation and depending on the create parameter, it should create its...
Definition: Animations.h:90
virtual void draw(Graphics::TextureTarget &target, const Geometry::Pointf &p, Graphics::RGBAf color) const override
This function should draw the object to the given point.
Definition: Animations.h:302
virtual unsigned GetDuration() const override
Returns the duration of the animation.
Definition: Animations.h:220
Provides a discreet animation that is made out of frames.
Definition: Discrete.h:45
constexpr Type Animation
Definition: GID.h:187
virtual void Clear() override
Clears all frames from this animation.
Definition: Animations.h:236
Specializing this class allows code injection to animation storages.
Definition: Storage.h:13
This interface defines a class that can be used as a common target for texture based drawing.
Definition: TextureTargets.h:12
This class represents a 2D point.
Definition: Point.h:32
virtual RectangularAnimation & CreateAnimation(Gorgon::Animation::ControllerBase &timer) const override=0
This function should create a new animation with the given controller and if owner parameter is set t...
virtual DiscreteAnimation & CreateAnimation(Gorgon::Animation::ControllerBase &timer) const override=0
This function should create a new animation with the given controller and if owner parameter is set t...
virtual void drawin(Graphics::TextureTarget &target, const Graphics::SizeController &controller, const Geometry::Rectanglef &r, Graphics::RGBAf color) const override
This function should draw this drawable inside the given rectangle according to the given controller.
Definition: Animations.h:338
virtual DiscreteAnimation & CreateAnimation(bool create=true) const override=0
This function should create and animation and depending on the create parameter, it should create its...
virtual ~AnimationProvider()
Definition: Animations.h:30
A regular drawable animation.
Definition: Animations.h:14
const Geometry::Size GetSize() const
Returns the size of this object.
Definition: Drawables.h:443
virtual void Remove(unsigned index) override
Removes the given frame.
Definition: Animations.h:198
This class provides rectangular animations.
Definition: Animations.h:48
virtual bool HasController() const
Returns whether this animation has a controller.
Definition: Animation.h:344
virtual void MoveBefore(unsigned index, int before) override
Moves the frame with the given index to the specified point the animation.
Definition: Animations.h:192
virtual A_::AnimationType & CreateAnimation(ControllerBase &timer) const override
This function creates a new animation from the stored animation provider.
Definition: Storage.h:129
virtual Geometry::Size GetSize() const =0
@ Graphics
Definition: Template.h:164
Definition: Drawables.h:74
virtual bool HasController() const override
Returns whether this animation has a controller.
Definition: Animations.h:276
virtual void RemoveController()
Removes the controller of this animation.
Definition: Animation.h:357
virtual void DeleteAnimation() const override
if used as animation, this object will not be deleted
Definition: Animations.h:93
int GetHeight() const
Returns the height of the drawable.
Definition: Drawables.h:451
A discrete rectangular animation, this is most suitable for bitmap or texture animations.
Definition: Animations.h:24
T_ Width
Width of this size object.
Definition: Size.h:258
Represents a drawable object, that can be drawn to the given point.
Definition: Drawables.h:17
virtual bool Progress(unsigned &leftover)=0
This function should progress the animation.
virtual void SetController(ControllerBase &controller)
Sets the controller to the given controller.
Definition: Animation.h:334
int GetDuration() const override
Returns the duration of the animation if it is a known apriori.
Definition: Animations.h:103
int GetWidth() const
Returns the width of the drawable.
Definition: Drawables.h:448
virtual void drawstretched(Graphics::TextureTarget &target, const Geometry::Rectanglef &r, Graphics::RGBAf color) const override
This function should draw the object to the target area.
Definition: Animations.h:326
int GetDuration() const override
Returns the duration of the animation if it is a known apriori.
Definition: Animations.h:262
virtual Geometry::Size calculatesize(const Graphics::SizeController &controller, const Geometry::Size &s) const override
This function should return the size of the object when it is requested to be drawn in the given area...
Definition: Animations.h:352
Represents a rectangle in a 2D space.
Definition: Rectangle.h:19
virtual Geometry::Size getsize() const override
Should return the exact size of this object.
Definition: Animations.h:360
Definition: Animations.h:85
virtual ControllerBase & GetController() const
Returns the controller of this animation.
Definition: Animation.h:347
This is the base class for a single frame in a discreet animation.
Definition: Discrete.h:20
Specializing this class allows code injection to animation instances.
Definition: Instance.h:11