|
R-Type
2
Doom but in better
|
Represents a drawable and interactive sprite in the ECS system. More...
#include <SpriteComponent.hpp>
Public Member Functions | |
| SpriteComponent () | |
| Default constructor. | |
| SpriteComponent (const std::string &name) | |
| Constructs a sprite component with a specific name. | |
| SpriteComponent (const GUI::ECS::Systems::Collision &collision) | |
| Constructs a sprite component from a collision component. | |
| SpriteComponent (const GUI::ECS::Components::AnimationComponent &animation) | |
| Constructs a sprite component from an animation component. | |
| SpriteComponent (const GUI::ECS::Components::TextureComponent &spritesheetTexture) | |
| Constructs a sprite component from a texture component. | |
| SpriteComponent (const std::string &name, const std::string &spritesheetPath) | |
| Constructs a sprite component with: | |
| SpriteComponent (const std::string &name, const GUI::ECS::Systems::Collision &collision) | |
| Constructs a sprite component with: | |
| SpriteComponent (const std::string &name, const GUI::ECS::Components::AnimationComponent &animation) | |
| Constructs a sprite component with: | |
| SpriteComponent (const std::string &name, const GUI::ECS::Components::TextureComponent &spritesheetTexture) | |
| Constructs a sprite component with: | |
| SpriteComponent (const std::string &name, const GUI::ECS::Systems::Collision &collision, const GUI::ECS::Components::AnimationComponent &animation) | |
| Constructs a sprite component with: | |
| SpriteComponent (const std::string &name, const GUI::ECS::Systems::Collision &collision, const GUI::ECS::Components::TextureComponent &spritesheetTexture) | |
| Constructs a sprite component with: | |
| SpriteComponent (const std::string &name, const GUI::ECS::Systems::Colour &normalColor, const GUI::ECS::Systems::Colour &hoverColor, const GUI::ECS::Systems::Colour &clickedColor) | |
| Constructs a sprite component with: | |
| SpriteComponent (const std::string &name, const GUI::ECS::Systems::Collision &collision, const GUI::ECS::Systems::Colour &normalColor, const GUI::ECS::Systems::Colour &hoverColor, const GUI::ECS::Systems::Colour &clickedColor) | |
| Constructs a sprite component with: | |
| SpriteComponent (const std::string &name, const GUI::ECS::Components::AnimationComponent &animation, const GUI::ECS::Systems::Colour &normalColor, const GUI::ECS::Systems::Colour &hoverColor, const GUI::ECS::Systems::Colour &clickedColor) | |
| Constructs a sprite component with: | |
| SpriteComponent (const std::string &name, const GUI::ECS::Components::TextureComponent &spritesheetTexture, const GUI::ECS::Systems::Colour &normalColor, const GUI::ECS::Systems::Colour &hoverColor, const GUI::ECS::Systems::Colour &clickedColor) | |
| Constructs a sprite component with: | |
| SpriteComponent (const std::string &name, const GUI::ECS::Systems::Collision &collision, const GUI::ECS::Components::AnimationComponent &animation, const GUI::ECS::Systems::Colour &normalColor, const GUI::ECS::Systems::Colour &hoverColor, const GUI::ECS::Systems::Colour &clickedColor) | |
| Constructs a sprite component with: | |
| SpriteComponent (const std::string &name, const GUI::ECS::Systems::Collision &collision, const GUI::ECS::Components::TextureComponent &spritesheetTexture, const GUI::ECS::Systems::Colour &normalColor, const GUI::ECS::Systems::Colour &hoverColor, const GUI::ECS::Systems::Colour &clickedColor) | |
| Constructs a sprite component with: | |
| SpriteComponent (const std::uint32_t entityId) | |
| Construct a new Sprite Component object and assing a specific entity id. | |
| SpriteComponent (const std::uint32_t entityId, const std::string &name) | |
| Constructs a sprite component with: | |
| SpriteComponent (const std::uint32_t entityId, const GUI::ECS::Systems::Collision &collision) | |
| Constructs a sprite component with: | |
| SpriteComponent (const std::uint32_t entityId, const GUI::ECS::Components::AnimationComponent &animation) | |
| Constructs a sprite component with: | |
| SpriteComponent (const std::uint32_t entityId, const GUI::ECS::Components::TextureComponent &spritesheetTexture) | |
| Constructs a sprite component with: | |
| SpriteComponent (const std::uint32_t entityId, const std::string &name, const std::string &spritesheetPath) | |
| Constructs a sprite component with: | |
| SpriteComponent (const std::uint32_t entityId, const std::string &name, const GUI::ECS::Systems::Collision &collision) | |
| Constructs a sprite component with: | |
| SpriteComponent (const std::uint32_t entityId, const std::string &name, const GUI::ECS::Components::AnimationComponent &animation) | |
| Constructs a sprite component with: | |
| SpriteComponent (const std::uint32_t entityId, const std::string &name, const GUI::ECS::Components::TextureComponent &spritesheetTexture) | |
| Constructs a sprite component with: | |
| SpriteComponent (const std::uint32_t entityId, const std::string &name, const GUI::ECS::Systems::Collision &collision, const GUI::ECS::Components::AnimationComponent &animation) | |
| Constructs a sprite component with: | |
| SpriteComponent (const std::uint32_t entityId, const std::string &name, const GUI::ECS::Systems::Collision &collision, const GUI::ECS::Components::TextureComponent &spritesheetTexture) | |
| Constructs a sprite component with: | |
| SpriteComponent (const std::uint32_t entityId, const std::string &name, const GUI::ECS::Systems::Colour &normalColor, const GUI::ECS::Systems::Colour &hoverColor, const GUI::ECS::Systems::Colour &clickedColor) | |
| Constructs a sprite component with: | |
| SpriteComponent (const std::uint32_t entityId, const std::string &name, const GUI::ECS::Systems::Collision &collision, const GUI::ECS::Systems::Colour &normalColor, const GUI::ECS::Systems::Colour &hoverColor, const GUI::ECS::Systems::Colour &clickedColor) | |
| Constructs a sprite component with: | |
| SpriteComponent (const std::uint32_t entityId, const std::string &name, const GUI::ECS::Components::AnimationComponent &animation, const GUI::ECS::Systems::Colour &normalColor, const GUI::ECS::Systems::Colour &hoverColor, const GUI::ECS::Systems::Colour &clickedColor) | |
| Constructs a sprite component with: | |
| SpriteComponent (const std::uint32_t entityId, const std::string &name, const GUI::ECS::Components::TextureComponent &spritesheetTexture, const GUI::ECS::Systems::Colour &normalColor, const GUI::ECS::Systems::Colour &hoverColor, const GUI::ECS::Systems::Colour &clickedColor) | |
| Constructs a sprite component with: | |
| SpriteComponent (const std::uint32_t entityId, const std::string &name, const GUI::ECS::Systems::Collision &collision, const GUI::ECS::Components::AnimationComponent &animation, const GUI::ECS::Systems::Colour &normalColor, const GUI::ECS::Systems::Colour &hoverColor, const GUI::ECS::Systems::Colour &clickedColor) | |
| Constructs a sprite component with: | |
| SpriteComponent (const std::uint32_t entityId, const std::string &name, const GUI::ECS::Systems::Collision &collision, const GUI::ECS::Components::TextureComponent &spritesheetTexture, const GUI::ECS::Systems::Colour &normalColor, const GUI::ECS::Systems::Colour &hoverColor, const GUI::ECS::Systems::Colour &clickedColor) | |
| Constructs a sprite component with: | |
| ~SpriteComponent () | |
| Destructor. | |
| void | setName (const std::string &name) |
| Sets the name of the sprite. | |
| void | setApplication (const std::string &application) |
| Sets the application name (the name is based on the configuration file) associated with the sprite. | |
| void | setCollision (const GUI::ECS::Systems::Collision ©) |
| Associates a collision component with the sprite. | |
| void | setNormalColor (const GUI::ECS::Systems::Colour &color) |
| Set the default colour of the sprite. | |
| void | setHoverColor (const GUI::ECS::Systems::Colour &color) |
| Set the Hover Color of the sprite. | |
| void | setClickedColor (const GUI::ECS::Systems::Colour &color) |
| Set the Clicked Color of the sprite. | |
| void | setSpritesheet (const std::string &spritesheetPath) |
| Sets the texture of the sprite using a file path. | |
| void | setSpritesheet (const GUI::ECS::Components::TextureComponent &spritesheetTexture) |
| Sets the texture of the sprite using a TextureComponent. | |
| void | setAnimation (const GUI::ECS::Components::AnimationComponent &animation) |
| Associates an animation component with the sprite. | |
| void | setVisible (const bool visible) |
| Set the visible of the sprite. | |
| void | setPosition (const std::pair< int, int > &pos) |
| Set the Position of the sprite. | |
| void | setDimension (const std::pair< float, float > &dim) |
| Set the dimensions of the sprite. | |
| void | toggleVisibility () |
| Change the visibility of the sprite, if visible becomes invisible and vise versa. | |
| void | update (const GUI::ECS::Systems::MouseInfo &mouse) |
| Updates the sprite based on mouse input. | |
| void | update (const GUI::ECS::Components::AnimationComponent &animation) |
| Updates the animation component that is used by the sprite. | |
| void | update (const GUI::ECS::Components::SpriteComponent ©) |
| Updates the sprite by copying another SpriteComponent. | |
| std::any | render () const |
| Renders the sprite to a window. | |
| void | start () |
| Start the playing of the animation from the current index in memory. | |
| void | pause () |
| Pause the playing of the animation but does not reset the index to the default frame. | |
| void | resume () |
| Resume the playing of the animation (has no effect if already playing) | |
| void | stop () |
| A function to stop the animation, and reset the index to the default frame. | |
| const bool | isCollisionSet () const |
| Checks if collision data is set. | |
| const bool | isAnimationSet () const |
| Checks if animation data is set. | |
| const bool | isSpritesheetSet () const |
| Checks if a spritesheet texture is set. | |
| const bool | isSpriteSet () const |
| Checks if the sprite is initialized. | |
| const bool | isVisible () const |
| Check if the sprite is set to be rendred or not. | |
| const bool | isLooping () const |
| Get the information about if the component is set to loop the animation. | |
| const bool | isPaused () const |
| Get the information about the state of the animation (paused) | |
| const bool | isPlaying () const |
| Get the information about the state of the animation (playing) | |
| const bool | isStopped () const |
| Get the information about the state of the animation (stopped) | |
| const bool | hasTicked () |
| A function to check if the frame has changed. | |
| const bool | hasLooped () const |
| A function to check if the animation has looped around (valid for the 1rst frame of the new loop) | |
| void | checkTick () |
| Processes and updates sprite properties based on tick state of the clock internal to it's animation component instance. | |
| void | forceTick () |
| Updates the animation frame regardless of the delay. | |
| const bool | getVisible () const |
| Check if the sprite is set to be rendred or not. | |
| const std::string | getName () const |
| Gets the name of the sprite. | |
| const std::string | getApplication () const |
| Gets the application name associated with the sprite. | |
| const GUI::ECS::Components::TextureComponent | getSpritesheet () const |
| Gets the texture component associated with the sprite. | |
| const GUI::ECS::Systems::Collision | getCollision () const |
| Gets the collision component associated with the sprite. | |
| const GUI::ECS::Components::AnimationComponent | getAnimation () const |
| Gets the animation component associated with the sprite. | |
| const GUI::ECS::Systems::Colour | getNormalColor () const |
| Get the colour of the default state for the class. | |
| const GUI::ECS::Systems::Colour | getHoverColor () const |
| Get the colour of the hover state for the class. | |
| const GUI::ECS::Systems::Colour | getClickedColor () const |
| Get the colour of the clicked state for the class. | |
| const std::string | getInfo (const unsigned int indent=0) const |
| This is a function meant for debugging purposes It will dump the current state of the variables upon call. It will dump them for itself and any of it's underlying classes. | |
| SpriteComponent & | operator= (const GUI::ECS::Components::SpriteComponent ©) |
| Overloads the assignment operator to copy from another SpriteComponent. | |
Public Member Functions inherited from GUI::ECS::EntityNode | |
| EntityNode (const size_t entityId=0) | |
| virtual | ~EntityNode ()=default |
| virtual size_t | getEntityNodeId () const |
Additional Inherited Members | |
Protected Attributes inherited from GUI::ECS::EntityNode | |
| size_t | _entityID |
Represents a drawable and interactive sprite in the ECS system.
This class manages a sprite's texture, animation, collision, and color states, while allowing it to interact with mouse events. It inherits from EntityNode to integrate with the ECS framework and supports a variety of configurations.
Definition at line 44 of file SpriteComponent.hpp.
| GUI::ECS::Components::SpriteComponent::SpriteComponent | ( | ) |
Default constructor.
Initializes an empty sprite component with default values.
Definition at line 16 of file SpriteComponent.cpp.
| GUI::ECS::Components::SpriteComponent::SpriteComponent | ( | const std::string & | name | ) |
Constructs a sprite component with a specific name.
| name | Name of the sprite. |
Definition at line 22 of file SpriteComponent.cpp.
| GUI::ECS::Components::SpriteComponent::SpriteComponent | ( | const GUI::ECS::Systems::Collision & | collision | ) |
Constructs a sprite component from a collision component.
| collision | Collision data to associate with the sprite. |
Definition at line 29 of file SpriteComponent.cpp.
| GUI::ECS::Components::SpriteComponent::SpriteComponent | ( | const GUI::ECS::Components::AnimationComponent & | animation | ) |
Constructs a sprite component from an animation component.
| animation | Animation data to associate with the sprite. |
Definition at line 37 of file SpriteComponent.cpp.
| GUI::ECS::Components::SpriteComponent::SpriteComponent | ( | const GUI::ECS::Components::TextureComponent & | spritesheetTexture | ) |
Constructs a sprite component from a texture component.
| spritesheetTexture | Texture to associate with the sprite. |
Definition at line 45 of file SpriteComponent.cpp.
| GUI::ECS::Components::SpriteComponent::SpriteComponent | ( | const std::string & | name, |
| const std::string & | spritesheetPath ) |
Constructs a sprite component with:
| name | Name of the sprite. |
| spritesheetPath | File path of the texture to load as the spritesheet. |
Definition at line 53 of file SpriteComponent.cpp.
| GUI::ECS::Components::SpriteComponent::SpriteComponent | ( | const std::string & | name, |
| const GUI::ECS::Systems::Collision & | collision ) |
Constructs a sprite component with:
| name | Name of the sprite |
| collision | Collision instance |
Definition at line 62 of file SpriteComponent.cpp.
| GUI::ECS::Components::SpriteComponent::SpriteComponent | ( | const std::string & | name, |
| const GUI::ECS::Components::AnimationComponent & | animation ) |
Constructs a sprite component with:
| name | Name of the sprite |
| animation | Animation instance |
Definition at line 71 of file SpriteComponent.cpp.
| GUI::ECS::Components::SpriteComponent::SpriteComponent | ( | const std::string & | name, |
| const GUI::ECS::Components::TextureComponent & | spritesheetTexture ) |
Constructs a sprite component with:
| name | Name of the sprite |
| spritesheetTexture | Spritesheet texture instance |
Definition at line 80 of file SpriteComponent.cpp.
| GUI::ECS::Components::SpriteComponent::SpriteComponent | ( | const std::string & | name, |
| const GUI::ECS::Systems::Collision & | collision, | ||
| const GUI::ECS::Components::AnimationComponent & | animation ) |
Constructs a sprite component with:
| name | Name of the sprite |
| collision | Collision instance |
| animation | Animation instance |
Definition at line 89 of file SpriteComponent.cpp.
| GUI::ECS::Components::SpriteComponent::SpriteComponent | ( | const std::string & | name, |
| const GUI::ECS::Systems::Collision & | collision, | ||
| const GUI::ECS::Components::TextureComponent & | spritesheetTexture ) |
Constructs a sprite component with:
| name | Name of the sprite |
| collision | Collision instance |
| spritesheetTexture | Texture instance containing a spritesheet |
Definition at line 99 of file SpriteComponent.cpp.
| GUI::ECS::Components::SpriteComponent::SpriteComponent | ( | const std::string & | name, |
| const GUI::ECS::Systems::Colour & | normalColor, | ||
| const GUI::ECS::Systems::Colour & | hoverColor, | ||
| const GUI::ECS::Systems::Colour & | clickedColor ) |
Constructs a sprite component with:
| name | Name of the sprite |
| normalColor | Default sprite color |
| hoverColor | Hover colour |
| clickedColor | Clicked colour |
Definition at line 109 of file SpriteComponent.cpp.
| GUI::ECS::Components::SpriteComponent::SpriteComponent | ( | const std::string & | name, |
| const GUI::ECS::Systems::Collision & | collision, | ||
| const GUI::ECS::Systems::Colour & | normalColor, | ||
| const GUI::ECS::Systems::Colour & | hoverColor, | ||
| const GUI::ECS::Systems::Colour & | clickedColor ) |
Constructs a sprite component with:
| name | Name of the sprite |
| collision | Sprite collision component |
| normalColor | Default sprite colour |
| hoverColor | Hover colour |
| clickedColor | Clicked colour |
Definition at line 120 of file SpriteComponent.cpp.
| GUI::ECS::Components::SpriteComponent::SpriteComponent | ( | const std::string & | name, |
| const GUI::ECS::Components::AnimationComponent & | animation, | ||
| const GUI::ECS::Systems::Colour & | normalColor, | ||
| const GUI::ECS::Systems::Colour & | hoverColor, | ||
| const GUI::ECS::Systems::Colour & | clickedColor ) |
Constructs a sprite component with:
| name | Name of the sprite |
| animation | Animation component |
| normalColor | Default sprite colour |
| hoverColor | Hover colour |
| clickedColor | Clicked colour |
Definition at line 132 of file SpriteComponent.cpp.
| GUI::ECS::Components::SpriteComponent::SpriteComponent | ( | const std::string & | name, |
| const GUI::ECS::Components::TextureComponent & | spritesheetTexture, | ||
| const GUI::ECS::Systems::Colour & | normalColor, | ||
| const GUI::ECS::Systems::Colour & | hoverColor, | ||
| const GUI::ECS::Systems::Colour & | clickedColor ) |
Constructs a sprite component with:
| name | Name of the sprite |
| spritesheetTexture | The Texture of the spritesheet to process |
| normalColor | Default sprite colour |
| hoverColor | Hover colour |
| clickedColor | Clicked colour |
Definition at line 144 of file SpriteComponent.cpp.
| GUI::ECS::Components::SpriteComponent::SpriteComponent | ( | const std::string & | name, |
| const GUI::ECS::Systems::Collision & | collision, | ||
| const GUI::ECS::Components::AnimationComponent & | animation, | ||
| const GUI::ECS::Systems::Colour & | normalColor, | ||
| const GUI::ECS::Systems::Colour & | hoverColor, | ||
| const GUI::ECS::Systems::Colour & | clickedColor ) |
Constructs a sprite component with:
| name | Name of the sprite |
| collision | The collision component |
| animation | The animation component |
| normalColor | Default sprite colour |
| hoverColor | Hover colour |
| clickedColor | Clicked colour |
Definition at line 156 of file SpriteComponent.cpp.
| GUI::ECS::Components::SpriteComponent::SpriteComponent | ( | const std::string & | name, |
| const GUI::ECS::Systems::Collision & | collision, | ||
| const GUI::ECS::Components::TextureComponent & | spritesheetTexture, | ||
| const GUI::ECS::Systems::Colour & | normalColor, | ||
| const GUI::ECS::Systems::Colour & | hoverColor, | ||
| const GUI::ECS::Systems::Colour & | clickedColor ) |
Constructs a sprite component with:
| name | Name of the sprite |
| collision | The collision component |
| spritesheetTexture | The texture containing the spritesheet |
| normalColor | Default colour |
| hoverColor | Hover colour |
| clickedColor | Clicked colour |
Definition at line 169 of file SpriteComponent.cpp.
| GUI::ECS::Components::SpriteComponent::SpriteComponent | ( | const std::uint32_t | entityId | ) |
Construct a new Sprite Component object and assing a specific entity id.
| entityId | The id of the class instance |
Definition at line 184 of file SpriteComponent.cpp.
| GUI::ECS::Components::SpriteComponent::SpriteComponent | ( | const std::uint32_t | entityId, |
| const std::string & | name ) |
Constructs a sprite component with:
| entityId | The id of the class instance |
| name | Name of the sprite. |
Definition at line 190 of file SpriteComponent.cpp.
| GUI::ECS::Components::SpriteComponent::SpriteComponent | ( | const std::uint32_t | entityId, |
| const GUI::ECS::Systems::Collision & | collision ) |
Constructs a sprite component with:
| entityId | The id of the class instance |
| collision | Collision data to associate with the sprite. |
Definition at line 198 of file SpriteComponent.cpp.
| GUI::ECS::Components::SpriteComponent::SpriteComponent | ( | const std::uint32_t | entityId, |
| const GUI::ECS::Components::AnimationComponent & | animation ) |
Constructs a sprite component with:
| entityId | The id of the class instance |
| animation | Animation data to associate with the sprite. |
Definition at line 206 of file SpriteComponent.cpp.
| GUI::ECS::Components::SpriteComponent::SpriteComponent | ( | const std::uint32_t | entityId, |
| const GUI::ECS::Components::TextureComponent & | spritesheetTexture ) |
Constructs a sprite component with:
| entityId | The id of the class instance |
| spritesheetTexture | Texture to associate with the sprite. |
Definition at line 214 of file SpriteComponent.cpp.
| GUI::ECS::Components::SpriteComponent::SpriteComponent | ( | const std::uint32_t | entityId, |
| const std::string & | name, | ||
| const std::string & | spritesheetPath ) |
Constructs a sprite component with:
| entityId | The id of the class instance |
| name | Name of the sprite. |
| spritesheetPath | File path of the texture to load as the spritesheet. |
Definition at line 222 of file SpriteComponent.cpp.
| GUI::ECS::Components::SpriteComponent::SpriteComponent | ( | const std::uint32_t | entityId, |
| const std::string & | name, | ||
| const GUI::ECS::Systems::Collision & | collision ) |
Constructs a sprite component with:
| entityId | The id of the class instance |
| name | Name of the sprite |
| collision | Collision instance |
Definition at line 231 of file SpriteComponent.cpp.
| GUI::ECS::Components::SpriteComponent::SpriteComponent | ( | const std::uint32_t | entityId, |
| const std::string & | name, | ||
| const GUI::ECS::Components::AnimationComponent & | animation ) |
Constructs a sprite component with:
| entityId | The id of the class instance |
| name | Name of the sprite |
| animation | Animation instance |
Definition at line 240 of file SpriteComponent.cpp.
| GUI::ECS::Components::SpriteComponent::SpriteComponent | ( | const std::uint32_t | entityId, |
| const std::string & | name, | ||
| const GUI::ECS::Components::TextureComponent & | spritesheetTexture ) |
Constructs a sprite component with:
| entityId | The id of the class instance |
| name | Name of the sprite |
| spritesheetTexture | Spritesheet texture instance |
Definition at line 250 of file SpriteComponent.cpp.
| GUI::ECS::Components::SpriteComponent::SpriteComponent | ( | const std::uint32_t | entityId, |
| const std::string & | name, | ||
| const GUI::ECS::Systems::Collision & | collision, | ||
| const GUI::ECS::Components::AnimationComponent & | animation ) |
Constructs a sprite component with:
| entityId | The id of the class instance |
| name | Name of the sprite |
| collision | Collision instance |
| animation | Animation instance |
Definition at line 260 of file SpriteComponent.cpp.
| GUI::ECS::Components::SpriteComponent::SpriteComponent | ( | const std::uint32_t | entityId, |
| const std::string & | name, | ||
| const GUI::ECS::Systems::Collision & | collision, | ||
| const GUI::ECS::Components::TextureComponent & | spritesheetTexture ) |
Constructs a sprite component with:
| entityId | The id of the class instance |
| name | Name of the sprite |
| collision | Collision instance |
| spritesheetTexture | Texture instance containing a spritesheet |
Definition at line 270 of file SpriteComponent.cpp.
| GUI::ECS::Components::SpriteComponent::SpriteComponent | ( | const std::uint32_t | entityId, |
| const std::string & | name, | ||
| const GUI::ECS::Systems::Colour & | normalColor, | ||
| const GUI::ECS::Systems::Colour & | hoverColor, | ||
| const GUI::ECS::Systems::Colour & | clickedColor ) |
Constructs a sprite component with:
| entityId | The id of the class instance |
| name | Name of the sprite |
| normalColor | Default sprite color |
| hoverColor | Hover colour |
| clickedColor | Clicked colour |
Definition at line 280 of file SpriteComponent.cpp.
| GUI::ECS::Components::SpriteComponent::SpriteComponent | ( | const std::uint32_t | entityId, |
| const std::string & | name, | ||
| const GUI::ECS::Systems::Collision & | collision, | ||
| const GUI::ECS::Systems::Colour & | normalColor, | ||
| const GUI::ECS::Systems::Colour & | hoverColor, | ||
| const GUI::ECS::Systems::Colour & | clickedColor ) |
Constructs a sprite component with:
| entityId | The id of the class instance |
| name | Name of the sprite |
| collision | Sprite collision component |
| normalColor | Default sprite colour |
| hoverColor | Hover colour |
| clickedColor | Clicked colour |
Definition at line 291 of file SpriteComponent.cpp.
| GUI::ECS::Components::SpriteComponent::SpriteComponent | ( | const std::uint32_t | entityId, |
| const std::string & | name, | ||
| const GUI::ECS::Components::AnimationComponent & | animation, | ||
| const GUI::ECS::Systems::Colour & | normalColor, | ||
| const GUI::ECS::Systems::Colour & | hoverColor, | ||
| const GUI::ECS::Systems::Colour & | clickedColor ) |
Constructs a sprite component with:
| entityId | The id of the class instance |
| name | Name of the sprite |
| animation | Animation component |
| normalColor | Default sprite colour |
| hoverColor | Hover colour |
| clickedColor | Clicked colour |
Definition at line 303 of file SpriteComponent.cpp.
| GUI::ECS::Components::SpriteComponent::SpriteComponent | ( | const std::uint32_t | entityId, |
| const std::string & | name, | ||
| const GUI::ECS::Components::TextureComponent & | spritesheetTexture, | ||
| const GUI::ECS::Systems::Colour & | normalColor, | ||
| const GUI::ECS::Systems::Colour & | hoverColor, | ||
| const GUI::ECS::Systems::Colour & | clickedColor ) |
Constructs a sprite component with:
| entityId | The id of the class instance |
| name | Name of the sprite |
| spritesheetTexture | The Texture of the spritesheet to process |
| normalColor | Default sprite colour |
| hoverColor | Hover colour |
| clickedColor | Clicked colour |
Definition at line 315 of file SpriteComponent.cpp.
| GUI::ECS::Components::SpriteComponent::SpriteComponent | ( | const std::uint32_t | entityId, |
| const std::string & | name, | ||
| const GUI::ECS::Systems::Collision & | collision, | ||
| const GUI::ECS::Components::AnimationComponent & | animation, | ||
| const GUI::ECS::Systems::Colour & | normalColor, | ||
| const GUI::ECS::Systems::Colour & | hoverColor, | ||
| const GUI::ECS::Systems::Colour & | clickedColor ) |
Constructs a sprite component with:
| entityId | The id of the class instance |
| name | Name of the sprite |
| collision | The collision component |
| animation | The animation component |
| normalColor | Default sprite colour |
| hoverColor | Hover colour |
| clickedColor | Clicked colour |
Definition at line 327 of file SpriteComponent.cpp.
| GUI::ECS::Components::SpriteComponent::SpriteComponent | ( | const std::uint32_t | entityId, |
| const std::string & | name, | ||
| const GUI::ECS::Systems::Collision & | collision, | ||
| const GUI::ECS::Components::TextureComponent & | spritesheetTexture, | ||
| const GUI::ECS::Systems::Colour & | normalColor, | ||
| const GUI::ECS::Systems::Colour & | hoverColor, | ||
| const GUI::ECS::Systems::Colour & | clickedColor ) |
Constructs a sprite component with:
| entityId | The id of the class instance |
| name | Name of the sprite |
| collision | The collision component |
| spritesheetTexture | The texture containing the spritesheet |
| normalColor | Default colour |
| hoverColor | Hover colour |
| clickedColor | Clicked colour |
Definition at line 340 of file SpriteComponent.cpp.
| GUI::ECS::Components::SpriteComponent::~SpriteComponent | ( | ) |
Destructor.
Definition at line 354 of file SpriteComponent.cpp.
| void GUI::ECS::Components::SpriteComponent::checkTick | ( | ) |
Processes and updates sprite properties based on tick state of the clock internal to it's animation component instance.
Definition at line 568 of file SpriteComponent.cpp.
| void GUI::ECS::Components::SpriteComponent::forceTick | ( | ) |
Updates the animation frame regardless of the delay.
Definition at line 608 of file SpriteComponent.cpp.
| const GUI::ECS::Components::AnimationComponent GUI::ECS::Components::SpriteComponent::getAnimation | ( | ) | const |
Gets the animation component associated with the sprite.
| CustomExceptions::NoAnimation | If no animation is set. |
Definition at line 675 of file SpriteComponent.cpp.
| const std::string GUI::ECS::Components::SpriteComponent::getApplication | ( | ) | const |
Gets the application name associated with the sprite.
Definition at line 654 of file SpriteComponent.cpp.
| const GUI::ECS::Systems::Colour GUI::ECS::Components::SpriteComponent::getClickedColor | ( | ) | const |
Get the colour of the clicked state for the class.
Definition at line 693 of file SpriteComponent.cpp.
| const GUI::ECS::Systems::Collision GUI::ECS::Components::SpriteComponent::getCollision | ( | ) | const |
Gets the collision component associated with the sprite.
| CustomExceptions::NoCollision | If no collision is set. |
Definition at line 667 of file SpriteComponent.cpp.
| const GUI::ECS::Systems::Colour GUI::ECS::Components::SpriteComponent::getHoverColor | ( | ) | const |
Get the colour of the hover state for the class.
Definition at line 688 of file SpriteComponent.cpp.
| const std::string GUI::ECS::Components::SpriteComponent::getInfo | ( | const unsigned int | indent = 0 | ) | const |
This is a function meant for debugging purposes It will dump the current state of the variables upon call. It will dump them for itself and any of it's underlying classes.
| indent | The level to which the class should be indented in the dump. |
Definition at line 699 of file SpriteComponent.cpp.
| const std::string GUI::ECS::Components::SpriteComponent::getName | ( | ) | const |
Gets the name of the sprite.
Definition at line 649 of file SpriteComponent.cpp.
| const GUI::ECS::Systems::Colour GUI::ECS::Components::SpriteComponent::getNormalColor | ( | ) | const |
Get the colour of the default state for the class.
Definition at line 683 of file SpriteComponent.cpp.
| const GUI::ECS::Components::TextureComponent GUI::ECS::Components::SpriteComponent::getSpritesheet | ( | ) | const |
Gets the texture component associated with the sprite.
| CustomExceptions::NoSpriteSheet | If no spritesheet is set. |
Definition at line 659 of file SpriteComponent.cpp.
| const bool GUI::ECS::Components::SpriteComponent::getVisible | ( | ) | const |
Check if the sprite is set to be rendred or not.
Definition at line 644 of file SpriteComponent.cpp.
| const bool GUI::ECS::Components::SpriteComponent::hasLooped | ( | ) | const |
A function to check if the animation has looped around (valid for the 1rst frame of the new loop)
Definition at line 563 of file SpriteComponent.cpp.
| const bool GUI::ECS::Components::SpriteComponent::hasTicked | ( | ) |
A function to check if the frame has changed.
Definition at line 558 of file SpriteComponent.cpp.
| const bool GUI::ECS::Components::SpriteComponent::isAnimationSet | ( | ) | const |
Checks if animation data is set.
Definition at line 518 of file SpriteComponent.cpp.
| const bool GUI::ECS::Components::SpriteComponent::isCollisionSet | ( | ) | const |
Checks if collision data is set.
Definition at line 513 of file SpriteComponent.cpp.
| const bool GUI::ECS::Components::SpriteComponent::isLooping | ( | ) | const |
Get the information about if the component is set to loop the animation.
Definition at line 538 of file SpriteComponent.cpp.
| const bool GUI::ECS::Components::SpriteComponent::isPaused | ( | ) | const |
Get the information about the state of the animation (paused)
Definition at line 543 of file SpriteComponent.cpp.
| const bool GUI::ECS::Components::SpriteComponent::isPlaying | ( | ) | const |
Get the information about the state of the animation (playing)
Definition at line 548 of file SpriteComponent.cpp.
| const bool GUI::ECS::Components::SpriteComponent::isSpriteSet | ( | ) | const |
Checks if the sprite is initialized.
Definition at line 528 of file SpriteComponent.cpp.
| const bool GUI::ECS::Components::SpriteComponent::isSpritesheetSet | ( | ) | const |
Checks if a spritesheet texture is set.
Definition at line 523 of file SpriteComponent.cpp.
| const bool GUI::ECS::Components::SpriteComponent::isStopped | ( | ) | const |
Get the information about the state of the animation (stopped)
Definition at line 553 of file SpriteComponent.cpp.
| const bool GUI::ECS::Components::SpriteComponent::isVisible | ( | ) | const |
Check if the sprite is set to be rendred or not.
Definition at line 533 of file SpriteComponent.cpp.
| GUI::ECS::Components::SpriteComponent & GUI::ECS::Components::SpriteComponent::operator= | ( | const GUI::ECS::Components::SpriteComponent & | copy | ) |
Overloads the assignment operator to copy from another SpriteComponent.
| copy | The SpriteComponent to copy data from. |
Definition at line 725 of file SpriteComponent.cpp.
| void GUI::ECS::Components::SpriteComponent::pause | ( | ) |
Pause the playing of the animation but does not reset the index to the default frame.
Definition at line 498 of file SpriteComponent.cpp.
| std::any GUI::ECS::Components::SpriteComponent::render | ( | ) | const |
Renders the sprite to a window.
| CustomExceptions::NoSprite | If no sprite is set. |
Definition at line 484 of file SpriteComponent.cpp.
| void GUI::ECS::Components::SpriteComponent::resume | ( | ) |
Resume the playing of the animation (has no effect if already playing)
Definition at line 503 of file SpriteComponent.cpp.
| void GUI::ECS::Components::SpriteComponent::setAnimation | ( | const GUI::ECS::Components::AnimationComponent & | animation | ) |
Associates an animation component with the sprite.
| animation | Animation component to set. |
Definition at line 420 of file SpriteComponent.cpp.
| void GUI::ECS::Components::SpriteComponent::setApplication | ( | const std::string & | application | ) |
Sets the application name (the name is based on the configuration file) associated with the sprite.
| application | Application name. |
Definition at line 363 of file SpriteComponent.cpp.
| void GUI::ECS::Components::SpriteComponent::setClickedColor | ( | const GUI::ECS::Systems::Colour & | color | ) |
Set the Clicked Color of the sprite.
| color | The colour the sprite takes when it is clicked by the user's mouse. |
Definition at line 397 of file SpriteComponent.cpp.
| void GUI::ECS::Components::SpriteComponent::setCollision | ( | const GUI::ECS::Systems::Collision & | copy | ) |
Associates a collision component with the sprite.
| copy | Collision component to set. |
Updates the collision data and recalculates the sprite's position and scale.
Definition at line 368 of file SpriteComponent.cpp.
| void GUI::ECS::Components::SpriteComponent::setDimension | ( | const std::pair< float, float > & | dim | ) |
Set the dimensions of the sprite.
| dim |
Definition at line 446 of file SpriteComponent.cpp.
| void GUI::ECS::Components::SpriteComponent::setHoverColor | ( | const GUI::ECS::Systems::Colour & | color | ) |
Set the Hover Color of the sprite.
| color | The colour the sprite takes when it is hovered by the user's mouse. |
Definition at line 392 of file SpriteComponent.cpp.
| void GUI::ECS::Components::SpriteComponent::setName | ( | const std::string & | name | ) |
Sets the name of the sprite.
| name | The name to assign to the sprite. |
Definition at line 356 of file SpriteComponent.cpp.
| void GUI::ECS::Components::SpriteComponent::setNormalColor | ( | const GUI::ECS::Systems::Colour & | color | ) |
Set the default colour of the sprite.
| color | The colour of the sprite when it is in it's normal state |
Definition at line 387 of file SpriteComponent.cpp.
| void GUI::ECS::Components::SpriteComponent::setPosition | ( | const std::pair< int, int > & | pos | ) |
| void GUI::ECS::Components::SpriteComponent::setSpritesheet | ( | const GUI::ECS::Components::TextureComponent & | spritesheetTexture | ) |
Sets the texture of the sprite using a TextureComponent.
| spritesheetTexture | Texture component to set. |
Definition at line 402 of file SpriteComponent.cpp.
| void GUI::ECS::Components::SpriteComponent::setSpritesheet | ( | const std::string & | spritesheetPath | ) |
Sets the texture of the sprite using a file path.
| spritesheetPath | Path to the spritesheet texture file. |
Definition at line 375 of file SpriteComponent.cpp.
| void GUI::ECS::Components::SpriteComponent::setVisible | ( | const bool | visible | ) |
Set the visible of the sprite.
| visible | A boolean instance. |
Definition at line 435 of file SpriteComponent.cpp.
| void GUI::ECS::Components::SpriteComponent::start | ( | ) |
Start the playing of the animation from the current index in memory.
Definition at line 493 of file SpriteComponent.cpp.
| void GUI::ECS::Components::SpriteComponent::stop | ( | ) |
A function to stop the animation, and reset the index to the default frame.
Definition at line 508 of file SpriteComponent.cpp.
| void GUI::ECS::Components::SpriteComponent::toggleVisibility | ( | ) |
Change the visibility of the sprite, if visible becomes invisible and vise versa.
Definition at line 452 of file SpriteComponent.cpp.
| void GUI::ECS::Components::SpriteComponent::update | ( | const GUI::ECS::Components::AnimationComponent & | animation | ) |
Updates the animation component that is used by the sprite.
| animation | Animation instance. |
Definition at line 471 of file SpriteComponent.cpp.
| void GUI::ECS::Components::SpriteComponent::update | ( | const GUI::ECS::Components::SpriteComponent & | copy | ) |
Updates the sprite by copying another SpriteComponent.
| copy | The SpriteComponent to copy data from. |
Definition at line 476 of file SpriteComponent.cpp.
| void GUI::ECS::Components::SpriteComponent::update | ( | const GUI::ECS::Systems::MouseInfo & | mouse | ) |
Updates the sprite based on mouse input.
| mouse | Mouse information. |
| CustomExceptions::NoCollision | If no collision is set. |
Definition at line 461 of file SpriteComponent.cpp.