R-Type  2
Doom but in better
Loading...
Searching...
No Matches
GUI::ECS::Components::ShapeComponent Class Reference

Manages shapes and their associated properties in the ECS framework. More...

#include <ShapeComponent.hpp>

Inheritance diagram for GUI::ECS::Components::ShapeComponent:
Inheritance graph
Collaboration diagram for GUI::ECS::Components::ShapeComponent:
Collaboration graph

Public Member Functions

 ShapeComponent (const std::uint32_t entityId=0)
 Default constructor.
 
 ShapeComponent (const std::size_t pointCount, const std::pair< float, float > &position={ 0, 0 }, const GUI::ECS::Systems::Colour &normalColour=GUI::ECS::Systems::Colour::AliceBlue, const GUI::ECS::Systems::Colour &hoverColour=GUI::ECS::Systems::Colour::White, const GUI::ECS::Systems::Colour &clickedColour=GUI::ECS::Systems::Colour::CornflowerBlue, const bool visible=true)
 Constructs a convex shape.
 
 ShapeComponent (const std::size_t pointCount, const float radius, const std::pair< float, float > &position={ 0, 0 }, const GUI::ECS::Systems::Colour &normalColour=GUI::ECS::Systems::Colour::AliceBlue, const GUI::ECS::Systems::Colour &hoverColour=GUI::ECS::Systems::Colour::White, const GUI::ECS::Systems::Colour &clickedColour=GUI::ECS::Systems::Colour::CornflowerBlue, const bool visible=true)
 Constructs a circle shape.
 
 ShapeComponent (const std::pair< float, float > &size, const std::pair< float, float > &position={ 0, 0 }, const GUI::ECS::Systems::Colour &normalColour=GUI::ECS::Systems::Colour::AliceBlue, const GUI::ECS::Systems::Colour &hoverColour=GUI::ECS::Systems::Colour::White, const GUI::ECS::Systems::Colour &clickedColour=GUI::ECS::Systems::Colour::CornflowerBlue, const bool visible=true)
 Constructs a rectangle shape.
 
 ShapeComponent (const Recoded::FloatRect &rect, const GUI::ECS::Systems::Colour &normalColour=GUI::ECS::Systems::Colour::AliceBlue, const GUI::ECS::Systems::Colour &hoverColour=GUI::ECS::Systems::Colour::White, const GUI::ECS::Systems::Colour &clickedColour=GUI::ECS::Systems::Colour::CornflowerBlue, const bool visible=true)
 Constructs a rectangle shape from a FloatRect.
 
 ShapeComponent (const std::uint32_t entityId, const std::size_t pointCount, const std::pair< float, float > &position={ 0, 0 }, const GUI::ECS::Systems::Colour &normalColour=GUI::ECS::Systems::Colour::AliceBlue, const GUI::ECS::Systems::Colour &hoverColour=GUI::ECS::Systems::Colour::White, const GUI::ECS::Systems::Colour &clickedColour=GUI::ECS::Systems::Colour::CornflowerBlue, const bool visible=true)
 Constructs a convex shape.
 
 ShapeComponent (const std::uint32_t entityId, const std::size_t pointCount, const float radius, const std::pair< float, float > &position={ 0, 0 }, const GUI::ECS::Systems::Colour &normalColour=GUI::ECS::Systems::Colour::AliceBlue, const GUI::ECS::Systems::Colour &hoverColour=GUI::ECS::Systems::Colour::White, const GUI::ECS::Systems::Colour &clickedColour=GUI::ECS::Systems::Colour::CornflowerBlue, const bool visible=true)
 Constructs a circle shape.
 
 ShapeComponent (const std::uint32_t entityId, const std::pair< float, float > &size, const std::pair< float, float > &position={ 0, 0 }, const GUI::ECS::Systems::Colour &normalColour=GUI::ECS::Systems::Colour::AliceBlue, const GUI::ECS::Systems::Colour &hoverColour=GUI::ECS::Systems::Colour::White, const GUI::ECS::Systems::Colour &clickedColour=GUI::ECS::Systems::Colour::CornflowerBlue, const bool visible=true)
 Constructs a rectangle shape.
 
 ShapeComponent (const std::uint32_t entityId, const Recoded::FloatRect &rect, const GUI::ECS::Systems::Colour &normalColour=GUI::ECS::Systems::Colour::AliceBlue, const GUI::ECS::Systems::Colour &hoverColour=GUI::ECS::Systems::Colour::White, const GUI::ECS::Systems::Colour &clickedColour=GUI::ECS::Systems::Colour::CornflowerBlue, const bool visible=true)
 Constructs a rectangle shape from a FloatRect.
 
 ~ShapeComponent ()
 Destructor.
 
