My Project
Public Member Functions | List of all members
rtype::GraphicalLib Class Reference

GraphicalLib class. More...

#include <GraphicalLib.hpp>

Inheritance diagram for rtype::GraphicalLib:
rtype::IGraphicalLib

Public Member Functions

 GraphicalLib ()
 Construct a new Graphical Lib object. More...
 
 ~GraphicalLib ()
 Destroy the Graphical Lib object. More...
 
void initWindow (const int screenWidth, const int screenHeight, std::string title, const int framerate) override
 A method to initialize a window object. More...
 
void closeWindow () override
 A method to close a window. More...
 
void clearScreen () override
 Clear the window. More...
 
void startDrawingWindow () override
 Start drawing in the window. More...
 
void endDrawingWindow () override
 Stop drawing in the window. More...
 
bool windowShouldClose () override
 Check if the window should close. More...
 
void drawSprite (MyTexture const &texture, std::array< float, 4 > const &rectSource, std::array< float, 4 > const &rectDest, std::pair< float, float > const &origin, float const &rotation, float const &scale) override
 A method to draw a sprite. More...
 
bool checkMouseCollision (Position const &position, float const &x, float const &y, float const &height, float const &width) override
 A method to check a collison between the mouse and a rectangle. More...
 
bool IsLeftMouseButtonPressed () override
 A method to check if the left mouse button is pressed. More...
 
bool IsLeftMouseButtonReleased () override
 A method to check if the left mouse button is released. More...
 
Position getMousePosition () override
 Get the Mouse Position object. More...
 
Color createColor (std::array< float, 4 > const &array) override
 Create a Color object. More...
 
void drawText (std::string const &text, Position const &pos, std::size_t const &fontSize, std::array< float, 4 > const &color) override
 A method to draw a text. More...
 
void initAudio () override
 A method to init the audio devide. More...
 
void closeAudio () override
 A method to close the audio device. More...
 
void playASound (MySound &sound) override
 A method to play a sound. More...
 
void playASoundMulti (MySound &sound) override
 Play a sound with a multichannel buffer pool. More...
 
void playAMusic (MyMusic &music) override
 A method to load a sound. More...
 
void updateAMusic (MyMusic &music) override
 A method to update the music. More...
 
float getMusicVolume (MyMusic &music) override
 
void setMusicVolume (MyMusic &music, float volume) override
 
bool hasBeenPressed (int key) override
 Check if a key has been pressed. More...
 
bool isBeingPressed (int key) override
 Check if a key is being pressed. More...
 
bool hasBeenReleased (int key) override
 Check if a key has been released. More...
 
bool isNotBeingPressed (int key) override
 Check if a key is not being pressed. More...
 
void setExitKey (int key) override
 Set the Exit Key object. More...
 
int getPressedKeycode () override
 Get the Pressed Keycode object. More...
 
int getPressedCharcode () override
 Get the Pressed Charcode object. More...
 
- Public Member Functions inherited from rtype::IGraphicalLib
virtual ~IGraphicalLib ()=default
 Destroy the IGraphicalLib object.
 

Detailed Description

GraphicalLib class.

Constructor & Destructor Documentation

◆ GraphicalLib()

rtype::GraphicalLib::GraphicalLib ( )

Construct a new Graphical Lib object.

◆ ~GraphicalLib()

rtype::GraphicalLib::~GraphicalLib ( )

Destroy the Graphical Lib object.

Member Function Documentation

◆ checkMouseCollision()

bool rtype::GraphicalLib::checkMouseCollision ( Position const &  position,
float const &  x,
float const &  y,
float const &  height,
float const &  width 
)
overridevirtual

A method to check a collison between the mouse and a rectangle.

Parameters
positionposition of the mouse
xx position of the rectangle
yy position of the rectangle
heightheight of the rectangle
widthwidth of the rectangle
Returns
true returns true if there is a collision
false returns false if there is no collision

Implements rtype::IGraphicalLib.

◆ clearScreen()

void rtype::GraphicalLib::clearScreen ( )
overridevirtual

Clear the window.

Implements rtype::IGraphicalLib.

◆ closeAudio()

void rtype::GraphicalLib::closeAudio ( )
overridevirtual

A method to close the audio device.

Implements rtype::IGraphicalLib.

◆ closeWindow()

void rtype::GraphicalLib::closeWindow ( )
overridevirtual

A method to close a window.

Implements rtype::IGraphicalLib.

◆ createColor()

Color rtype::GraphicalLib::createColor ( std::array< float, 4 > const &  array)
overridevirtual

Create a Color object.

Parameters
arraycorrespond to the red, green, blue and alpha values
Returns
Color return the color created

Implements rtype::IGraphicalLib.

◆ drawSprite()

void rtype::GraphicalLib::drawSprite ( MyTexture const &  texture,
std::array< float, 4 > const &  rectSource,
std::array< float, 4 > const &  rectDest,
std::pair< float, float > const &  origin,
float const &  rotation,
float const &  scale 
)
overridevirtual

