PNTK
Public Member Functions | List of all members
pntk::gui_rect Class Reference

#include <gui_rect.h>

Public Member Functions

 gui_rect ()
 
 gui_rect (int x, int y, int width, int height)
 
 gui_rect (const gui_point &a, const gui_point &b)
 
 gui_rect (const gui_point &point, const gui_size &size)
 
int get_x () const
 
int get_y () const
 
int get_x2 () const
 
int get_y2 () const
 
int get_width () const
 
int get_height () const
 
gui_size get_size () const
 
gui_point get_top_left () const
 
gui_point get_top_right () const
 
gui_point get_bottom_right () const
 
gui_point get_bottom_left () const
 
int get_center_x () const
 
int get_center_y () const
 
gui_point get_center () const
 
void set_x (int x)
 
void set_y (int y)
 
void set_width (int width)
 
void set_height (int height)
 
void set_position (const gui_point &point)
 
void set_size (const gui_size &size)
 
void set (int x, int y, int width, int height)
 
bool contains_point (const gui_point &point) const
 
bool intersects (const gui_rect &rect) const
 
bool operator== (const gui_rect &rhs) const
 
bool operator!= (const gui_rect &rhs) const
 

Detailed Description

A portable x, y, width and height class.

Constructor & Destructor Documentation

◆ gui_rect() [1/4]

pntk::gui_rect::gui_rect ( )

Creates a rect object with an x, y, width, and height of 0

◆ gui_rect() [2/4]

pntk::gui_rect::gui_rect ( int  x,
int  y,
int  width,
int  height 
)

Creates a rect object with the given x, y width and height

◆ gui_rect() [3/4]

pntk::gui_rect::gui_rect ( const gui_point a,
const gui_point b 
)

Creates a rect object with the given points

◆ gui_rect() [4/4]

pntk::gui_rect::gui_rect ( const gui_point point,
const gui_size size 
)

Creates a rect object with the given starting point and size.

Member Function Documentation

◆ contains_point()

bool pntk::gui_rect::contains_point ( const gui_point point) const

Returns true if the point is inside the rectangle.

◆ get_bottom_left()

gui_point pntk::gui_rect::get_bottom_left ( ) const

Returns the bottom-left point within the rectangle (width-1, height-1)

◆ get_bottom_right()

gui_point pntk::gui_rect::get_bottom_right ( ) const

Returns the bottom-right point within the rectangle (width-1, height-1)

◆ get_center()

gui_point pntk::gui_rect::get_center ( ) const

Returns the center point

◆ get_center_x()

int pntk::gui_rect::get_center_x ( ) const

Returns the center x value

◆ get_center_y()

int pntk::gui_rect::get_center_y ( ) const

Returns the center y value

◆ get_height()

int pntk::gui_rect::get_height ( ) const

Returns the height value

◆ get_size()

gui_size pntk::gui_rect::get_size ( ) const

Returns the size of the rectangle

◆ get_top_left()

gui_point pntk::gui_rect::get_top_left ( ) const

Returns the top-left point within the rectangle (width-1, height-1)

◆ get_top_right()

gui_point pntk::gui_rect::get_top_right ( ) const

Returns the top-right point within the rectangle (width-1, height-1)

◆ get_width()

int pntk::gui_rect::get_width ( ) const

Returns the width value

◆ get_x()

int pntk::gui_rect::get_x ( ) const

Returns the x value

◆ get_x2()

int pntk::gui_rect::get_x2 ( ) const

Returns the width added to the x value

◆ get_y()

int pntk::gui_rect::get_y ( ) const

Returns the y value

◆ get_y2()

int pntk::gui_rect::get_y2 ( ) const

Returns the height added to the y value

◆ intersects()

bool pntk::gui_rect::intersects ( const gui_rect rect) const

Returns true if the rectangles collide.

◆ operator!=()

bool pntk::gui_rect::operator!= ( const gui_rect rhs) const

Returns true if the x, y, width and height of the compared gui_rects are not equal.

◆ operator==()

bool pntk::gui_rect::operator== ( const gui_rect rhs) const

Returns true if the x, y, width and height of the compared gui_rects are equal.

◆ set()

void pntk::gui_rect::set ( int  x,
int  y,
int  width,
int  height 
)

Sets the x and the y and the width and height value

◆ set_height()

void pntk::gui_rect::set_height ( int  height)

Sets the height value

◆ set_position()

void pntk::gui_rect::set_position ( const gui_point point)

Sets the width value

◆ set_size()

void pntk::gui_rect::set_size ( const gui_size size)

Sets the height value

◆ set_width()

void pntk::gui_rect::set_width ( int  width)

Sets the width value

◆ set_x()

void pntk::gui_rect::set_x ( int  x)

Sets the x value

◆ set_y()

void pntk::gui_rect::set_y ( int  y)

Sets the y value


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