#include <Shape2D.h>
Description
An aspect that can express basic 2D objects, such as images and shapes.
Functions | |
void | OnDraw () |
std::string | GetInfo () |
![]() | |
std::vector< Renderer::Vertex2D > | GetVertices () const |
Renderer::Polygon | GetPolygon () const |
![]() | |
std::string | GetTag () |
Entity * | GetHost () const |
template<typename T > | |
T * | GetHostAs () const |
Entity::ID | GetHostID () const |
bool | EmitEvent (const std::string &eventName, Entity::ID source=Entity::ID(), const std::vector< std::string > &args={}) |
bool | CanHandleEvent (const std::string &eventName) |
void | InstallHook (const std::string &eventName, EventHandler, void *data=nullptr) |
void | UninstallHook (const std::string &eventName, EventHandler) |
void | InstallHandler (const std::string &eventName, EventHandler, void *data=nullptr) |
void | UninstallHandler (const std::string &eventName, EventHandler) |
std::vector< std::string > | GetKnownEvents () const |
Formation | |
Forming aspects denotes what visual the aspect should assume. | |
Color | color |
void | FormRectangle (float width, float height) |
void | FormImage (AssetID image, float forcedWidth=-1.f, float forcedHeight=-1.f) |
void | FormImageFrame (AssetID image, int frame, float forcedWidth=-1.f, float forcedHeight=-1.f) |
void | FormCircle (float radius, int numIterations) |
void | FormTriangles (std::vector< Dynacoe::Vector > &pts) |
void | FormLines (const std::vector< Dynacoe::Vector > &pts) |
Additional Inherited Members | |
![]() | |
enum | RenderMode { Normal, Translucent, None } |
![]() | |
using | EventHandler = bool(*)(void *, Component *component, Entity::ID self, Entity::ID source, const std::vector< std::string > &args) |
![]() | |
RenderMode | mode |
bool | absolute |
![]() | |
virtual void | OnStep () |
virtual void | OnAttach () |
void | InstallEvent (const std::string &eventName, EventHandler mainHandler=nullptr, void *data=nullptr) |
void | UninstallEvent (const std::string &) |
Member Function Documentation
void FormRectangle | ( | float | width, |
float | height | ||
) |
Forms the aspect into a rectangle.
The top-left corner of the rectangle is the position of the Aspect from GetPosition(). Width and height are expressed in pixels.
- Parameters
-
width The width of the rectangle in pixels. height The height of the rectangle in pixels.
void FormImage | ( | AssetID | image, |
float | forcedWidth = -1.f , |
||
float | forcedHeight = -1.f |
||
) |
Forms the aspect into the shape and visual of an image.
The scale is a ratio of the source image dimensions. If the Image has multiple frames, the image is drawn as an animation.
- Parameters
-
image The image to display as the aspect. If image does not refer to a valid Image, no action is taken. If the Image has multiple frames, the subsequent frame is drawn upon next Graphics::Draw of the aspect.
void FormImageFrame | ( | AssetID | image, |
int | frame, | ||
float | forcedWidth = -1.f , |
||
float | forcedHeight = -1.f |
||
) |
Forms the aspect into a frame of an image.
Behaves like FormImage, but a specific frame index is specified to draw rather than the image as an animation.
- Parameters
-
image The image to form as the aspect. If image does not refer to a valid Image, no action is taken frame The frame of the image to use, starting at 0. If the frame is negative, the aspect is drawn as if FormImage() had been called.
void FormCircle | ( | float | radius, |
int | numIterations | ||
) |
Forms the aspect into an estimated circle made of triangles.
- Parameters
-
radius The radius of the circle. Measured in pixels. numIterations Number of sides that the circle should have. The more iterations, the smoother the circle will become, but the more resource-intensive the Aspect becomes as well.
void FormTriangles | ( | std::vector< Dynacoe::Vector > & | pts | ) |
Forms the aspect into a collection of triangle primitives.
The points are interpreted as pixels and are expected to be in groups of 3. If a non-multiple-of-three number of points is given, the remainder points are ignored.
- Parameters
-
pts The points of the triangles.
void FormLines | ( | const std::vector< Dynacoe::Vector > & | pts | ) |
Forms a collection of line segments.
Every two points form a line segment. If an odd number of points are given, the last point is ignored.
- Parameters
-
pts The points of the lines.
|
virtual |
|
virtual |
Returns a string containing human-readable information on the state of the component.
Reimplemented from Component.
The documentation for this class was generated from the following file:
- /home/jc/git/Dynacoe/DynacoeSrc/includes/Dynacoe/Components/Shape2D.h