Dualie
Loading...
Searching...
No Matches
dl::Shape Class Reference

The base class for any shape. More...

#include <Shape.hpp>

Inheritance diagram for dl::Shape:
Collaboration diagram for dl::Shape:

Public Member Functions

void setFillColor (const dl::Color &color)
 Sets the fill color of the shape.
 
void setOutlineColor (const dl::Color &color)
 Sets the outline color of the shape.
 
void setOutlineThickness (float thickness)
 Sets the outline thickness of the shape.
 
void setOrigin (const dl::Vector2f &origin)
 Sets the origin of the shape. The default origin is (0,0) and is the top left pixel of the shape bounds. Setting the origin can affect where the shape is drawn. For instance, setting the origin to be half the shape size will cause the shape to be centered on its position.
 
void setOrigin (float x, float y)
 Sets the origin of the shape. The default origin is (0,0) and is the top left pixel of the shape bounds. Setting the origin can affect where the shape is drawn. For instance, setting the origin to be half the shape size will cause the shape to be centered on its position.
 
const dl::Vector2fgetSize ()
 
const dl::Vector2fgetOrigin ()
 
dl::FloatRect getLocalBounds ()
 
dl::FloatRect getGlobalBounds ()
 
const ColorgetFillColor () const
 
const ColorgetOutlineColor () const
 
const float & getOutlineThickness ()
 
- Public Member Functions inherited from dl::Transformable
virtual void setPosition (const dl::Vector2f &position)
 Sets the position of the transformable.
 
void setPosition (float x, float y)
 Sets the position of the transformable.
 
virtual void move (const dl::Vector2f &offset)
 Moves the transformable offset number of pixels.
 
void move (float xOffset, float yOffset)
 Moves the transformable offset number of pixels.
 
const dl::Vector2fgetPosition () const
 
- Public Member Functions inherited from dl::Drawable
void viewShouldAffect (bool effective)
 Set whether the current view should affect the position of the drawable. Otherwise, its position on the screen will be absolute.
 
void setDepth (float depth)
 Sets the depth of the drawable for 3d. This simply corresponds to the X offset calculated for the 2 separate top screens. Larger objects will require a deeper depth for the 3d effect to be noticable. A positive value will cause the drawable to sink into the screen, while a negative value will cause it to pop out.
 
const float & getDepth () const
 
virtual void draw (const dl::Vector2f &viewOffset)=0
 Draws the drawable to the screen.
 

Protected Attributes

dl::Color m_fillColor
 
dl::Color m_outlineColor
 
float m_outlineThickness
 
dl::Vector2f m_origin
 
dl::Vector2f m_size
 
- Protected Attributes inherited from dl::Transformable
dl::Vector2f m_position
 
- Protected Attributes inherited from dl::Drawable
bool m_bViewDoesAffect = true
 
float m_depth = 0.0f
 

Detailed Description

The base class for any shape.

Member Function Documentation

◆ getFillColor()

const dl::Color & dl::Shape::getFillColor ( ) const
Returns
The fill color of the shape

◆ getGlobalBounds()

dl::FloatRect dl::Shape::getGlobalBounds ( )
Returns
The global bounds (Affected by position) of the shape in pixels as a FloatRect

◆ getLocalBounds()

dl::FloatRect dl::Shape::getLocalBounds ( )
Returns
The local bounds (Not affected by position) of the shape in pixels as a FloatRect

◆ getOrigin()

const dl::Vector2f & dl::Shape::getOrigin ( )
Returns
The origin in pixels

◆ getOutlineColor()

const dl::Color & dl::Shape::getOutlineColor ( ) const
Returns
The outline color of the shape

◆ getOutlineThickness()

const float & dl::Shape::getOutlineThickness ( )
Returns
The outline thickness of the shape

◆ getSize()

const dl::Vector2f & dl::Shape::getSize ( )
Returns
The size in pixels

◆ setFillColor()

void dl::Shape::setFillColor ( const dl::Color & color)

Sets the fill color of the shape.

Parameters
colorThe color to fill with

◆ setOrigin() [1/2]

void dl::Shape::setOrigin ( const dl::Vector2f & origin)

Sets the origin of the shape. The default origin is (0,0) and is the top left pixel of the shape bounds. Setting the origin can affect where the shape is drawn. For instance, setting the origin to be half the shape size will cause the shape to be centered on its position.

Parameters
originThe origin in pixels

◆ setOrigin() [2/2]

void dl::Shape::setOrigin ( float x,
float y )

Sets the origin of the shape. The default origin is (0,0) and is the top left pixel of the shape bounds. Setting the origin can affect where the shape is drawn. For instance, setting the origin to be half the shape size will cause the shape to be centered on its position.

Parameters
xThe origin in pixels (X)
yThe origin in pixels (Y)

◆ setOutlineColor()

void dl::Shape::setOutlineColor ( const dl::Color & color)

Sets the outline color of the shape.

Parameters
colorThe color to outline with

◆ setOutlineThickness()

void dl::Shape::setOutlineThickness ( float thickness)

Sets the outline thickness of the shape.

Parameters
thicknessThe outline thickness in pixels

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