R-TYPE
Public Member Functions | List of all members
InitSfml Class Reference

#include <InitSfml.hpp>

Public Member Functions

 InitSfml (int widthWindow=1920, int heightWindow=1080, const std::string &nameWindow="R-Type")
 
 ~InitSfml ()=default
 
std::shared_ptr< sf::RenderWindow > getWindow ()
 
sf::Event & getEvent ()
 
void setTexture (std::string idTexture, std::string namePath)
 
std::shared_ptr< sf::Texture > getTexture (std::string idTexture) const
 
std::map< std::string, std::shared_ptr< sf::Texture > > getAllTexture ()
 
void setFont (std::string idFont, std::string namePath)
 
std::shared_ptr< sf::Font > getFont (std::string idFont) const
 
std::map< std::string, std::shared_ptr< sf::Font > > getAllFont ()
 
int getWidthWindow ()
 
int getHeightWindow ()
 
void clear ()
 
void display ()
 

Constructor & Destructor Documentation

◆ InitSfml()

InitSfml::InitSfml ( int  widthWindow = 1920,
int  heightWindow = 1080,
const std::string &  nameWindow = "R-Type" 
)

It creates a window with the given width, height and name

Parameters
widthWindowThe width of the window
heightWindowThe height of the window
nameWindowThe name of the window

◆ ~InitSfml()

InitSfml::~InitSfml ( )
default

Member Function Documentation

◆ clear()

void InitSfml::clear ( )

It clears the window.

◆ display()

void InitSfml::display ( )

It displays the window

◆ getAllFont()

std::map< std::string, std::shared_ptr< sf::Font > > InitSfml::getAllFont ( )

◆ getAllTexture()

std::map< std::string, std::shared_ptr< sf::Texture > > InitSfml::getAllTexture ( )

This function returns a map of all the textures that have been loaded into the game

Returns
A map of string and shared_ptr of sf::Texture

◆ getEvent()

sf::Event & InitSfml::getEvent ( )

It returns a reference to the event object

Returns
The event.

◆ getFont()

std::shared_ptr< sf::Font > InitSfml::getFont ( std::string  idFont) const

◆ getHeightWindow()

int InitSfml::getHeightWindow ( )

Get the height of the window.

Returns
The height of the window.

◆ getTexture()

std::shared_ptr< sf::Texture > InitSfml::getTexture ( std::string  idTexture) const

If the texture exists, return it, else return nullptr

Parameters
idTextureThe id of the texture you want to get.
Returns
A pointer to a texture.

◆ getWidthWindow()

int InitSfml::getWidthWindow ( )

Get the width of the window.

Returns
The width of the window.

◆ getWindow()

std::shared_ptr< sf::RenderWindow > InitSfml::getWindow ( )

This function returns a pointer to the window.

Returns
A pointer to a shared pointer to a RenderWindow object.

◆ setFont()

void InitSfml::setFont ( std::string  idFont,
std::string  namePath 
)

It loads a font from a file

Parameters
namePathThe path to the font file.

◆ setTexture()

void InitSfml::setTexture ( std::string  idTexture,
std::string  namePath 
)

It takes an id and a path to a texture, loads the texture from the path, and then adds it to the texture list

Parameters
idTextureThe name of the texture.
namePathThe path to the texture file.

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