 |
Gorgon Game Engine
|
Go to the documentation of this file.
125 top(&top), bottom(&bottom), offset(offset) {}
129 top(top), bottom(bottom), offset(offset) {}
133 top(&top), bottom(&bottom), offset(offset) { own =
true; }
137 top(top), bottom(bottom), offset(offset) { own =
true; }
140 top(
new A_(std::move(top))), bottom(
new A_(std::move(bottom))), offset(offset), own(
true)
144 top(other.top), bottom(other.bottom), offset(other.offset)
147 other.bottom =
nullptr;
148 other.offset = {0, 0};
166 bottom = other.bottom;
167 offset = other.offset;
171 other.bottom =
nullptr;
172 other.offset ={0, 0};
181 auto ret =
new typename std::remove_reference<decltype(*
this)>::type(std::move(*
this));
197 return top->CreateAnimation(
false);
207 return bottom->CreateAnimation(
false);
257 this->bottom = ⊥
268 if(top) top->Prepare();
269 if(bottom) bottom->Prepare();
278 A_ *bottom =
nullptr;
287 top(parent.CreateTop()), bottom(parent.CreateBottom()),
288 offset(parent.GetOffset())
299 top(parent.CreateTop()), bottom(parent.CreateBottom()),
300 offset(parent.GetOffset())
310 bottom.DrawIn(target, r, color);
311 top.DrawIn(target, r+offset, color);
316 bottom.DrawIn(target, controller, r, color);
317 top.DrawIn(target, controller, r+offset, color);
328 auto f =
Geometry::Sizef((
float)bottom.GetSize().Width/top.GetSize().Width, (
float)bottom.GetSize().Height/top.GetSize().Height);
329 auto bp2 = p1 + (p2-p1) * f;
330 auto bp3 = p1 + (p3-p1) * f;
331 auto bp4 = p1 + (p4-p1) * f;
333 bottom.Draw(target, p1, bp2, bp3, bp4, tex1, tex2, tex3, tex4, color);
334 top.Draw(target, p1+offset, p2+offset, p3+offset, p4+offset, tex1, tex2, tex3, tex4, color);
342 auto f =
Geometry::Sizef((
float)bottom.GetSize().Width/top.GetSize().Width, (
float)bottom.GetSize().Height/top.GetSize().Height);
343 auto bp2 = p1 + (p2-p1) * f;
344 auto bp3 = p1 + (p3-p1) * f;
345 auto bp4 = p1 + (p4-p1) * f;
346 bottom.Draw(target, p1, bp2, bp3, bp4, color);
347 top.Draw(target, p1+offset, p2+offset, p3+offset, p4+offset, color);
353 return top.GetSize();
void SetOffset(const Geometry::Point &value) override
Sets the offset of the top image.
Definition: StackedObject.h:246
virtual int GetDuration() const =0
Returns the duration of the animation if it is a known apriori.
Base(ControllerBase &controller)
Sets the controller for this animation to the given controller.
Definition: Animation.h:310
This class allows control over a sizable object.
Definition: Graphics.h:161
basic_StackedObjectProvider(A_ *bottom, A_ *top, const Geometry::Point &offset={0, 0})
Filling constructor, nullptr is allowed but not recommended.
Definition: StackedObject.h:128
basic_StackedObjectProvider & operator=(basic_StackedObjectProvider &&other)
Definition: StackedObject.h:159
static EmptyImage & Instance()
Returns the instance for empty image. Only one instance is enough.
Definition: EmptyImage.h:50
This object creates an object that has two subobjects drawn on top of each other.
Definition: StackedObject.h:116
basic_StackedObject(const basic_StackedObjectProvider< A_ > &parent, bool create=true)
Definition: StackedObject.h:285
basic_StackedObjectProvider(const AssumeOwnershipTag &, A_ &bottom, A_ &top, const Geometry::Point &offset={0, 0})
Filling constructor.
Definition: StackedObject.h:132
void SetTop(A_ *value)
Sets the top provider, ownership semantics will not be changed.
Definition: StackedObject.h:225
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: StackedObject.h:86
Controllers are required to progress animations.
Definition: Animation.h:65
basic_StackedObject< A_ > & CreateAnimation(bool create=true) const override
Definition: StackedObject.h:186
virtual void drawin(TextureTarget &target, const Geometry::Rectanglef &r, RGBAf color) const override
This function should draw the object to the target area.
Definition: StackedObject.h:309
typename A_::AnimationType AnimationType
Definition: StackedObject.h:118
void SetBottom(A_ *value)
Sets the bottom provider, ownership semantics will not be changed.
Definition: StackedObject.h:233
virtual void SetOffset(const Geometry::Point &)=0
Definition: StackedObject.h:25
~basic_StackedObject()
Definition: StackedObject.h:63
basic_StackedObject(RectangularAnimation &top, RectangularAnimation &bottom, const Geometry::Point &offset, Gorgon::Animation::ControllerBase &timer)
Creates a bottomed object from two animations, these animations should not have controllers attached ...
Definition: StackedObject.h:50
Represents a four channel 32 bit float per channel color information.
Definition: Color.h:373
virtual auto MoveOutProvider() -> decltype(*this) override
Definition: StackedObject.h:180
int GetDuration() const override
Returns the duration of the animation if it is a known apriori.
Definition: StackedObject.h:72
RectangularAnimation & CreateTop() const override
Creates a top animation without controller.
Definition: StackedObject.h:195
virtual RectangularAnimation & CreateTop() const =0
A_ * GetTop() const
Returns the top component. Could return nullptr.
Definition: StackedObject.h:215
basic_Bounds< T_ > Union(const basic_Bounds< T_ > &l, const basic_Bounds< T_ > &r)
Returns the smallest bounds that contains given bounds.
Definition: Bounds.h:488
A_ * GetBottom() const
Returns the bottom component. Could return nullptr.
Definition: StackedObject.h:220
Root namespace for Gorgon Game Engine.
Definition: Any.h:19
This class represents a 2D geometric size.
Definition: Size.h:23
basic_StackedObjectProvider(A_ &&bottom, A_ &&top, const Geometry::Point &offset={0, 0})
Definition: StackedObject.h:139
virtual RectangularAnimation & CreateBottom() const =0
Rectangular drawable animation.
Definition: Animations.h:19
Geometry::Size GetSize() const override
Definition: StackedObject.h:272
basic_StackedObjectProvider(basic_StackedObjectProvider &&other)
Definition: StackedObject.h:143
~basic_StackedObjectProvider()
Definition: StackedObject.h:152
basic_StackedObjectProvider(const AssumeOwnershipTag &, A_ *bottom, A_ *top, const Geometry::Point &offset={0, 0})
Filling constructor, nullptr is allowed but not recommended.
Definition: StackedObject.h:136
For ease of use in resource system.
Definition: StackedObject.h:10
void SetProviders(A_ &top, A_ &bottom)
Sets the providers in this object.
Definition: StackedObject.h:251
basic_Size< Float > Sizef
Definition: Size.h:388
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 IStackedObjectProvider & MoveOutProvider() override=0
This function moves this animation provider into a new provider.
virtual void DeleteAnimation() const
Deletes this animation.
Definition: Animation.h:379
RectangularAnimation & CreateBottom() const override
Creates a bottom animation without controller.
Definition: StackedObject.h:205
A regular drawable animation.
Definition: Animations.h:14
This class provides rectangular animations.
Definition: Animations.h:48
virtual bool HasController() const
Returns whether this animation has a controller.
Definition: Animation.h:344
@ Graphics
Definition: Template.h:164
Geometry::Point GetOffset() const override
Returns the offset of the top image.
Definition: StackedObject.h:241
virtual void RemoveController()
Removes the controller of this animation.
Definition: Animation.h:357
virtual Geometry::Size getsize() const override
Should return the exact size of this object.
Definition: StackedObject.h:352
void Prepare()
Prepares the providers.
Definition: StackedObject.h:267
void OwnProviders()
Assumes the ownership of the providers.
Definition: StackedObject.h:261
virtual void SetController(ControllerBase &controller)
Sets the controller to the given controller.
Definition: Animation.h:334
basic_StackedObject< A_ > & CreateAnimation(Gorgon::Animation::ControllerBase &timer) const override
Definition: StackedObject.h:190
basic_StackedObjectProvider(A_ &bottom, A_ &top, const Geometry::Point &offset={0, 0})
Filling constructor.
Definition: StackedObject.h:124
const Geometry::Size CalculateSize(const Geometry::Size &area) const
Calculates the adjusted size of this drawable depending on the given area.
Definition: Drawables.h:322
Represents a rectangle in a 2D space.
Definition: Rectangle.h:19
ControllerBase * controller
Controller of this animation.
Definition: Animation.h:388
basic_StackedObjectProvider()=default
Empty constructor.
virtual Geometry::Point GetOffset() const =0
Where acceptable, denotes that the object will assume the ownership.
Definition: Types.h:136
basic_StackedObject(RectangularAnimation &top, RectangularAnimation &bottom, const Geometry::Point &offset, bool create=true)
Creates a stacked object from two animations, these animations should not have controllers attached t...
Definition: StackedObject.h:34
virtual bool Progress(unsigned &) override
This function should progress the animation.
Definition: StackedObject.h:68
virtual ControllerBase & GetController() const
Returns the controller of this animation.
Definition: Animation.h:347
virtual Geometry::Size calculatesize(const 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: StackedObject.h:90
virtual void draw(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, RGBAf color) const override
This method should draw to object inside the given quad with the given texture coordinates.
Definition: StackedObject.h:323