void setHoverColor (const GUI::ECS::Systems::Colour &hoverColor)
 Sets the hover color for the shape.
 
void setNormalColor (const GUI::ECS::Systems::Colour &normalColor)
 Sets the normal color for the shape.
 
void setClickedColor (const GUI::ECS::Systems::Colour &clickedColor)
 Sets the clicked color for the shape.
 
void setShape (const std::size_t pointCount)
 Create a convex shape.
 
void setShape (const std::size_t pointCount, const float radius)
 Create a circle.
 
void setShape (const std::pair< float, float > &size)
 Create a rectangle.
 
void setShape (const Recoded::FloatRect &rect)
 Create a rectangle based on an Recoded::FloatRect.
 
void setShape (const GUI::ECS::Systems::ActiveShape &type)
 Set the type of the object (this does not initialise the component)
 
void setShape (const GUI::ECS::Systems::ActiveShape &type, const std::any &shape)
 Set the shape based on the type and an existing instance of a shape.
 
void setShape (const std::pair< GUI::ECS::Systems::ActiveShape, std::any > &shape)
 Set the Shape object based on a pair made of the shape type and shape instance.
 
void setVisible (const bool visible)
 Set the visible toggle informing the program if it should (or not) render the component.
 
void setPosition (const std::pair< float, float > position)
 Set the position of the component.
 
void setDimension (const std::pair< float, float > dimension)
 Set the Dimension object.
 
void setCollision (const GUI::ECS::Systems::Collision &collision)
 Set the internal collision class using another Collision component.
 
void setName (const std::string &name)
 Set the Name of the component.
 
void setApplication (const std::string &application)
 Set the Application context of the component.
 
void toggleVisibility ()
 Toggles the visibility of the shape.
 
const bool isVisible () const
 Get the visibility status of the component.
 
const bool isShapeInitialised () const
 Know if there is a shape initialised or not.
 
const GUI::ECS::Systems::ActiveShape getShapeType () const
 Get the Shape Type shape, none is returned if none are initialised.
 
const std::string getShapeTypeString () const
 Get the Shape Type shape, none is returned if none are initialised.
 
const std::pair< GUI::ECS::Systems::ActiveShape, std::any > getActiveShape () const
 Get the Active Shape and it's type all contained in an std::pair.
 
const GUI::ECS::Systems::Colour getHoverColor () const
 Get the Hover Color of the shape.
 
const GUI::ECS::Systems::Colour getNormalColor () const
 Get the Normal Color of the shape.
 
const GUI::ECS::Systems::Colour getClickedColor () const
 Get the Clicked Color shape.
 
const std::pair< float, float > getPosition () const
 Get the Position of the shape.
 
const std::pair< float, float > getDimension () const
 Get the Dimension of the shape.
 
const std::pair< GUI::ECS::Systems::ActiveShape, std::any > getShape () const
 Get the Shape and it's type all packaged in an std::pair.
 
const GUI::ECS::Systems::Collision getCollision () const
 Get the Collision Component of the object.
 
const std::string getName () const
 Get the Name of the component.
 
const std::string getApplication () const
 Get the Application context of the component.
 
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.
 
const bool getVisible () const
 Get the info about if the shape is visible or not.
 
