C++ Project 2016-2017: Arkanoid
Public Member Functions | Static Public Member Functions | List of all members
arkanoidSFML::Transformation Class Reference

Singleton: This class provides a method to convert screen pixels to their corresponding coordinates in the game world space. More...

#include <transformation.h>

Public Member Functions

arkanoid::Vector2D convertVector (const sf::Vector2f &vector)
 
double convertX (double x)
 
double convertY (double y)
 

Static Public Member Functions

static TransformationgetInstance ()
 
static TransformationgetInstance (double gridWidth, double gridHeight, double windowWidth, double windowHeight)
 

Detailed Description

Singleton: This class provides a method to convert screen pixels to their corresponding coordinates in the game world space.

Definition at line 17 of file transformation.h.

Member Function Documentation

◆ convertVector()

arkanoid::Vector2D arkanoidSFML::Transformation::convertVector ( const sf::Vector2f &  vector)

Converts a screen pixel to their corresponding game world coordinate.

Parameters
vectorThe arkanoid::Vector2D (on screen) that needs to converted to the game world space.
Returns
The converted screen pixels (of the game window) as a arkanoid::Vector2D.

Definition at line 37 of file transformation.cpp.

◆ convertX()

double arkanoidSFML::Transformation::convertX ( double  x)

Converts an 'x' to their corresponding game world 'x'.

Parameters
xThe 'x' component (on screen) that needs to converted to the game world space.
Returns
The corresponding 'x' in the game world space.

Definition at line 41 of file transformation.cpp.

◆ convertY()

double arkanoidSFML::Transformation::convertY ( double  y)

Converts an 'y' to their corresponding game world 'y'.

Parameters
yThe 'y' component (on screen) that needs to converted to the game world space.
Returns
The corresponding 'y' in the game world space.

Definition at line 45 of file transformation.cpp.

◆ getInstance() [1/2]

Transformation * arkanoidSFML::Transformation::getInstance ( )
static

Get an instance of the Transformation object.

Returns
An instance of the Transformation object.

Definition at line 21 of file transformation.cpp.

◆ getInstance() [2/2]

Transformation * arkanoidSFML::Transformation::getInstance ( double  gridWidth,
double  gridHeight,
double  windowWidth,
double  windowHeight 
)
static

Get an instance of the Transformation object.

Parameters
gridWidthThe width of the grid.
gridHeightThe height of the grid.
windowWidthThe width of the screen (game window).
windowHeightThe height of the screen (game window).
Returns
An instance of the Transformation object.

Definition at line 29 of file transformation.cpp.


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