stmm-games-doc  0.32.0
Public Member Functions | Public Attributes | List of all members
stmg::TileSizing Class Reference

Constraints to tile size and width to height ratio. More...

Public Member Functions

bool isValid () const noexcept
 
NSize getBest (int32_t nReqW) const noexcept
 Calculates the best tile size given a requested width. More...
 

Public Attributes

int32_t m_nMinW = 5
 Minimum width in pixels. More...
 
int32_t m_nMaxW = 1000
 Maximum width in pixels. More...
 
int32_t m_nMinH = 5
 Minimum height in pixels. More...
 
int32_t m_nMaxH = 1000
 Maximum height in pixels. More...
 
double m_fWHRatio = 1.0
 The fixed width to height ratio. More...
 

Detailed Description

Constraints to tile size and width to height ratio.

Member Function Documentation

◆ getBest()

NSize stmg::TileSizing::getBest ( int32_t  nReqW) const
noexcept

Calculates the best tile size given a requested width.

The resulting size might not satisfy the constraints because they can't.

Parameters
nReqWThe requested width.
Returns
The tile size.

◆ isValid()

bool stmg::TileSizing::isValid ( ) const
noexcept

Member Data Documentation

◆ m_fWHRatio

double stmg::TileSizing::m_fWHRatio = 1.0

The fixed width to height ratio.

Minimum is 0.001. Maximum is 1000.0. Default is 1.

◆ m_nMaxH

int32_t stmg::TileSizing::m_nMaxH = 1000

Maximum height in pixels.

Cannot be smaller than m_nMinH. Default is 1000.

◆ m_nMaxW

int32_t stmg::TileSizing::m_nMaxW = 1000

Maximum width in pixels.

Cannot be smaller than m_nMinW. Default is 1000.

◆ m_nMinH

int32_t stmg::TileSizing::m_nMinH = 5

Minimum height in pixels.

Must be positive. Default is 5.

◆ m_nMinW

int32_t stmg::TileSizing::m_nMinW = 5

Minimum width in pixels.

Must be positive. Default is 5.