 |
Gorgon Game Engine
|
Go to the documentation of this file.
118 base(&base), mask(&mask)
123 base(base), mask(mask)
127 base(new A_(std::move(base))), mask(new A_(std::move(mask))), own(true)
131 base(other.base), mask(other.mask)
133 other.base =
nullptr;
134 other.mask =
nullptr;
146 auto ret =
new typename std::remove_reference<decltype(*
this)>::type(std::move(*
this));
162 return base->CreateAnimation(
false);
172 return mask->CreateAnimation(
false);
223 if(base) base->Prepare();
224 if(mask) mask->Prepare();
241 base(parent.CreateBase()), mask(parent.CreateMask())
252 base(parent.CreateBase()), mask(parent.CreateMask())
268 mask.DrawIn(target, r);
273 base.DrawIn(target, r, color);
285 mask.DrawIn(target, controller, r);
290 base.DrawIn(target, controller, r, color);
308 mask.Draw(target, p1, p2, p3, p4, tex1, tex2, tex3, tex4);
313 base.Draw(target, p1, p2, p3, p4, tex1, tex2, tex3, tex4, color);
326 mask.Draw(target, p1, p2, p3, p4);
331 base.Draw(target, p1, p2, p3, p4, color);
338 return base.GetSize();
virtual void drawin(TextureTarget &target, const Geometry::Rectanglef &r, RGBAf color) const override
This function should draw the object to the target area.
Definition: MaskedObject.h:261
virtual int GetDuration() const =0
Returns the duration of the animation if it is a known apriori.
basic_Point< T_ > TopLeft() const
Returns the top left coordinates of the rectangle.
Definition: Rectangle.h:198
Orientation
2D orientation constants
Definition: Graphics.h:39
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
Base(ControllerBase &controller)
Sets the controller for this animation to the given controller.
Definition: Animation.h:310
void SetMask(A_ *value)
Sets the mask provider, ownership semantics will not be changed.
Definition: MaskedObject.h:198
This class allows control over a sizable object.
Definition: Graphics.h:161
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: Line.cpp:65
static EmptyImage & Instance()
Returns the instance for empty image. Only one instance is enough.
Definition: EmptyImage.h:50
basic_TextureAnimationProvider< Bitmap, basic_TextureAnimation, basic_AnimationFrame< Bitmap > > BitmapAnimationProvider
Definition: TextureAnimation.h:520
constexpr Type Null
Null resource.
Definition: GID.h:105
A_ * GetBase() const
Returns the base component. Could return nullptr.
Definition: MaskedObject.h:180
T_ Right() const
Calculates and returns the rightmost coordinate.
Definition: Rectangle.h:143
int GetDuration() const override
Returns the duration of the animation if it is a known apriori.
Definition: MaskedObject.h:69
basic_MaskedObject< A_ > & CreateAnimation(bool create=true) const override
Definition: MaskedObject.h:151
virtual RectangularAnimation & CreateMask() const =0
void SaveAnimation(Writer &writer, const Graphics::RectangularAnimationProvider &object)
Saves a given generic rectangular animation as resource.
Definition: Resource.cpp:22
basic_LineProvider< RectangularAnimationProvider > LineProvider
Definition: Line.h:362
Controllers are required to progress animations.
Definition: Animation.h:65
T_ X
X coordinate of the top left corner of this rectangle.
Definition: Rectangle.h:354
void WriteChunkHeader(GID::Type type, unsigned long size)
Writes the header of a chunk.
Definition: Writer.h:364
basic_MaskedObject(RectangularAnimation &base, RectangularAnimation &mask, Gorgon::Animation::ControllerBase &timer)
Creates a masked object from two animations, these animations should not have controllers attached to...
Definition: MaskedObject.h:47
static void SaveThis(Writer &writer, const Graphics::ILineProvider &provider)
Definition: Line.cpp:175
This is a line resource, it stores a Graphics::LineProvider.
Definition: Line.h:16
virtual bool Progress(unsigned &) override
This function should progress the animation.
Definition: MaskedObject.h:65
void OwnProviders()
Assumes the ownership of the providers.
Definition: MaskedObject.h:216
virtual RectangularAnimation & CreateBase() const =0
float Float
Represents floating point data type.
Definition: Types.h:16
constexpr Type Line
Definition: GID.h:234
basic_MaskedObjectProvider(A_ &base, A_ &mask)
Filling constructor.
Definition: MaskedObject.h:117
Represents a four channel 32 bit float per channel color information.
Definition: Color.h:373
constexpr Type Image
Image resource.
Definition: GID.h:149
Marker WriteObjectStart(const Base &base)
Writes the start of an object. Should have a matching WriteEnd with the returned marker.
Definition: File.cpp:211
T_ Width
Width of the rectangle.
Definition: Rectangle.h:360
basic_MaskedObjectProvider(basic_MaskedObjectProvider &&other)
Definition: MaskedObject.h:130
virtual Geometry::Size getsize() const override
Should return the exact size of this object.
Definition: Line.h:105
void ASSERT_FALSE(const std::string &message, int skip=1, int depth=4)
Definition: Assert.h:192
void SetEnd(A_ *value)
Changes the end animation, ownership semantics will not change.
Definition: Line.h:274
@ Stretch
The drawing is stretched along this axis to cover the given size.
Definition: Graphics.h:171
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: MaskedObject.h:82
void save(Writer &writer) const override
Definition: Line.cpp:156
Root namespace for Gorgon Game Engine.
Definition: Any.h:19
This class represents a 2D geometric size.
Definition: Size.h:23
@ UseMask
Definition: TextureTargets.h:18
ILineProvider & MoveOutProvider() override
This function moves this animation provider into a new provider.
Definition: Line.cpp:236
Marker WriteChunkStart(GID::Type type)
Writes the start of a chunk. Should have a matching WriteEnd.
Definition: Writer.h:351
virtual auto MoveOutProvider() -> decltype(*this) override
Definition: MaskedObject.h:145
basic_MaskedObject(RectangularAnimation &base, RectangularAnimation &mask, bool create=true)
Creates a masked object from two animations, these animations should not have controllers attached to...
Definition: MaskedObject.h:31
~basic_MaskedObject()
Definition: MaskedObject.h:60
Line()
Creates a new empty line.
Definition: Line.h:43
Rectangular drawable animation.
Definition: Animations.h:19
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
Collection is a container for reference typed objects.
Definition: Collection.h:21
constexpr Type Line_Props_II
Definition: GID.h:236
T_ Bottom() const
Calculates and returns the bottommost coordinate.
Definition: Rectangle.h:146
Interface for LineProviders.
Definition: Line.h:12
This object contains an bitmap image.
Definition: Bitmap.h:25
RectangularAnimation & CreateMask() const override
Creates a mask animation without controller.
Definition: MaskedObject.h:170
This class allows instancing of a line like image that is made out of three parts.
Definition: Line.h:162
constexpr Type Animation
Definition: GID.h:187
constexpr Type Line_Props
Definition: GID.h:235
This object creates a masked object from two graphics object.
Definition: MaskedObject.h:109
RectangularAnimation & CreateBase() const override
Creates a base animation without controller.
Definition: MaskedObject.h:160
void SetProviders(A_ &base, A_ &mask)
Sets the providers in this object.
Definition: MaskedObject.h:206
basic_MaskedObject(const basic_MaskedObjectProvider< A_ > &parent, bool create=true)
Definition: MaskedObject.h:239
Tiling Horizontal
Horizontal tiling mode.
Definition: Graphics.h:470
virtual bool GetTiling() const
Returns if the middle part will be tiled.
Definition: Line.h:47
basic_Size< Float > Sizef
Definition: Size.h:388
typename A_::AnimationType AnimationType
Definition: MaskedObject.h:111
Line(const ILineProvider &prov, Gorgon::Animation::ControllerBase &timer)
Definition: Line.cpp:17
This interface defines a class that can be used as a common target for texture based drawing.
Definition: TextureTargets.h:12
long GetCount() const
Returns number of elements.
Definition: Collection.h:236
void Prepare()
Prepares the providers.
Definition: MaskedObject.h:222
basic_MaskedObjectProvider()=default
Empty constructor.
This class represents a 2D point.
Definition: Point.h:32
A_ * GetEnd() const
Returns the end animation, might return nullptr.
Definition: Line.h:253
virtual void drawin(TextureTarget &target, const Geometry::Rectanglef &r, RGBAf color) const override
This function should draw the object to the target area.
Definition: Line.cpp:29
static Line * LoadResource(std::weak_ptr< File > file, std::shared_ptr< Reader > reader, unsigned long size)
This function loads a line resource from the file.
Definition: Line.cpp:44
This class allows resource objects to save their data to a stream.
Definition: Writer.h:59
Geometry::Size GetSize() const override
Definition: MaskedObject.h:227
~basic_MaskedObjectProvider()
Definition: MaskedObject.h:137
virtual void DeleteAnimation() const
Deletes this animation.
Definition: Animation.h:379
basic_LineProvider< BitmapAnimationProvider > AnimatedBitmapLineProvider
Definition: Line.h:364
virtual IMaskedObjectProvider & MoveOutProvider() override=0
This function moves this animation provider into a new provider.
A_ * GetMask() const
Returns the mask component. Could return nullptr.
Definition: MaskedObject.h:185
basic_MaskedObject< A_ > & CreateAnimation(Gorgon::Animation::ControllerBase &timer) const override
Definition: MaskedObject.h:155
void SetMiddle(A_ *value)
Changes the middle animation, ownership semantics will not change.
Definition: Line.h:266
A_ * GetStart() const
Returns the start animation, might return nullptr.
Definition: Line.h:243
A regular drawable animation.
Definition: Animations.h:14
void WriteEnd(Marker &marker)
This function performs writes necessary to end a chunk that is represented by the marker.
Definition: Writer.h:373
T_ Y
Y coordinate of the top left corner of this rectangle.
Definition: Rectangle.h:357
basic_MaskedObjectProvider(A_ &&base, A_ &&mask)
Definition: MaskedObject.h:126
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
virtual void RemoveController()
Removes the controller of this animation.
Definition: Animation.h:357
T_ Height
Height of the rectangle.
Definition: Rectangle.h:363
virtual Orientation GetOrientation() const
Returns the orientation of the line provider.
Definition: Line.h:35
Gorgon::Animation::basic_Storage< RectangularAnimationProvider > RectangularAnimationStorage
Definition: Animations.h:374
int GetHeight() const
Returns the height of the drawable.
Definition: Drawables.h:451
For ease of use in resource system.
Definition: MaskedObject.h:10
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: MaskedObject.h:78
virtual void draw(TextureTarget &target, const Geometry::Pointf &p, RGBAf color) const override
This function should draw the object to the given point.
Definition: Drawables.h:456
std::vector< T_ >::const_iterator end(enum_type_id< T_ >)
Definition: Enum.h:288
void WriteBool(bool value)
Writes a boolean value. In resource 1.0, booleans are stored as 32bit integers.
Definition: Writer.h:220
virtual void SetController(ControllerBase &controller)
Sets the controller to the given controller.
Definition: Animation.h:334
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: MaskedObject.h:297
int GetWidth() const
Returns the width of the drawable.
Definition: Drawables.h:448
Containers::Collection< Base > children
Child objects that this resource object have.
Definition: Base.h:162
virtual void NewMask()=0
Should queue the start of a new mask. Only one mask buffer exists and it will be cleared and reused.
virtual DrawMode GetDrawMode() const =0
Returns current draw mode.
void WriteEnum32(E_ value)
Writes an enumeration as 32-bit integer to the stream.
Definition: Writer.h:140
void SetBase(A_ *value)
Sets the base provider, ownership semantics will not be changed.
Definition: MaskedObject.h:190
virtual Graphics::RectangularAnimationStorage animmoveout() override
Definition: Line.cpp:232
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_MaskedObjectProvider(A_ *base, A_ *mask)
Filling constructor, nullptr is allowed but not recommended.
Definition: MaskedObject.h:122
ILineProvider(Orientation orientation)
Definition: Line.h:14
virtual Geometry::Size getsize() const override
Should return the exact size of this object.
Definition: MaskedObject.h:337
Definition: MaskedObject.h:22
virtual void SetDrawMode(DrawMode mode)=0
Sets current draw mode.
Tiling Vertical
Vertical tiling mode.
Definition: Graphics.h:473
void NotImplemented(const std::string &what="This feature")
Definition: Assert.h:187
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
virtual ControllerBase & GetController() const
Returns the controller of this animation.
Definition: Animation.h:347
@ ToMask
Definition: TextureTargets.h:17
void SetStart(A_ *value)
Changes the start animation, ownership semantics will not change.
Definition: Line.h:258
A_ * GetMiddle() const
Returns the middle animation, might return nullptr.
Definition: Line.h:248