void update (const GUI::ECS::Systems::MouseInfo &mouse)
 Update the mouse information of the component (this is used for mouse collision calculations)
 
void update (const ShapeComponent &copy)
 Update the ShapeComponent using another shape component.
 
void clearShapes ()
 Remove all and any initialised shapes in the class, this will reset the type to NONE.
 
std::optional< std::pair< GUI::ECS::Systems::ActiveShape, std::any > > render () const
 Get an optional std::pair of the object so that it can be displayed on screen.
 
ShapeComponentoperator= (const ShapeComponent &copy)
 '=' operator in charge of allowing the user to seamlessly assing the content of one ShapeComponent to another.
 
- 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
 

Detailed Description

Manages shapes and their associated properties in the ECS framework.

Definition at line 47 of file ShapeComponent.hpp.

Constructor & Destructor Documentation

◆ ShapeComponent() [1/9]

GUI::ECS::Components::ShapeComponent::ShapeComponent ( const std::uint32_t entityId = 0)

Default constructor.

Parameters
entityIdThe ID of the entity this component belongs to.

Definition at line 16 of file ShapeComponent.cpp.

◆ ShapeComponent() [2/9]

GUI::ECS::Components::ShapeComponent::ShapeComponent ( const std::size_t pointCount,
const std::pair< float, float > & position = { 0,0 },
const GUI::ECS::Systems::Colour & normalColour = GUI::ECS::Systems::Colour::AliceBlue,
const GUI::ECS::Systems::Colour & hoverColour = GUI::ECS::Systems::Colour::White,
const GUI::ECS::Systems::Colour & clickedColour = GUI::ECS::Systems::Colour::CornflowerBlue,
const bool visible = true )

Constructs a convex shape.

Parameters
pointCountNumber of points for the convex shape.
positionPosition of the shape.
normalColourDefault color for the shape.
hoverColourColor when hovered.
clickedColourColor when clicked.
visibleVisibility status of the shape.

Definition at line 28 of file ShapeComponent.cpp.

◆ ShapeComponent() [3/9]

GUI::ECS::Components::ShapeComponent::ShapeComponent ( const std::size_t pointCount,
const float radius,
const std::pair< float, float > & position = { 0,0 },
const GUI::ECS::Systems::Colour & normalColour = GUI::ECS::Systems::Colour::AliceBlue,
const GUI::ECS::Systems::Colour & hoverColour = GUI::ECS::Systems::Colour::White,
const GUI::ECS::Systems::Colour & clickedColour = GUI::ECS::Systems::Colour::CornflowerBlue,
const bool visible = true )

Constructs a circle shape.

Parameters
pointCountNumber of points to render the circle.
radiusRadius of the circle.
positionPosition of the shape.
normalColourDefault color for the shape.
hoverColourColor when hovered.
clickedColourColor when clicked.
visibleVisibility status of the shape.

Definition at line 44 of file ShapeComponent.cpp.

◆ ShapeComponent() [4/9]

GUI::ECS::Components::ShapeComponent::ShapeComponent ( const std::pair< float, float > & size,
const std::pair< float, float > & position = { 0,0 },
const GUI::ECS::Systems::Colour & normalColour = GUI::ECS::Systems::Colour::AliceBlue,
const GUI::ECS::Systems::Colour & hoverColour = GUI::ECS::Systems::Colour::White,
const GUI::ECS::Systems::Colour & clickedColour = GUI::ECS::Systems::Colour::CornflowerBlue,
const bool visible = true )

Constructs a rectangle shape.

Parameters
sizeDimensions of the rectangle.
positionPosition of the shape.
normalColourDefault color for the shape.
hoverColourColor when hovered.
clickedColourColor when clicked.
visibleVisibility status of the shape.

Definition at line 59 of file ShapeComponent.cpp.

◆ ShapeComponent() [5/9]

