TinyMaterialDesign
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
Bounds Struct Reference

Axis-aligned pixel rectangle used for widget bounds and hit-testing. More...

#include <Bounds.h>

Public Member Functions

 Bounds ()=default
 
 Bounds (int32_t x, int32_t y, int32_t w, int32_t h)
 
int32_t right () const
 
int32_t bottom () const
 
int32_t centerX () const
 
int32_t centerY () const
 
bool contains (int32_t px, int32_t py) const
 
Bounds inset (int32_t amount) const
 Returns a rect inset by amount on every side (negative to grow).
 

Public Attributes

int32_t x = 0
 
int32_t y = 0
 
int32_t w = 0
 
int32_t h = 0
 

Detailed Description

Axis-aligned pixel rectangle used for widget bounds and hit-testing.

Deliberately signed (unlike TinyGPU's size_t-based drawing calls) so widget layout math (x - radius, centering, ...) can't silently underflow; clamp to >=0 only at the point of calling into ISurface.

Constructor & Destructor Documentation

◆ Bounds() [1/2]

Bounds ( )
default

◆ Bounds() [2/2]

Bounds ( int32_t  x,
int32_t  y,
int32_t  w,
int32_t  h 
)
inline

Member Function Documentation

◆ bottom()

int32_t bottom ( ) const
inline

◆ centerX()

int32_t centerX ( ) const
inline

◆ centerY()

int32_t centerY ( ) const
inline

◆ contains()

bool contains ( int32_t  px,
int32_t  py 
) const
inline

◆ inset()

Bounds inset ( int32_t  amount) const
inline

Returns a rect inset by amount on every side (negative to grow).

◆ right()

int32_t right ( ) const
inline

Member Data Documentation

◆ h

int32_t h = 0

◆ w

int32_t w = 0

◆ x

int32_t x = 0

◆ y

int32_t y = 0

The documentation for this struct was generated from the following file: