Public Types | Public Member Functions | List of all members
ime::Grid2DRenderer Class Reference

Defines the render properties of a Grid2D. More...

#include <Grid2DRenderer.h>

Public Types

using Callback = std::function< void(const Property &)>
 Property change callback. More...
 

Public Member Functions

 Grid2DRenderer ()
 Default constructor. More...
 
void setBackgroundTexture (const std::string &filename)
 Set the background texture of the grid. More...
 
void setTileColour (const Colour &colour)
 Set the colour of the grid tiles. More...
 
Colour getTileColour () const
 Get the colour of the grid tile. More...
 
void setCollidableTileColour (const Colour &colour)
 Set the colour of a tile when it is collidable. More...
 
Colour getCollidableTileColour () const
 Get the colour of a grid tile when it is collidable. More...
 
void setGridLineColour (const Colour &colour)
 Set the colour of the grid lines. More...
 
Colour getGridLineColour () const
 Get the colour of the grid lines. More...
 
void setVisible (bool visible)
 Show or hide the grid. More...
 
bool isVisible () const
 Check if the grid is visible or not. More...
 
void toggleVisibility ()
 Toggle the visibility of the grid. More...
 
void onPropertyChange (const Callback &callback)
 

Detailed Description

Defines the render properties of a Grid2D.

This class determines how a grid looks

Definition at line 41 of file Grid2DRenderer.h.

Member Typedef Documentation

◆ Callback

using ime::Grid2DRenderer::Callback = std::function<void(const Property&)>

Property change callback.

Definition at line 43 of file Grid2DRenderer.h.

Constructor & Destructor Documentation

◆ Grid2DRenderer()

ime::Grid2DRenderer::Grid2DRenderer ( )

Default constructor.

Member Function Documentation

◆ getCollidableTileColour()

Colour ime::Grid2DRenderer::getCollidableTileColour ( ) const

Get the colour of a grid tile when it is collidable.

Returns
The colour of a collidable tile
See also
setCollidableTileColour

◆ getGridLineColour()

Colour ime::Grid2DRenderer::getGridLineColour ( ) const

Get the colour of the grid lines.

Returns
The colour of the grid lines
See also
setGridLineColour

◆ getTileColour()

Colour ime::Grid2DRenderer::getTileColour ( ) const

Get the colour of the grid tile.

Returns
The colour of the grid tile
See also
setTileColour

◆ isVisible()

bool ime::Grid2DRenderer::isVisible ( ) const

Check if the grid is visible or not.

Returns
True if the grid is visible, otherwise false
See also
setVisible

◆ setBackgroundTexture()

void ime::Grid2DRenderer::setBackgroundTexture ( const std::string &  filename)

Set the background texture of the grid.

Parameters
filenameThe file name of the texture to be set
Exceptions
FileNotFoundExceptionif the specified file cannot be loaded from the disk

◆ setCollidableTileColour()

void ime::Grid2DRenderer::setCollidableTileColour ( const Colour colour)

Set the colour of a tile when it is collidable.

Parameters
colourThe colour to set

When the tile is no longer collidable, it will be set to the normal tile colour

See also
getCollidableTileColour

◆ setGridLineColour()

void ime::Grid2DRenderer::setGridLineColour ( const Colour colour)

Set the colour of the grid lines.

Parameters
colourThe colour of the grid lines
See also
getGridLineColour

◆ setTileColour()

void ime::Grid2DRenderer::setTileColour ( const Colour colour)

Set the colour of the grid tiles.

Parameters
colourThe new colour of the grid tiles
See also
getTileColour

◆ setVisible()

void ime::Grid2DRenderer::setVisible ( bool  visible)

Show or hide the grid.

Parameters
visibleTrue to show it or false to hide it

By default, the grid is visible

See also
isVisible

◆ toggleVisibility()

void ime::Grid2DRenderer::toggleVisibility ( )

Toggle the visibility of the grid.

This function will show the grid if it is currently visible or hide it if its currently visible

See also
setVisible, isVisible

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