GUI::ECS::Components::ShapeComponent::ShapeComponent ( const Recoded::FloatRect & rect,
const GUI::ECS::Systems::Colour & normalColour = GUI::ECS::Systems::Colour::AliceBlue,
const GUI::ECS::Systems::Colour & hoverColour = GUI::ECS::Systems::Colour::White,
const GUI::ECS::Systems::Colour & clickedColour = GUI::ECS::Systems::Colour::CornflowerBlue,
const bool visible = true )

Constructs a rectangle shape from a FloatRect.

Parameters
rectRectangle bounds.
normalColourDefault color for the shape.
hoverColourColor when hovered.
clickedColourColor when clicked.
visibleVisibility status of the shape.

Definition at line 74 of file ShapeComponent.cpp.

◆ ShapeComponent() [6/9]

GUI::ECS::Components::ShapeComponent::ShapeComponent ( const std::uint32_t entityId,
const std::size_t pointCount,
const std::pair< float, float > & position = { 0,0 },
const GUI::ECS::Systems::Colour & normalColour = GUI::ECS::Systems::Colour::AliceBlue,
const GUI::ECS::Systems::Colour & hoverColour = GUI::ECS::Systems::Colour::White,
const GUI::ECS::Systems::Colour & clickedColour = GUI::ECS::Systems::Colour::CornflowerBlue,
const bool visible = true )

Constructs a convex shape.

Parameters
entityIdThe ID of the entity this component belongs to.
pointCountNumber of points for the convex shape.
positionPosition of the shape.
normalColourDefault color for the shape.
hoverColourColor when hovered.
clickedColourColor when clicked.
visibleVisibility status of the shape.

Definition at line 88 of file ShapeComponent.cpp.

◆ ShapeComponent() [7/9]

GUI::ECS::Components::ShapeComponent::ShapeComponent ( const std::uint32_t entityId,
const std::size_t pointCount,
const float radius,
const std::pair< float, float > & position = { 0,0 },
const GUI::ECS::Systems::Colour & normalColour = GUI::ECS::Systems::Colour::AliceBlue,
const GUI::ECS::Systems::Colour & hoverColour = GUI::ECS::Systems::Colour::White,
const GUI::ECS::Systems::Colour & clickedColour = GUI::ECS::Systems::Colour::CornflowerBlue,
const bool visible = true )

Constructs a circle shape.

Parameters
entityIdThe ID of the entity this component belongs to.
pointCountNumber of points to render the circle.
radiusRadius of the circle.
positionPosition of the shape.
normalColourDefault color for the shape.
hoverColourColor when hovered.
clickedColourColor when clicked.
visibleVisibility status of the shape.

Definition at line 103 of file ShapeComponent.cpp.

◆ ShapeComponent() [8/9]

GUI::ECS::Components::ShapeComponent::ShapeComponent ( const std::uint32_t entityId,
const std::pair< float, float > & size,
const std::pair< float, float > & position = { 0,0 },
const GUI::ECS::Systems::Colour & normalColour = GUI::ECS::Systems::Colour::AliceBlue,
const GUI::ECS::Systems::Colour & hoverColour = GUI::ECS::Systems::Colour::White,
const GUI::ECS::Systems::Colour & clickedColour = GUI::ECS::Systems::Colour::CornflowerBlue,
const bool visible = true )

Constructs a rectangle shape.

Parameters
entityIdThe ID of the entity this component belongs to.
sizeDimensions of the rectangle.
positionPosition of the shape.
normalColourDefault color for the shape.
hoverColourColor when hovered.
clickedColourColor when clicked.
visibleVisibility status of the shape.

Definition at line 118 of file ShapeComponent.cpp.

◆ ShapeComponent() [9/9]

GUI::ECS::Components::ShapeComponent::ShapeComponent ( const std::uint32_t entityId,
const Recoded::FloatRect & rect,
const GUI::ECS::Systems::Colour & normalColour = GUI::ECS::Systems::Colour::AliceBlue,
const GUI::ECS::Systems::Colour & hoverColour = GUI::ECS::Systems::Colour::White,
const GUI::ECS::Systems::Colour & clickedColour = GUI::ECS::Systems::Colour::CornflowerBlue,
const bool visible = true )