A method to draw a sprite.

Parameters
texturetexture of the sprite
rectSourcerectangle source of the sprite
rectDestrectangle destination of the sprite
originorigin of the sprite
rotationrotation of the sprite
scalescale of the sprite

Implements rtype::IGraphicalLib.

◆ drawText()

void rtype::GraphicalLib::drawText ( std::string const &  text,
Position const &  pos,
std::size_t const &  fontSize,
std::array< float, 4 > const &  color 
)
overridevirtual

A method to draw a text.

Parameters
texttext to draw
posposition of the text
fontSizesize of the text
colorcolor of the text

Implements rtype::IGraphicalLib.

◆ endDrawingWindow()

void rtype::GraphicalLib::endDrawingWindow ( )
overridevirtual

Stop drawing in the window.

Implements rtype::IGraphicalLib.

◆ getMousePosition()

Position rtype::GraphicalLib::getMousePosition ( )
overridevirtual

Get the Mouse Position object.

Returns
Position

Implements rtype::IGraphicalLib.

◆ getPressedCharcode()

int rtype::GraphicalLib::getPressedCharcode ( )
overridevirtual

Get the Pressed Charcode object.

Returns
int

Implements rtype::IGraphicalLib.

◆ getPressedKeycode()

int rtype::GraphicalLib::getPressedKeycode ( )
overridevirtual

Get the Pressed Keycode object.

Returns
int

Implements rtype::IGraphicalLib.

◆ hasBeenPressed()

bool rtype::GraphicalLib::hasBeenPressed ( int  key)
overridevirtual

Check if a key has been pressed.

Parameters
key
Returns
true
false

Implements rtype::IGraphicalLib.

◆ hasBeenReleased()

bool rtype::GraphicalLib::hasBeenReleased ( int  key)
overridevirtual

Check if a key has been released.

Parameters
key
Returns
true
false

Implements rtype::IGraphicalLib.

◆ initAudio()

void rtype::GraphicalLib::initAudio ( )
overridevirtual

A method to init the audio devide.

Implements rtype::IGraphicalLib.

◆ initWindow()

void rtype::GraphicalLib::initWindow ( const int  screenWidth,
const int  screenHeight,
std::string  title,
const int  framerate 
)
overridevirtual

A method to initialize a window object.

Parameters
screenWidthwidth of the window
screenHeightheight of the window
titletitle of the window
framerateframerate of the window

Implements rtype::IGraphicalLib.

◆ isBeingPressed()

bool rtype::GraphicalLib::isBeingPressed ( int  key)
overridevirtual

Check if a key is being pressed.

Parameters
key
Returns
true
false

Implements rtype::IGraphicalLib.

◆ IsLeftMouseButtonPressed()

bool rtype::GraphicalLib::IsLeftMouseButtonPressed ( )
overridevirtual

A method to check if the left mouse button is pressed.

Returns
true returns true if the left mouse button is pressed
false returns false if the left mouse button is not pressed

Implements rtype::IGraphicalLib.

◆ IsLeftMouseButtonReleased()

bool rtype::GraphicalLib::IsLeftMouseButtonReleased ( )
overridevirtual

A method to check if the left mouse button is released.

Returns
true returns true if the left mouse button is released
false returns false if the left mouse button is not released

Implements rtype::IGraphicalLib.

◆ isNotBeingPressed()

bool rtype::GraphicalLib::isNotBeingPressed ( int  key)
overridevirtual

Check if a key is not being pressed.

Parameters
key
Returns
true
false

Implements rtype::IGraphicalLib.

◆ playAMusic()

void rtype::GraphicalLib::playAMusic ( MyMusic music)
overridevirtual

A method to load a sound.

Parameters
musicmusic to load

Implements rtype::IGraphicalLib.

◆ playASound()

void rtype::GraphicalLib::playASound ( MySound sound)
overridevirtual

A method to play a sound.

Parameters
soundsound to play

Implements rtype::IGraphicalLib.

◆ playASoundMulti()

void rtype::GraphicalLib::playASoundMulti ( MySound sound)
overridevirtual

Play a sound with a multichannel buffer pool.

Parameters
soundSound to play

Implements rtype::IGraphicalLib.

◆ setExitKey()

void rtype::GraphicalLib::setExitKey ( int  key)
overridevirtual

Set the Exit Key object.

Parameters
key

Implements rtype::IGraphicalLib.

◆ startDrawingWindow()

void rtype::GraphicalLib::startDrawingWindow ( )
overridevirtual

Start drawing in the window.

Implements rtype::IGraphicalLib.

◆ updateAMusic()

void rtype::GraphicalLib::updateAMusic ( MyMusic music)
overridevirtual

A method to update the music.

Parameters
musicmusic to update

Implements rtype::IGraphicalLib.

◆ windowShouldClose()

bool rtype::GraphicalLib::windowShouldClose ( )
overridevirtual

Check if the window should close.

Returns
true
false

Implements rtype::IGraphicalLib.


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