Civilization
Public Member Functions | List of all members
client::TextureDisplayer Class Reference

class TextureDisplayer - More...

#include <TextureDisplayer.hpp>

Public Member Functions

 TextureDisplayer (const std::string &pathImage)
 Constructor. More...
 
sf::Sprite & getSprite (unsigned index=0)
 Get a particular sprite. More...
 
int getWidth ()
 Get the Width of the texture.
 
int getHeight ()
 Get the Height of the texture.
 
unsigned getSize ()
 Get the number of sprite in a TextureDisplayer.
 
void addSprite ()
 Add a Sprite with the texture to the TextureDisplayer.
 
void setSpritePosition (int index, int x, int y, int xOffset, int yOffset, std::array< int, 2 > hexSize)
 Set a particular Sprite Position. More...
 
void setHudSpritePosition (float scale, int windowLength, int windowWidth, int rotation=0, int priorityCardIndex=0)
 Set the position of all the HUD (barbareWheel, ladder, techWheel, priorityCard, actionCard) considering the type of the HUD. More...
 
void moveSpritePosition (int xOffset, int yOffset)
 Move the sprite Position. More...
 
void setImageType (HudTextureType imageType)
 
void clearSprites ()
 Delete all sprites.
 
void drawTextureDisplayerSprite (std::shared_ptr< sf::RenderWindow > window)
 draw all the sprites of a TextureDisplayer More...
 

Detailed Description

class TextureDisplayer -

Constructor & Destructor Documentation

◆ TextureDisplayer()

TextureDisplayer::TextureDisplayer ( const std::string &  filename)

Constructor.

Constructor of TextureDisplayer class

Parameters
filenamename of the png path

Member Function Documentation

◆ drawTextureDisplayerSprite()

void TextureDisplayer::drawTextureDisplayerSprite ( std::shared_ptr< sf::RenderWindow >  window)

draw all the sprites of a TextureDisplayer

Parameters
windowwindow where the sprites are displayed

◆ getSprite()

sf::Sprite & TextureDisplayer::getSprite ( unsigned  index = 0)

Get a particular sprite.

Parameters
indexis the position of the sprite in the textureDisplayer list of Sprite

◆ moveSpritePosition()

void TextureDisplayer::moveSpritePosition ( int  xOffset,
int  yOffset 
)

Move the sprite Position.

Parameters
xOffsetis the X offset of the map in the screen
yOffsetis the Y offset of the map in the screen

◆ setHudSpritePosition()

void TextureDisplayer::setHudSpritePosition ( float  scale,
int  windowLength,
int  windowWidth,
int  rotation = 0,
int  index = 0 
)

Set the position of all the HUD (barbareWheel, ladder, techWheel, priorityCard, actionCard) considering the type of the HUD.

Parameters
scalescale to set the size of the hud image(1 by default if the windowLength is 1600)
windowLengthwindow length (1600 by default)
windowWidthwindow width (900 by default)
rotationrotation of the image (0 by default), usefull for the techWheel
indexindex of the priorityCard to set the x position of each priorityCard

◆ setSpritePosition()

void TextureDisplayer::setSpritePosition ( int  index,
int  x,
int  y,
int  xOffset,
int  yOffset,
std::array< int, 2 >  hexSize 
)

Set a particular Sprite Position.

Parameters
indexis the index position of the sprite
xis the X position of the sprite in the Map
yis the Y position of the sprite in the Map
xOffsetis the X offset of the map in the screen
yOffsetis the Y offset of the map in the screen
hexSizeis the size of an hexagon, it is used to place element on the Map

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