Constructs a rectangle shape from a FloatRect.

Parameters
entityIdThe ID of the entity this component belongs to.
rectRectangle bounds.
normalColourDefault color for the shape.
hoverColourColor when hovered.
clickedColourColor when clicked.
visibleVisibility status of the shape.

Definition at line 133 of file ShapeComponent.cpp.

◆ ~ShapeComponent()

GUI::ECS::Components::ShapeComponent::~ShapeComponent ( )

Destructor.

Definition at line 148 of file ShapeComponent.cpp.

Member Function Documentation

◆ clearShapes()

void GUI::ECS::Components::ShapeComponent::clearShapes ( )

Remove all and any initialised shapes in the class, this will reset the type to NONE.

Definition at line 456 of file ShapeComponent.cpp.

◆ getActiveShape()

const std::pair< GUI::ECS::Systems::ActiveShape, std::any > GUI::ECS::Components::ShapeComponent::getActiveShape ( ) const

Get the Active Shape and it's type all contained in an std::pair.

Returns
const std::pair<GUI::ECS::Systems::ActiveShape, std::any>

Definition at line 324 of file ShapeComponent.cpp.

◆ getApplication()

const std::string GUI::ECS::Components::ShapeComponent::getApplication ( ) const

Get the Application context of the component.

Returns
const std::string

Definition at line 403 of file ShapeComponent.cpp.

◆ getClickedColor()

const GUI::ECS::Systems::Colour GUI::ECS::Components::ShapeComponent::getClickedColor ( ) const

Get the Clicked Color shape.

Returns
const GUI::ECS::Systems::Colour

Definition at line 372 of file ShapeComponent.cpp.

◆ getCollision()

const GUI::ECS::Systems::Collision GUI::ECS::Components::ShapeComponent::getCollision ( ) const

Get the Collision Component of the object.

Returns
const Collision
Note
This is an internal function used by the update function.

Definition at line 392 of file ShapeComponent.cpp.

◆ getDimension()

const std::pair< float, float > GUI::ECS::Components::ShapeComponent::getDimension ( ) const

Get the Dimension of the shape.

Returns
const std::pair<float, float>

Definition at line 382 of file ShapeComponent.cpp.

◆ getHoverColor()

const GUI::ECS::Systems::Colour GUI::ECS::Components::ShapeComponent::getHoverColor ( ) const

Get the Hover Color of the shape.

Returns
const GUI::ECS::Systems::Colour

Definition at line 362 of file ShapeComponent.cpp.

◆ getInfo()

const std::string GUI::ECS::Components::ShapeComponent::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.

Parameters
indentThe level to which the class should be indented in the dump.
Returns
const std::string The formatted output.

Definition at line 408 of file ShapeComponent.cpp.

◆ getName()

const std::string GUI::ECS::Components::ShapeComponent::getName ( ) const

Get the Name of the component.

Returns
const std::string

Definition at line 398 of file ShapeComponent.cpp.

◆ getNormalColor()

const GUI::ECS::Systems::Colour GUI::ECS::Components::ShapeComponent::getNormalColor ( ) const

Get the Normal Color of the shape.

Returns
const GUI::ECS::Systems::Colour

Definition at line 367 of file ShapeComponent.cpp.

◆ getPosition()

const std::pair< float, float > GUI::ECS::Components::ShapeComponent::getPosition ( ) const

Get the Position of the shape.

Returns
const std::pair<float, float>

Definition at line 377 of file ShapeComponent.cpp.

◆ getShape()

const std::pair< GUI::ECS::Systems::ActiveShape, std::any > GUI::ECS::Components::ShapeComponent::getShape ( ) const

Get the Shape and it's type all packaged in an std::pair.

Returns
const std::pair<GUI::ECS::Systems::ActiveShape, std::any>

Definition at line 387 of file ShapeComponent.cpp.

