Gamedev Framework (gf) 1.2.0
A C++17 framework for 2D games
Public Member Functions | List of all members
gf::Coordinates Class Reference

Helper to compute coordinates in HUD. More...

#include <gf/Coordinates.h>

Public Member Functions

 Coordinates (Vector2i size)
 Constructor with size. More...
 
 Coordinates (RenderTarget &target)
 Constructor with render target. More...
 
Vector2f getWindowSize () const
 Get the size of the window. More...
 
Vector2f getCenter () const
 Get the center of the window. More...
 
Vector2f getRelativePoint (Vector2f percent) const
 Compute a relative point. More...
 
Vector2f getRelativeSize (Vector2f percent) const
 Compute a relative size. More...
 
unsigned getRelativeCharacterSize (float percent) const
 Compute a relative character size. More...
 
Vector2f getAbsolutePoint (Vector2f distance, Anchor anchor) const
 Compute an absolute point. More...
 

Detailed Description

Helper to compute coordinates in HUD.

Constructor & Destructor Documentation

◆ Coordinates() [1/2]

gf::Coordinates::Coordinates ( Vector2i  size)

Constructor with size.

Parameters
sizeThe size of the window

◆ Coordinates() [2/2]

gf::Coordinates::Coordinates ( RenderTarget target)

Constructor with render target.

Parameters
targetThe render target

Member Function Documentation

◆ getAbsolutePoint()

Vector2f gf::Coordinates::getAbsolutePoint ( Vector2f  distance,
Anchor  anchor 
) const

Compute an absolute point.

Parameters
distanceThe distance from the edge
anchorThe reference anchor

◆ getCenter()

Vector2f gf::Coordinates::getCenter ( ) const

Get the center of the window.

Returns
The center of the window

◆ getRelativeCharacterSize()

unsigned gf::Coordinates::getRelativeCharacterSize ( float  percent) const

Compute a relative character size.

Parameters
percentThe percentage of the window

◆ getRelativePoint()

Vector2f gf::Coordinates::getRelativePoint ( Vector2f  percent) const

Compute a relative point.

Parameters
percentThe percentage from top-right

◆ getRelativeSize()

Vector2f gf::Coordinates::getRelativeSize ( Vector2f  percent) const

Compute a relative size.

Parameters
percentThe percentage of the window

◆ getWindowSize()

Vector2f gf::Coordinates::getWindowSize ( ) const
inline

Get the size of the window.

Returns
The size of the window