Clutter Engine 0.0.1
|
Component for rendering a sprite using a texture. More...
#include <SpriteComponent.h>
Public Member Functions | |
SpriteComponent (Texture *pTexture, int DrawOrder=0) | |
Constructs a SpriteComponent with the given texture and draw order. | |
SpriteComponent ()=delete | |
SpriteComponent (const SpriteComponent &)=delete | |
SpriteComponent & | operator= (const SpriteComponent &)=delete |
virtual | ~SpriteComponent () |
Destructor. Removes this component from the renderer if it has an owner. | |
virtual void | SetOwner (Actor *pOwner) override |
Sets the owner actor for this component. | |
virtual void | SetTexture (Texture *pTexture) |
Sets the texture for this sprite. | |
virtual void | SetTexture (const std::string &pTexture) |
Sets the texture for this sprite by name or path. | |
void | SetFlipX (bool pFlip) |
Sets whether the sprite is flipped horizontally. | |
void | SetFlipY (bool pFlipY) |
Sets whether the sprite is flipped vertically. | |
bool | GetFlipX () const |
Gets whether the sprite is flipped horizontally. | |
bool | GetFlipY () const |
Gets whether the sprite is flipped vertically. | |
int | GetTexWidth () const |
Gets the width of the texture. | |
int | GetTexHeight () const |
Gets the height of the texture. | |
Texture * | GetTexture () const |
Gets the texture used by this sprite. | |
![]() | |
Component (int pUpdateOrder=0) | |
Constructor for Component. | |
virtual | ~Component ()=default |
Virtual destructor for Component. | |
virtual void | Start () |
Called when the component is started. | |
virtual void | Update () |
Called every frame to update the component. | |
virtual void | Destroy () |
Called to destroy the component. | |
void | SetActive (bool pActive) |
Enables or disables the component. | |
void | OnDestroy () |
Called when the component is destroyed. | |
bool | IsActive () const |
Checks if the component is enabled. | |
int | GetUpdateOrder () const |
Gets the update order of the component. | |
void | SetRelativeLocation (const Vector3 &loc) |
Sets the relative location of the component. | |
void | SetRelativeLocation (const Vector2 &loc) |
Sets the relative location of the component. | |
void | SetWorldLocation (const Vector3 &loc) |
Sets the world location of the component. | |
void | SetRelativeScale (const Vector3 &scale) |
Sets the relative scale of the component. | |
void | SetRelativeScale (const Vector2 &scale) |
Sets the relative scale of the component. | |
void | SetRelativeRotation (Quaternion rot) |
Sets the relative rotation of the component. | |
void | SetRelativeRotation (Vector3 rot) |
Sets the relative rotation of the component. | |
void | SetWorldRotation (const Quaternion &rot) |
Sets the world rotation of the component. | |
void | SetWorldRotation (const Vector3 &rot) |
Sets the world rotation of the component. | |
void | AddRelativeRotation (Vector3 rot) |
Adds a rotation to the current relative rotation. | |
void | SetRelativeRotation (float rot) |
Sets the relative rotation of the component. | |
void | SetRelativeTransform (Transform &transform) |
Sets the relative transform of the component. | |
Vector3 | GetRelativeLocation () const |
Gets the relative location of the component. | |
Vector3 | GetRelativeScale () const |
Gets the relative scale of the component. | |
Quaternion | GetRelativeRotation () const |
Gets the relative rotation of the component. | |
Vector3 | GetRelativeRotationEuler () const |
Gets the relative rotation of the component as Euler angles. | |
Transform | GetRelativeTransform () const |
Gets the relative transform of the component. | |
Vector3 | GetWorldLocation () const |
Gets the world location of the component. | |
Vector3 | GetWorldScale () const |
Gets the world scale of the component. | |
Quaternion | GetWorldRotation () const |
Gets the world rotation of the component. | |
virtual Transform | GetWorldTransform () const |
Gets the world transform of the component. | |
Actor * | GetOwner () const |
Gets the owner actor of this component. | |
Protected Attributes | |
int | mTexWidth |
int | mTexHeight |
bool | mFlipX |
bool | mFlipY |
Texture * | mTexture |
![]() | |
bool | mIsActive = true |
Indicates if the component is active. | |
int | mUpdateOrder = 0 |
The order in which the component is updated. | |
Actor * | mOwner |
The actor that owns this component. | |
Transform | mRelativeTransform |
The relative transform of the component to its owner. | |
Additional Inherited Members | |
![]() | |
friend | Actor |
![]() | |
bool | LineTrace (Vector3 start, Vector3 direction, float maxDistance, raycastHit &hit, bool debugPersistant=false) |
Performs a line trace (raycast) using the owning actor. | |
Component for rendering a sprite using a texture.
Handles texture assignment, flipping, and integration with the renderer.
SpriteComponent::SpriteComponent | ( | Texture * | pTexture, |
int | DrawOrder = 0 ) |
Constructs a SpriteComponent with the given texture and draw order.
pTexture | Pointer to the texture to use. |
DrawOrder | Draw order for rendering (default is 0). |
|
delete |
Deleted default constructor.
|
delete |
Deleted copy constructor.
|
inline |
Gets whether the sprite is flipped horizontally.
|
inline |
Gets whether the sprite is flipped vertically.
|
inline |
Gets the height of the texture.
|
inline |
Gets the texture used by this sprite.
|
inline |
Gets the width of the texture.
|
delete |
Deleted copy assignment operator.
|
inline |
Sets whether the sprite is flipped horizontally.
pFlip | True to flip horizontally, false otherwise. |
|
inline |
Sets whether the sprite is flipped vertically.
pFlipY | True to flip vertically, false otherwise. |
|
overridevirtual |
Sets the owner actor for this component.
pOwner | Pointer to the owner actor. |
Reimplemented from clt::Component.
Reimplemented in clt::FlipbookComponent.
|
virtual |
Sets the texture for this sprite by name or path.
pTexture | Name or path of the texture asset. |
|
virtual |
Sets the texture for this sprite.
pTexture | Pointer to the texture to use. |
|
protected |
Whether the sprite is flipped horizontally.
|
protected |
Whether the sprite is flipped vertically.
|
protected |
Height of the texture in pixels.
|
protected |
Pointer to the texture used by the sprite.
|
protected |
Width of the texture in pixels.