◆ getShapeType()

const GUI::ECS::Systems::ActiveShape GUI::ECS::Components::ShapeComponent::getShapeType ( ) const

Get the Shape Type shape, none is returned if none are initialised.

Returns
const GUI::ECS::Systems::ActiveShape

Definition at line 314 of file ShapeComponent.cpp.

◆ getShapeTypeString()

const std::string GUI::ECS::Components::ShapeComponent::getShapeTypeString ( ) const

Get the Shape Type shape, none is returned if none are initialised.

Returns
const std::string the text version of the shape type.

Definition at line 319 of file ShapeComponent.cpp.

◆ getVisible()

const bool GUI::ECS::Components::ShapeComponent::getVisible ( ) const

Get the info about if the shape is visible or not.

Returns
true the object is visible
false the object is hidden
Note
This is an internal function used by the update function, please call isVisible to get this information.

Definition at line 429 of file ShapeComponent.cpp.

◆ isShapeInitialised()

const bool GUI::ECS::Components::ShapeComponent::isShapeInitialised ( ) const

Know if there is a shape initialised or not.

Returns
true the shape is initialised
false the shape is not initialised

Definition at line 303 of file ShapeComponent.cpp.

◆ isVisible()

const bool GUI::ECS::Components::ShapeComponent::isVisible ( ) const

Get the visibility status of the component.

Returns
true the component is visible
false the component is hidden

Definition at line 298 of file ShapeComponent.cpp.

◆ operator=()

GUI::ECS::Components::ShapeComponent & GUI::ECS::Components::ShapeComponent::operator= ( const ShapeComponent & copy)

'=' operator in charge of allowing the user to seamlessly assing the content of one ShapeComponent to another.

Parameters
copy
Returns
ShapeComponent&

Definition at line 506 of file ShapeComponent.cpp.

◆ render()

std::optional< std::pair< GUI::ECS::Systems::ActiveShape, std::any > > GUI::ECS::Components::ShapeComponent::render ( ) const

Get an optional std::pair of the object so that it can be displayed on screen.

Returns
std::optional<std::pair<GUI::ECS::Systems::ActiveShape, std::any>>
Note
This is an internal function meant to be called by the draw function from the Window component.

Definition at line 467 of file ShapeComponent.cpp.

◆ setApplication()

void GUI::ECS::Components::ShapeComponent::setApplication ( const std::string & application)

Set the Application context of the component.

Parameters
application

Definition at line 284 of file ShapeComponent.cpp.

◆ setClickedColor()

void GUI::ECS::Components::ShapeComponent::setClickedColor ( const GUI::ECS::Systems::Colour & clickedColor)

Sets the clicked color for the shape.

Parameters
clickedColorThe new clicked color.

Definition at line 160 of file ShapeComponent.cpp.

◆ setCollision()

void GUI::ECS::Components::ShapeComponent::setCollision ( const GUI::ECS::Systems::Collision & collision)

Set the internal collision class using another Collision component.

Parameters
collisionThe collision component to query the data from.

Definition at line 270 of file ShapeComponent.cpp.

◆ setDimension()

void GUI::ECS::Components::ShapeComponent::setDimension ( const std::pair< float, float > dimension)

Set the Dimension object.

Parameters
dimensionan std::pair<float, float> representing the dimensions of the component

Definition at line 265 of file ShapeComponent.cpp.

◆ setHoverColor()

void GUI::ECS::Components::ShapeComponent::setHoverColor ( const GUI::ECS::Systems::Colour & hoverColor)

Sets the hover color for the shape.

Parameters
hoverColorThe new hover color.

Definition at line 150 of file ShapeComponent.cpp.

◆ setName()

void GUI::ECS::Components::ShapeComponent::setName ( const std::string & name)

Set the Name of the component.

Parameters
name

Definition at line 279 of file ShapeComponent.cpp.

◆ setNormalColor()

void GUI::ECS::Components::ShapeComponent::setNormalColor ( const GUI::ECS::Systems::Colour & normalColor)

