Gamedev Framework (gf)  0.8.0
A C++14 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 (Vector2u size)
 Constructor with size. More...
 
 Coordinates (RenderTarget &target)
 Constructor with render target. 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 ( Vector2u  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