Gorgon Game Engine
ScalableObject.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "../Graphics.h"
4 #include "EmptyImage.h"
5 #include "Animations.h"
6 #include "TextureAnimation.h"
7 
8 namespace Gorgon { namespace Graphics {
9 
12  public:
13  virtual RectangularAnimation &CreateBase() const = 0;
14 
15  virtual SizeController GetController() const = 0;
16 
17  virtual void SetController(const SizeController &value) = 0;
18 
19  virtual IScalableObjectProvider &MoveOutProvider() override = 0;
20  };
21 
22  template<class A_>
24 
25  template<class A_>
26  class basic_ScalableObject : public virtual RectangularAnimation {
27  public:
28  basic_ScalableObject(const basic_ScalableObjectProvider<A_> &parent, bool create = true);
29 
31 
35  basic_ScalableObject(RectangularAnimation &base, const SizeController &ctrl, bool create = true) :
36  Gorgon::Animation::Base(create), base(base), ctrl(ctrl)
37  {
38  if(this->HasController()) {
39  base.SetController(this->GetController());
40  }
41  else {
42  base.RemoveController();
43  }
44  }
45 
50  Gorgon::Animation::Base(timer), base(base), ctrl(ctrl)
51  {
52  if(this->HasController()) {
53  base.SetController(this->GetController());
54  }
55  else {
56  base.RemoveController();
57  }
58  }
59 
61  base.DeleteAnimation();
62  }
63 
66  ctrl = value;
67  }
68 
71  return ctrl;
72  }
73 
74  virtual bool Progress(unsigned &) override {
75  return true; //individual parts will work automatically
76  }
77 
78  int GetDuration() const override {
79  return base.GetDuration();
80  }
81 
82  protected:
83  virtual void drawin(TextureTarget &target, const Geometry::Rectanglef &r, RGBAf color) const override;
84 
85  virtual void drawin(TextureTarget &target, const SizeController &controller, const Geometry::Rectanglef &r, RGBAf color) const override;
86 
87  virtual Geometry::Size calculatesize(const Geometry::Size &area) const override {
88  return base.CalculateSize(area);
89  }
90 
91  virtual Geometry::Size calculatesize(const SizeController &controller, const Geometry::Size &s) const override {
92  return base.CalculateSize(controller, s);
93  }
94 
95  virtual void draw(TextureTarget &target, const Geometry::Pointf &p1, const Geometry::Pointf &p2,
96  const Geometry::Pointf &p3, const Geometry::Pointf &p4,
97  const Geometry::Pointf &tex1, const Geometry::Pointf &tex2,
98  const Geometry::Pointf &tex3, const Geometry::Pointf &tex4, RGBAf color) const override;
99 
100 
101  virtual void draw(TextureTarget &target, const Geometry::Pointf &p1, const Geometry::Pointf &p2,
102  const Geometry::Pointf &p3, const Geometry::Pointf &p4, RGBAf color) const override;
103 
104 
105 
106 
107  virtual Geometry::Size getsize() const override;
108 
109  private:
110  RectangularAnimation &base;
111  SizeController ctrl;
112  };
113 
121  template<class A_>
123  public:
124  using AnimationType = typename A_::AnimationType;
125 
128 
130  explicit basic_ScalableObjectProvider(A_ &base, const SizeController &controller = Tiling::Both) :
131  base(&base), ctrl(controller)
132  { }
133 
134  explicit basic_ScalableObjectProvider(A_ &&base, const SizeController &controller = Tiling::Both) :
135  base(new A_(std::move(base))), ctrl(controller), own(true)
136  { }
137 
139  base(other.base), ctrl(other.ctrl)
140  {
141  other.base = nullptr;
142  }
143 
145  if(own) {
146  delete this->base;
147  }
148  }
149 
150  //types are derived not to type the same code for every class
151  virtual auto MoveOutProvider() -> decltype(*this) override {
152  auto ret = new typename std::remove_reference<decltype(*this)>::type(std::move(*this));
153 
154  return *ret;
155  }
156 
157  basic_ScalableObject<A_> &CreateAnimation(bool create = true) const override {
158  return *new basic_ScalableObject<A_>(*this, create);
159  }
160 
162  return *new basic_ScalableObject<A_>(*this, timer);
163  }
164 
166  RectangularAnimation &CreateBase() const override {
167  if(base) {
168  return base->CreateAnimation(false);
169  }
170  else {
171  return EmptyImage::Instance();
172  }
173  }
174 
176  A_ *GetBase() const {
177  return base;
178  }
179 
181  SizeController GetController() const override {
182  return ctrl;
183  }
184 
186  void SetController(const SizeController &value) override {
187  ctrl = value;
188  }
189 
191  void SetBase(A_ *value) {
192  if(own)
193  delete base;
194 
195  base = value;
196  }
197 
199  void OwnProvider() {
200  own = true;
201  }
202 
205  void Prepare() {
206  if(base) base->Prepare();
207  }
208 
209  Geometry::Size GetSize() const override {
210  return base ? base->GetSize() : Geometry::Size{0, 0};
211  }
212 
213  private:
214  A_ *base = nullptr;
215  SizeController ctrl = {Tiling::Both};
216 
217  bool own = false;
218  };
219 
220  template<class A_>
222  Gorgon::Animation::Base(create),
223  base(parent.CreateBase()), ctrl(parent.GetController())
224  {
225  if(this->HasController()) {
226  base.SetController(this->GetController());
227  }
228  }
229 
230  template<class A_>
232  Gorgon::Animation::Base(timer),
233  base(parent.CreateBase()), ctrl(parent.GetController())
234  {
235  if(this->HasController()) {
236  base.SetController(this->GetController());
237  }
238  }
239 
240  template<class A_>
242  base.DrawIn(target, ctrl, r, color);
243  }
244 
245  template<class A_>
246  void basic_ScalableObject<A_>::drawin(TextureTarget &target, const SizeController &controller, const Geometry::Rectanglef &r, RGBAf color) const {
247  base.DrawIn(target, controller, r, color);
248  }
249 
250 
251 
252  template<class A_>
254  const Geometry::Pointf &p3, const Geometry::Pointf &p4,
255  const Geometry::Pointf &tex1, const Geometry::Pointf &tex2,
256  const Geometry::Pointf &tex3, const Geometry::Pointf &tex4, RGBAf color) const
257  {
258  base.Draw(target, p1, p2, p3, p4, tex1, tex2, tex3, tex4, color);
259  }
260 
261 
262  template<class A_>
264  const Geometry::Pointf &p3, const Geometry::Pointf &p4, RGBAf color) const
265  {
266  base.Draw(target, p1, p2, p3, p4, color);
267  }
268 
269  template<class A_>
271  return base.GetSize();
272  }
273 
276 
279 
282 
283 } }
Gorgon::Graphics::basic_ScalableObjectProvider::CreateAnimation
basic_ScalableObject< A_ > & CreateAnimation(bool create=true) const override
Definition: ScalableObject.h:157
Gorgon::Animation::Base::GetDuration
virtual int GetDuration() const =0
Returns the duration of the animation if it is a known apriori.
Gorgon::Geometry::basic_Rectangle::TopLeft
basic_Point< T_ > TopLeft() const
Returns the top left coordinates of the rectangle.
Definition: Rectangle.h:198
Gorgon::Graphics::basic_ScalableObject::~basic_ScalableObject
~basic_ScalableObject()
Definition: ScalableObject.h:60
Gorgon::Graphics::Rectangle::drawin
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
Gorgon::Graphics::basic_RectangleProvider::SetBM
void SetBM(A_ *value)
Changes the BM animation, ownership semantics will not change.
Definition: Rectangle.h:500
Gorgon::Animation::basic_Storage
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
Gorgon::Animation::Base::Base
Base(ControllerBase &controller)
Sets the controller for this animation to the given controller.
Definition: Animation.h:310
Gorgon::Graphics::basic_ScalableObjectProvider::GetController
SizeController GetController() const override
Returns the size controller.
Definition: ScalableObject.h:181
Gorgon::Graphics::SizeController
This class allows control over a sizable object.
Definition: Graphics.h:161
Gorgon::Graphics::basic_RectangleProvider::GetML
A_ * GetML() const
Returns ML provider, may return nullptr.
Definition: Rectangle.h:415
Gorgon::Graphics::EmptyImage::Instance
static EmptyImage & Instance()
Returns the instance for empty image. Only one instance is enough.
Definition: EmptyImage.h:50
Gorgon::Graphics::basic_RectangleProvider::SetTR
void SetTR(A_ *value)
Changes the TR animation, ownership semantics will not change.
Definition: Rectangle.h:460
Gorgon::Graphics::IRectangleProvider::GetSideTiling
virtual bool GetSideTiling() const
Returns if the middle part will be tiled.
Definition: Rectangle.h:65
Gorgon::Graphics::Tiling::Horizontal
@ Horizontal
File.h
Gorgon::Graphics::basic_ScalableObjectProvider::GetBase
A_ * GetBase() const
Returns the base component. Could return nullptr.
Definition: ScalableObject.h:176
Gorgon::Graphics::basic_RectangleProvider::GetMM
A_ * GetMM() const
Returns MM provider, may return nullptr.
Definition: Rectangle.h:420
Gorgon::Graphics::BitmapAnimationProvider
basic_TextureAnimationProvider< Bitmap, basic_TextureAnimation, basic_AnimationFrame< Bitmap > > BitmapAnimationProvider
Definition: TextureAnimation.h:520
Gorgon::Resource::GID::Null
constexpr Type Null
Null resource.
Definition: GID.h:105
Gorgon::Graphics::basic_RectangleProvider::GetBR
A_ * GetBR() const
Returns BR provider, may return nullptr.
Definition: Rectangle.h:440
Gorgon::Graphics::basic_RectangleProvider::SetBL
void SetBL(A_ *value)
Changes the BL animation, ownership semantics will not change.
Definition: Rectangle.h:492
Gorgon::Geometry::basic_Rectangle::Right
T_ Right() const
Calculates and returns the rightmost coordinate.
Definition: Rectangle.h:143
Gorgon::Graphics::basic_ScalableObjectProvider::CreateAnimation
basic_ScalableObject< A_ > & CreateAnimation(Gorgon::Animation::ControllerBase &timer) const override
Definition: ScalableObject.h:161
Gorgon::Graphics::basic_ScalableObject::GetSizeController
SizeController GetSizeController() const
Returns the size controller used in this scalable object.
Definition: ScalableObject.h:70
Gorgon::Graphics::Rectangle::draw
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
Gorgon::Resource::SaveAnimation
void SaveAnimation(Writer &writer, const Graphics::RectangularAnimationProvider &object)
Saves a given generic rectangular animation as resource.
Definition: Resource.cpp:22
Gorgon::Animation::ControllerBase
Controllers are required to progress animations.
Definition: Animation.h:65
Gorgon::Graphics::IRectangleProvider::GetCenterTiling
virtual bool GetCenterTiling() const
Returns if the middle part will be tiled.
Definition: Rectangle.h:53
Reader.h
Gorgon::Geometry::basic_Rectangle::X
T_ X
X coordinate of the top left corner of this rectangle.
Definition: Rectangle.h:354
Gorgon::Resource::Writer::WriteChunkHeader
void WriteChunkHeader(GID::Type type, unsigned long size)
Writes the header of a chunk.
Definition: Writer.h:364
Gorgon::Graphics::basic_ScalableObjectProvider::MoveOutProvider
virtual auto MoveOutProvider() -> decltype(*this) override
Definition: ScalableObject.h:151
Gorgon::Resource::Rectangle::Rectangle
Rectangle()=default
Creates an empty rectangle.
Image.h
Gorgon::Float
float Float
Represents floating point data type.
Definition: Types.h:16
Gorgon::Graphics::RGBAf
Represents a four channel 32 bit float per channel color information.
Definition: Color.h:373
Gorgon::Graphics::basic_ScalableObject::GetDuration
int GetDuration() const override
Returns the duration of the animation if it is a known apriori.
Definition: ScalableObject.h:78
Gorgon::Resource::GID::Image
constexpr Type Image
Image resource.
Definition: GID.h:149
Gorgon::Resource::Writer::WriteObjectStart
Marker WriteObjectStart(const Base &base)
Writes the start of an object. Should have a matching WriteEnd with the returned marker.
Definition: File.cpp:211
Gorgon::Graphics::IRectangleProvider
Interface for RectangleProviders.
Definition: Rectangle.h:12
Gorgon::Graphics::basic_RectangleProvider::SetMM
void SetMM(A_ *value)
Changes the MM animation, ownership semantics will not change.
Definition: Rectangle.h:476
Gorgon::Geometry::basic_Rectangle::Width
T_ Width
Width of the rectangle.
Definition: Rectangle.h:360
Gorgon::Graphics::basic_RectangleProvider::GetTM
A_ * GetTM() const
Returns TM provider, may return nullptr.
Definition: Rectangle.h:405
EmptyImage.h
Gorgon::Graphics::IScalableObjectProvider
For ease of use in resource system.
Definition: ScalableObject.h:11
Gorgon::Graphics::basic_ScalableObjectProvider::Prepare
void Prepare()
Prepares the providers.
Definition: ScalableObject.h:205
Gorgon::Graphics::basic_ScalableObjectProvider::CreateBase
RectangularAnimation & CreateBase() const override
Creates a base animation without controller.
Definition: ScalableObject.h:166
Gorgon::Geometry::basic_Rectangle::GetSize
basic_Size< T_ > GetSize() const
Returns the size of the rectangle.
Definition: Rectangle.h:218
Gorgon::Utils::ASSERT_FALSE
void ASSERT_FALSE(const std::string &message, int skip=1, int depth=4)
Definition: Assert.h:192
Gorgon::Graphics::basic_RectangleProvider::SetBR
void SetBR(A_ *value)
Changes the BR animation, ownership semantics will not change.
Definition: Rectangle.h:508
Gorgon::Graphics::basic_ScalableObject::draw
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: ScalableObject.h:253
Gorgon::Graphics::basic_ScalableObject::basic_ScalableObject
basic_ScalableObject(const basic_ScalableObjectProvider< A_ > &parent, bool create=true)
Definition: ScalableObject.h:221
Gorgon::Resource::Rectangle::LoadResource
static Rectangle * LoadResource(std::weak_ptr< File > file, std::shared_ptr< Reader > reader, unsigned long size)
This function loads a rectangle resource from the file.
Definition: Rectangle.cpp:83
Gorgon::Graphics::SizeController::Stretch
@ Stretch
The drawing is stretched along this axis to cover the given size.
Definition: Graphics.h:171
Gorgon::Graphics::basic_ScalableObjectProvider::AnimationType
typename A_::AnimationType AnimationType
Definition: ScalableObject.h:124
Null.h
Gorgon::Graphics::basic_RectangleProvider::SetTM
void SetTM(A_ *value)
Changes the TM animation, ownership semantics will not change.
Definition: Rectangle.h:452
Gorgon::Graphics::basic_ScalableObject
Definition: ScalableObject.h:26
Gorgon::Graphics::Bitmap::Slice
Bitmap Slice(Geometry::Bounds bounds) const
Returns a new bitmap containing a slice of this bitmap.
Definition: Bitmap.h:746
Gorgon::Graphics::basic_ScalableObjectProvider
This object creates a scalable object from a graphic object.
Definition: ScalableObject.h:122
Gorgon
Root namespace for Gorgon Game Engine.
Definition: Any.h:19
Gorgon::Geometry::basic_Size
This class represents a 2D geometric size.
Definition: Size.h:23
Gorgon::Graphics::SliceHorizontal
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
Gorgon::Graphics::basic_ScalableObject::calculatesize
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: ScalableObject.h:91
Gorgon::Graphics::basic_ScalableObject::Progress
virtual bool Progress(unsigned &) override
This function should progress the animation.
Definition: ScalableObject.h:74
Gorgon::Resource::Writer::WriteChunkStart
Marker WriteChunkStart(GID::Type type)
Writes the start of a chunk. Should have a matching WriteEnd.
Definition: Writer.h:351
Gorgon::Resource::GID::Rectangle_Props_II
constexpr Type Rectangle_Props_II
Definition: GID.h:240
Gorgon::Graphics::basic_RectangleProvider::GetTL
A_ * GetTL() const
Returns TL provider, may return nullptr.
Definition: Rectangle.h:400
Gorgon::Graphics::RectangularAnimation
Rectangular drawable animation.
Definition: Animations.h:19
Gorgon::Graphics::Tiling::Vertical
@ Vertical
Gorgon::Graphics::basic_ScalableObjectProvider::SetBase
void SetBase(A_ *value)
Sets the base provider, ownership semantics will not be changed.
Definition: ScalableObject.h:191
Rectangle.h
Gorgon::Graphics::RectangularDrawable::DrawIn
void DrawIn(TextureTarget &target, Tiling tiling, int x, int y, int w, int h, RGBAf color=RGBAf(1.f)) const
Draws the object to the target using the given tiling information.
Definition: Drawables.h:157
Gorgon::Containers::Collection
Collection is a container for reference typed objects.
Definition: Collection.h:21
Gorgon::Geometry::basic_Rectangle::Bottom
T_ Bottom() const
Calculates and returns the bottommost coordinate.
Definition: Rectangle.h:146
Gorgon::Graphics::AnimatedBitmapRectangleProvider
basic_RectangleProvider< BitmapAnimationProvider > AnimatedBitmapRectangleProvider
Definition: Rectangle.h:591
Gorgon::Graphics::Bitmap
This object contains an bitmap image.
Definition: Bitmap.h:25
Gorgon::Graphics::basic_ScalableObjectProvider::basic_ScalableObjectProvider
basic_ScalableObjectProvider(basic_ScalableObjectProvider &&other)
Definition: ScalableObject.h:138
Gorgon::Resource::GID::Animation
constexpr Type Animation
Definition: GID.h:187
Gorgon::Graphics::basic_ScalableObjectProvider::SetController
void SetController(const SizeController &value) override
Sets the controller.
Definition: ScalableObject.h:186
Gorgon::Graphics::SizeController::Horizontal
Tiling Horizontal
Horizontal tiling mode.
Definition: Graphics.h:470
Gorgon::Graphics::basic_ScalableObjectProvider::OwnProvider
void OwnProvider()
Assumes the ownership of the providers.
Definition: ScalableObject.h:199
Gorgon::Graphics::basic_ScalableObjectProvider::~basic_ScalableObjectProvider
~basic_ScalableObjectProvider()
Definition: ScalableObject.h:144
Gorgon::Graphics::basic_RectangleProvider::SetML
void SetML(A_ *value)
Changes the ML animation, ownership semantics will not change.
Definition: Rectangle.h:468
Gorgon::Containers::Collection::First
Iterator First()
returns the iterator to the first item
Definition: Collection.h:608
Gorgon::Geometry::Sizef
basic_Size< Float > Sizef
Definition: Size.h:388
Gorgon::Graphics::basic_ScalableObject::calculatesize
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: ScalableObject.h:87
Gorgon::Graphics::Tiling::None
@ None
Gorgon::Graphics::TextureTarget
This interface defines a class that can be used as a common target for texture based drawing.
Definition: TextureTargets.h:12
Gorgon::Containers::Collection::GetCount
long GetCount() const
Returns number of elements.
Definition: Collection.h:236
Gorgon::Graphics::IScalableObjectProvider::SetController
virtual void SetController(const SizeController &value)=0
Gorgon::Geometry::basic_Point
This class represents a 2D point.
Definition: Point.h:32
Gorgon::Resource::Writer
This class allows resource objects to save their data to a stream.
Definition: Writer.h:59
Gorgon::Graphics::basic_RectangleProvider::SetMR
void SetMR(A_ *value)
Changes the MR animation, ownership semantics will not change.
Definition: Rectangle.h:484
Gorgon::Animation::Base::DeleteAnimation
virtual void DeleteAnimation() const
Deletes this animation.
Definition: Animation.h:379
Gorgon::Resource::Rectangle::MoveOutProvider
Graphics::IRectangleProvider & MoveOutProvider() override
This function moves this animation provider into a new provider.
Definition: Rectangle.cpp:324
Gorgon::Graphics::Rectangle::Rectangle
Rectangle(const IRectangleProvider &prov, Gorgon::Animation::ControllerBase &timer)
Definition: Rectangle.cpp:29
Gorgon::Graphics::RectangleProvider
basic_RectangleProvider< RectangularAnimationProvider > RectangleProvider
Definition: Rectangle.h:588
Gorgon::Resource::Rectangle
Definition: Rectangle.h:11
Gorgon::Graphics::basic_ScalableObject::basic_ScalableObject
basic_ScalableObject(RectangularAnimation &base, const SizeController &ctrl, Gorgon::Animation::ControllerBase &timer)
Creates a scalable object from two animations, these animations should not have controllers attached ...
Definition: ScalableObject.h:49
Gorgon::Graphics::basic_RectangleProvider::GetBL
A_ * GetBL() const
Returns BL provider, may return nullptr.
Definition: Rectangle.h:430
Gorgon::Graphics::Animation
A regular drawable animation.
Definition: Animations.h:14
Gorgon::Resource::Writer::WriteEnd
void WriteEnd(Marker &marker)
This function performs writes necessary to end a chunk that is represented by the marker.
Definition: Writer.h:373
Gorgon::Graphics::RectangularDrawable::GetSize
const Geometry::Size GetSize() const
Returns the size of this object.
Definition: Drawables.h:443
Gorgon::Geometry::basic_Rectangle::Y
T_ Y
Y coordinate of the top left corner of this rectangle.
Definition: Rectangle.h:357
Gorgon::Resource::Rectangle::animmoveout
virtual Graphics::RectangularAnimationStorage animmoveout() override
Definition: Rectangle.cpp:320
Animations.h
Gorgon::Graphics::RectangularAnimationProvider
This class provides rectangular animations.
Definition: Animations.h:48
Gorgon::Animation::Base::HasController
virtual bool HasController() const
Returns whether this animation has a controller.
Definition: Animation.h:344
Gorgon::Graphics::basic_ScalableObject::getsize
virtual Geometry::Size getsize() const override
Should return the exact size of this object.
Definition: ScalableObject.h:270
Gorgon::Graphics::basic_RectangleProvider
This class allows instancing of a rectangle like image that is made out of three parts.
Definition: Rectangle.h:185
Gorgon::Graphics::IScalableObjectProvider::MoveOutProvider
virtual IScalableObjectProvider & MoveOutProvider() override=0
This function moves this animation provider into a new provider.
Gorgon::UI::Graphics
@ Graphics
Definition: Template.h:164
Gorgon::Resource::GID::Rectangle
constexpr Type Rectangle
Definition: GID.h:238
Gorgon::Animation::Base::RemoveController
virtual void RemoveController()
Removes the controller of this animation.
Definition: Animation.h:357
Gorgon::Geometry::basic_Rectangle::Height
T_ Height
Height of the rectangle.
Definition: Rectangle.h:363
Gorgon::Graphics::RectangularAnimationStorage
Gorgon::Animation::basic_Storage< RectangularAnimationProvider > RectangularAnimationStorage
Definition: Animations.h:374
Gorgon::Graphics::basic_ScalableObjectProvider::basic_ScalableObjectProvider
basic_ScalableObjectProvider(A_ &base, const SizeController &controller=Tiling::Both)
Filling constructor.
Definition: ScalableObject.h:130
Gorgon::Graphics::BitmapRectangleProvider
basic_RectangleProvider< Bitmap > BitmapRectangleProvider
Definition: Rectangle.h:590
Gorgon::Graphics::basic_ScalableObjectProvider::GetSize
Geometry::Size GetSize() const override
Definition: ScalableObject.h:209
Gorgon::Graphics::basic_ScalableObjectProvider::basic_ScalableObjectProvider
basic_ScalableObjectProvider()=default
Empty constructor.
Gorgon::Graphics::RectangularDrawable::GetHeight
int GetHeight() const
Returns the height of the drawable.
Definition: Drawables.h:451
Gorgon::Resource::GID::Rectangle_Props
constexpr Type Rectangle_Props
Definition: GID.h:239
Gorgon::Graphics::basic_RectangleProvider::GetTR
A_ * GetTR() const
Returns TR provider, may return nullptr.
Definition: Rectangle.h:410
Gorgon::Resource::Writer::WriteBool
void WriteBool(bool value)
Writes a boolean value. In resource 1.0, booleans are stored as 32bit integers.
Definition: Writer.h:220
Gorgon::Graphics::basic_ScalableObjectProvider::basic_ScalableObjectProvider
basic_ScalableObjectProvider(A_ &&base, const SizeController &controller=Tiling::Both)
Definition: ScalableObject.h:134
Gorgon::Graphics::IRectangleProvider::IRectangleProvider
IRectangleProvider()
Definition: Rectangle.h:14
Gorgon::Animation::Base::SetController
virtual void SetController(ControllerBase &controller)
Sets the controller to the given controller.
Definition: Animation.h:334
Gorgon::Graphics::RectangularDrawable::GetWidth
int GetWidth() const
Returns the width of the drawable.
Definition: Drawables.h:448
Gorgon::Resource::Base::children
Containers::Collection< Base > children
Child objects that this resource object have.
Definition: Base.h:162
Gorgon::Resource::Rectangle::SaveThis
static void SaveThis(Writer &writer, const Graphics::IRectangleProvider &provider)
Definition: Rectangle.cpp:250
Gorgon::Graphics::basic_RectangleProvider::SetTL
void SetTL(A_ *value)
Changes the TL animation, ownership semantics will not change.
Definition: Rectangle.h:444
Gorgon::Graphics::basic_ScalableObject::drawin
virtual void drawin(TextureTarget &target, const Geometry::Rectanglef &r, RGBAf color) const override
This function should draw the object to the target area.
Definition: ScalableObject.h:241
Gorgon::Graphics::basic_RectangleProvider::GetMR
A_ * GetMR() const
Returns MR provider, may return nullptr.
Definition: Rectangle.h:425
Gorgon::Graphics::RectangularDrawable::CalculateSize
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
Gorgon::Graphics::SizeController::CalculateArea
Geometry::Rectangle CalculateArea(const Geometry::Size &objectsize, const Geometry::Size &area) const
Calculates the drawing area of the object according to the tiling and placement rules.
Definition: Graphics.h:330
Gorgon::Graphics::basic_RectangleProvider::GetBM
A_ * GetBM() const
Returns BM provider, may return nullptr.
Definition: Rectangle.h:435
Gorgon::Geometry::basic_Rectangle
Represents a rectangle in a 2D space.
Definition: Rectangle.h:19
Gorgon::Animation::Base::controller
ControllerBase * controller
Controller of this animation.
Definition: Animation.h:388
Gorgon::Graphics::basic_ScalableObject::basic_ScalableObject
basic_ScalableObject(RectangularAnimation &base, const SizeController &ctrl, bool create=true)
Creates a scalable object from two animations, these animations should not have controllers attached ...
Definition: ScalableObject.h:35
TextureAnimation.h
Gorgon::Graphics::basic_ScalableObject::SetSizeController
void SetSizeController(SizeController value)
Changes the size controller used in this scalable object.
Definition: ScalableObject.h:65
Gorgon::Graphics::SliceVertical
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
Gorgon::Graphics::IScalableObjectProvider::CreateBase
virtual RectangularAnimation & CreateBase() const =0
Gorgon::Graphics::SizeController::Vertical
Tiling Vertical
Vertical tiling mode.
Definition: Graphics.h:473
Gorgon::Utils::NotImplemented
void NotImplemented(const std::string &what="This feature")
Definition: Assert.h:187
Gorgon::Resource::Rectangle::save
void save(Writer &writer) const override
Definition: Rectangle.cpp:231
Animation.h
Gorgon::Graphics::Rectangle::getsize
virtual Geometry::Size getsize() const override
Should return the exact size of this object.
Definition: Rectangle.cpp:53
Gorgon::Graphics::RectangularDrawable::Draw
void Draw(TextureTarget &target, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, RGBAf color=RGBAf(1.f)) const
Draw the object to the target by specifying coordinates for four corners.
Definition: Drawables.h:132
Gorgon::Animation::Base::GetController
virtual ControllerBase & GetController() const
Returns the controller of this animation.
Definition: Animation.h:347
Gorgon::Graphics::IScalableObjectProvider::GetController
virtual SizeController GetController() const =0