Sets the normal color for the shape.

Parameters
normalColorThe new normal color.

Definition at line 155 of file ShapeComponent.cpp.

◆ setPosition()

void GUI::ECS::Components::ShapeComponent::setPosition ( const std::pair< float, float > position)

Set the position of the component.

Parameters
positionan std::pair<float, float> representing the position of the component

Definition at line 257 of file ShapeComponent.cpp.

◆ setShape() [1/7]

void GUI::ECS::Components::ShapeComponent::setShape ( const GUI::ECS::Systems::ActiveShape & type)

Set the type of the object (this does not initialise the component)

Parameters
typeThe type of the object

Definition at line 218 of file ShapeComponent.cpp.

◆ setShape() [2/7]

void GUI::ECS::Components::ShapeComponent::setShape ( const GUI::ECS::Systems::ActiveShape & type,
const std::any & shape )

Set the shape based on the type and an existing instance of a shape.

Parameters
typeThe type of shape
shapeThe instance of the shape
Exceptions
CustomExceptions::InvalidShapeif the provided shape was not found

Definition at line 224 of file ShapeComponent.cpp.

◆ setShape() [3/7]

void GUI::ECS::Components::ShapeComponent::setShape ( const Recoded::FloatRect & rect)

Create a rectangle based on an Recoded::FloatRect.

Parameters
rectA rectangle component representing the dimensions of a rectangle.
Note
Any previous shapes will be cleared and a rectangle will take their place.

Definition at line 202 of file ShapeComponent.cpp.

◆ setShape() [4/7]

void GUI::ECS::Components::ShapeComponent::setShape ( const std::pair< float, float > & size)

Create a rectangle.

Parameters
size
Note
Any previous shapes will be cleared and a rectangle will take their place.

Definition at line 187 of file ShapeComponent.cpp.

◆ setShape() [5/7]

void GUI::ECS::Components::ShapeComponent::setShape ( const std::pair< GUI::ECS::Systems::ActiveShape, std::any > & shape)

Set the Shape object based on a pair made of the shape type and shape instance.

Parameters
shapestd::pair<GUI::ECS::Systems::ActiveShape, std::any>

Definition at line 247 of file ShapeComponent.cpp.

◆ setShape() [6/7]

void GUI::ECS::Components::ShapeComponent::setShape ( const std::size_t pointCount)

Create a convex shape.

Parameters
pointCountCreate a shape based on the number of points being inputted
Note
Any previous shapes will be cleared and a convex will take their place.

Definition at line 165 of file ShapeComponent.cpp.

◆ setShape() [7/7]

void GUI::ECS::Components::ShapeComponent::setShape ( const std::size_t pointCount,
const float radius )

Create a circle.

Parameters
pointCountThe number of points used to render the circle
radiusThe radius of the circle
Note
Any previous shapes will be cleared and a circle will take their place.

Definition at line 176 of file ShapeComponent.cpp.

◆ setVisible()

void GUI::ECS::Components::ShapeComponent::setVisible ( const bool visible)

Set the visible toggle informing the program if it should (or not) render the component.

Parameters
visible

Definition at line 252 of file ShapeComponent.cpp.

◆ toggleVisibility()

void GUI::ECS::Components::ShapeComponent::toggleVisibility ( )

Toggles the visibility of the shape.

Definition at line 289 of file ShapeComponent.cpp.

◆ update() [1/2]

void GUI::ECS::Components::ShapeComponent::update ( const GUI::ECS::Systems::MouseInfo & mouse)

Update the mouse information of the component (this is used for mouse collision calculations)

Parameters
mouse

Definition at line 434 of file ShapeComponent.cpp.

◆ update() [2/2]

void GUI::ECS::Components::ShapeComponent::update ( const ShapeComponent & copy)

Update the ShapeComponent using another shape component.

Parameters
copy

Definition at line 442 of file ShapeComponent.cpp.


The documentation for this class was generated from the following files: