 |
Gorgon Game Engine
|
Go to the documentation of this file.
196 A_ &tl, A_ &tm, A_ &tr,
197 A_ &ml, A_ &mm, A_ &mr,
198 A_ &bl, A_ &bm, A_ &br
200 tl(&tl), tm(&tm), tr(&tr),
201 ml(&ml), mm(&mm), mr(&mr),
202 bl(&bl), bm(&bm), br(&br)
208 A_ &&tl, A_ &&tm, A_ &&tr,
209 A_ &&ml, A_ &&mm, A_ &&mr,
210 A_ &&bl, A_ &&bm, A_ &&br
212 tl(new A_(std::move(tl))), tm(new A_(std::move(tm))), tr(new A_(std::move(tr))),
213 ml(new A_(std::move(ml))), mm(new A_(std::move(mm))), mr(new A_(std::move(mr))),
214 bl(new A_(std::move(bl))), bm(new A_(std::move(bm))), br(new A_(std::move(br))),
223 tl(&border), tm(&border), tr(&border),
224 ml(&border), mm(nullptr), mr(&border),
225 bl(&border), bm(&border), br(&border)
234 tl(new A_(std::move(border))), tm(tl), tr(tl),
235 ml(tl), mm(nullptr), mr(tl),
236 bl(tl), bm(tl), br(tl),
243 A_ &border, A_ ¢er
245 tl(&border), tm(&border), tr(&border),
246 ml(&border), mm(¢er), mr(&border),
247 bl(&border), bm(&border), br(&border)
254 A_ &&border, A_ &¢er
256 tl(new A_(std::move(border))), tm(tl), tr(tl),
257 ml(tl), mm(new A_(std::move(center))), mr(tl),
258 bl(tl), bm(tl), br(tl),
264 A_ *tl, A_ *tm, A_ *tr,
265 A_ *ml, A_ *mm, A_ *mr,
266 A_ *bl, A_ *bm, A_ *br
268 tl(tl), tm(tm), tr(tr),
269 ml(ml), mm(mm), mr(mr),
270 bl(bl), bm(bm), br(br)
275 tl(other.tl), tm(other.tm), tr(other.tr),
276 ml(other.ml), mm(other.mm), mr(other.mr),
277 bl(other.bl), bm(other.bm), br(other.br),
301 std::set<A_*> ptrs = {tl, tm, tr, ml, mm, mr, bl, bm, br};
303 for(
auto ptr : ptrs) {
315 auto ret =
new typename std::remove_reference<decltype(*
this)>::type(std::move(*
this));
330 return tl->CreateAnimation(
false);
338 return tm->CreateAnimation(
false);
346 return tr->CreateAnimation(
false);
354 return ml->CreateAnimation(
false);
362 return mm->CreateAnimation(
false);
370 return mr->CreateAnimation(
false);
378 return bl->CreateAnimation(
false);
386 return bm->CreateAnimation(
false);
394 return br->CreateAnimation(
false);
546 int maxt = std::max(std::max(
547 tl ? tl->GetHeight() : 0 ,
548 tm ? tm->GetHeight() : 0),
549 tr ? tr->GetHeight() : 0);
551 int maxb = std::max(std::max(
552 bl ? bl->GetHeight() : 0 ,
553 bm ? bm->GetHeight() : 0),
554 br ? br->GetHeight() : 0);
556 int maxl = std::max(std::max(
557 tl ? tl->GetWidth() : 0 ,
558 ml ? ml->GetWidth() : 0),
559 bl ? bl->GetWidth() : 0);
561 int maxr = std::max(std::max(
562 tr ? tr->GetWidth() : 0 ,
563 mr ? mr->GetWidth() : 0),
564 br ? br->GetWidth() : 0);
566 return{maxl+maxr+(mm ? mm->GetWidth() : 0), maxt+maxb+(mm ? mm->GetHeight() : 0)};
basic_RectangleProvider & operator=(const basic_RectangleProvider &)=delete
virtual int GetDuration() const =0
Returns the duration of the animation if it is a known apriori.
virtual RectangularAnimation & CreateMM() const override
Creates an animation without controller. This function should always return an animation.
Definition: Rectangle.h:360
This class represents boundaries of 2D objects.
Definition: Bounds.h:27
virtual void drawin(TextureTarget &target, const Geometry::Rectanglef &r, RGBAf color) const override
This function should draw the object to the target area.
Definition: Rectangle.cpp:63
basic_RectangleProvider(basic_RectangleProvider &&other)
Move constructor.
Definition: Rectangle.h:274
void SetBM(A_ *value)
Changes the BM animation, ownership semantics will not change.
Definition: Rectangle.h:500
void Prepare()
Prepares all animation providers if the they support Prepare function.
Definition: Rectangle.h:516
This class allows control over a sizable object.
Definition: Graphics.h:161
A_ * GetML() const
Returns ML provider, may return nullptr.
Definition: Rectangle.h:415
static EmptyImage & Instance()
Returns the instance for empty image. Only one instance is enough.
Definition: EmptyImage.h:50
void SetTR(A_ *value)
Changes the TR animation, ownership semantics will not change.
Definition: Rectangle.h:460
virtual RectangularAnimation & CreateML() const override
Creates an animation without controller. This function should always return an animation.
Definition: Rectangle.h:352
virtual auto MoveOutProvider() -> decltype(*this) override
This function moves this animation provider into a new provider.
Definition: Rectangle.h:314
virtual bool GetSideTiling() const
Returns if the middle part will be tiled.
Definition: Rectangle.h:65
basic_RectangleProvider(const basic_RectangleProvider &)=delete
A_ * GetMM() const
Returns MM provider, may return nullptr.
Definition: Rectangle.h:420
basic_RectangleProvider(A_ *tl, A_ *tm, A_ *tr, A_ *ml, A_ *mm, A_ *mr, A_ *bl, A_ *bm, A_ *br)
Filling constructor, nullptr is acceptable.
Definition: Rectangle.h:263
A_ * GetBR() const
Returns BR provider, may return nullptr.
Definition: Rectangle.h:440
void SetBL(A_ *value)
Changes the BL animation, ownership semantics will not change.
Definition: Rectangle.h:492
basic_Rectangle< int > Rectangle
Definition: Rectangle.h:449
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: Rectangle.cpp:119
virtual RectangularAnimation & CreateBL() const =0
Creates an animation without controller. This function should always return an animation.
Controllers are required to progress animations.
Definition: Animation.h:65
virtual bool GetCenterTiling() const
Returns if the middle part will be tiled.
Definition: Rectangle.h:53
virtual RectangularAnimation & CreateMR() const =0
Creates an animation without controller. This function should always return an animation.
BitmapRectangleProvider Slice(const Bitmap &source, Geometry::Bounds center)
Slices an image to create a rectangle.
Definition: Rectangle.h:610
Rectangle & CreateAnimation(bool create=true) const override
This function should create and animation and depending on the create parameter, it should create its...
Definition: Rectangle.h:324
virtual RectangularAnimation & CreateBM() const =0
Creates an animation without controller. This function should always return an animation.
basic_RectangleProvider(A_ &&border, A_ &¢er)
Filling constructor using move semantics, rectangle will create and own new objects.
Definition: Rectangle.h:253
Represents a four channel 32 bit float per channel color information.
Definition: Color.h:373
Interface for RectangleProviders.
Definition: Rectangle.h:12
void SetMM(A_ *value)
Changes the MM animation, ownership semantics will not change.
Definition: Rectangle.h:476
A_ * GetTM() const
Returns TM provider, may return nullptr.
Definition: Rectangle.h:405
int GetDuration() const override
Returns the duration of the animation if it is a known apriori.
Definition: Rectangle.h:101
void SetBR(A_ *value)
Changes the BR animation, ownership semantics will not change.
Definition: Rectangle.h:508
T_ Left
Left-most boundary.
Definition: Bounds.h:399
Geometry::Size GetSize() const override
Definition: Rectangle.h:545
void SetTM(A_ *value)
Changes the TM animation, ownership semantics will not change.
Definition: Rectangle.h:452
Root namespace for Gorgon Game Engine.
Definition: Any.h:19
This class represents a 2D geometric size.
Definition: Size.h:23
virtual bool Progress(unsigned &) override
This function should progress the animation.
Definition: Rectangle.h:97
BitmapRectangleProvider SliceHorizontal(const Bitmap &source, int t, int b, int tl, int tr, int l, int r, int bl, int br)
Horizontally slices the given image.
Definition: Rectangle.cpp:135
basic_RectangleProvider(A_ &tl, A_ &tm, A_ &tr, A_ &ml, A_ &mm, A_ &mr, A_ &bl, A_ &bm, A_ &br)
Filling constructor.
Definition: Rectangle.h:195
This is the base class for all animations.
Definition: Animation.h:306
virtual RectangularAnimation & CreateBR() const override
Creates an animation without controller. This function should always return an animation.
Definition: Rectangle.h:392
A_ * GetTL() const
Returns TL provider, may return nullptr.
Definition: Rectangle.h:400
virtual RectangularAnimation & CreateTM() const =0
Creates an animation without controller. This function should always return an animation.
Rectangular drawable animation.
Definition: Animations.h:19
virtual ~Rectangle()
Definition: Rectangle.h:85
This object contains an bitmap image.
Definition: Bitmap.h:25
virtual void SetSideTiling(bool value)
Sets whether the side parts (tm, ml, mr, bm) would be tiled.
Definition: Rectangle.h:60
virtual RectangularAnimation & CreateMM() const =0
Creates an animation without controller. This function should always return an animation.
virtual RectangularAnimation & CreateBR() const =0
Creates an animation without controller. This function should always return an animation.
basic_RectangleProvider()
Empty constructor, rectangle can be instanced even if it is completely empty.
Definition: Rectangle.h:190
void SetML(A_ *value)
Changes the ML animation, ownership semantics will not change.
Definition: Rectangle.h:468
This interface defines a class that can be used as a common target for texture based drawing.
Definition: TextureTargets.h:12
virtual RectangularAnimation & CreateTR() const override
Creates an animation without controller. This function should always return an animation.
Definition: Rectangle.h:344
basic_RectangleProvider(A_ &&border)
Filling constructor using move semantics, rectangle will create and own new object.
Definition: Rectangle.h:231
This class represents a 2D point.
Definition: Point.h:32
Rectangle & 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: Rectangle.h:320
void SetMR(A_ *value)
Changes the MR animation, ownership semantics will not change.
Definition: Rectangle.h:484
virtual void DeleteAnimation() const
Deletes this animation.
Definition: Animation.h:379
Rectangle(const IRectangleProvider &prov, Gorgon::Animation::ControllerBase &timer)
Definition: Rectangle.cpp:29
A_ * GetBL() const
Returns BL provider, may return nullptr.
Definition: Rectangle.h:430
const Geometry::Size GetSize() const
Returns the size of this object.
Definition: Drawables.h:443
void OwnProviders()
Issuing this function will make this rectangle to own its providers, destroying them along with itsel...
Definition: Rectangle.h:541
This class provides rectangular animations.
Definition: Animations.h:48
T_ Right
Right-most boundary.
Definition: Bounds.h:405
This class allows instancing of a rectangle like image that is made out of three parts.
Definition: Rectangle.h:185
@ Graphics
Definition: Template.h:164
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: Rectangle.h:144
basic_RectangleProvider(A_ &&tl, A_ &&tm, A_ &&tr, A_ &&ml, A_ &&mm, A_ &&mr, A_ &&bl, A_ &&bm, A_ &&br)
Filling constructor using move semantics, rectangle will create and own new objects.
Definition: Rectangle.h:207
T_ Bottom
Bottom-most boundary.
Definition: Bounds.h:408
virtual RectangularAnimation & CreateTR() const =0
Creates an animation without controller. This function should always return an animation.
basic_RectangleProvider(A_ &border)
Filling constructor.
Definition: Rectangle.h:220
virtual RectangularAnimation & CreateTL() const =0
Creates an animation without controller. This function should always return an animation.
int GetHeight() const
Returns the height of the drawable.
Definition: Drawables.h:451
A_ * GetTR() const
Returns TR provider, may return nullptr.
Definition: Rectangle.h:410
IRectangleProvider()
Definition: Rectangle.h:14
virtual RectangularAnimation & CreateBM() const override
Creates an animation without controller. This function should always return an animation.
Definition: Rectangle.h:384
int GetWidth() const
Returns the width of the drawable.
Definition: Drawables.h:448
virtual RectangularAnimation & CreateTM() const override
Creates an animation without controller. This function should always return an animation.
Definition: Rectangle.h:336
virtual RectangularAnimation & CreateTL() const override
Creates an animation without controller. This function should always return an animation.
Definition: Rectangle.h:328
void SetTL(A_ *value)
Changes the TL animation, ownership semantics will not change.
Definition: Rectangle.h:444
virtual RectangularAnimation & CreateMR() const override
Creates an animation without controller. This function should always return an animation.
Definition: Rectangle.h:368
virtual RectangularAnimation & CreateBL() const override
Creates an animation without controller. This function should always return an animation.
Definition: Rectangle.h:376
A_ * GetMR() const
Returns MR provider, may return nullptr.
Definition: Rectangle.h:425
A_ * GetBM() const
Returns BM provider, may return nullptr.
Definition: Rectangle.h:435
Represents a rectangle in a 2D space.
Definition: Rectangle.h:19
ControllerBase * controller
Controller of this animation.
Definition: Animation.h:388
basic_RectangleProvider(A_ &border, A_ ¢er)
Filling constructor.
Definition: Rectangle.h:242
~basic_RectangleProvider()
Definition: Rectangle.h:298
This class allows drawing a rectangle like image that is made out of nine parts.
Definition: Rectangle.h:79
BitmapRectangleProvider SliceVertical(const Bitmap &source, int l, int r, int tl, int bl, int t, int b, int tr, int br)
Vertically slices the given image.
Definition: Rectangle.cpp:149
virtual IRectangleProvider & MoveOutProvider() override=0
This function moves this animation provider into a new provider.
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: Rectangle.h:148
virtual void SetCenterTiling(bool value)
Sets whether the middle part would be tiled.
Definition: Rectangle.h:48
virtual Geometry::Size getsize() const override
Should return the exact size of this object.
Definition: Rectangle.cpp:53
virtual RectangularAnimation & CreateML() const =0
Creates an animation without controller. This function should always return an animation.
T_ Top
Top-most boundary.
Definition: Bounds.h:402