NvUIRect Class Reference

A class that abstracts on onscreen rectangular region. More...

#include <NvUI.h>

List of all members.

Public Member Functions

 NvUIRect ()
 Default constructor, zeroes all elements.
 NvUIRect (float l, float t, float w, float h, float z=0.0f)
 Normal use constructor.
virtual ~NvUIRect ()
 Default destructor.
virtual void Set (float l, float t, float w, float h, float z=0.0f)
 General value setter.
virtual bool Inside (float x, float y, float mx=0, float my=0)
 Helper to test point-in-rect.
virtual void Grow (float w, float h)
 Helper to grow the rectangle by a given width and height, keeping existing 'center'.

Public Attributes

float left
 Left/x origin in UI-space.
float top
 Top/y origin in UI-space.
float width
 Width in pixels.
float height
 Height in pixels.
float zdepth
 FUTURE: z-depth of rect.

Friends

class NvUIElement


Detailed Description

A class that abstracts on onscreen rectangular region.

All UI elements use the NvUIRect to a greater or lesser degree. It is the underpinning of onscreen positioning and scaling (and thus animation too), and heavily used in input "hit testing" routines as well.


Constructor & Destructor Documentation

NvUIRect::NvUIRect (  )  [inline]

Default constructor, zeroes all elements.

NvUIRect::NvUIRect ( float  l,
float  t,
float  w,
float  h,
float  z = 0.0f 
) [inline]

Normal use constructor.

Parameters:
l left edge position
t top edge position
w width of rect
h height of rect
z [optional] z-depth of rect


Member Function Documentation

virtual void NvUIRect::Grow ( float  w,
float  h 
) [inline, virtual]

Helper to grow the rectangle by a given width and height, keeping existing 'center'.

This is used to build 'outer' frames, borders, focus rectangles.

virtual bool NvUIRect::Inside ( float  x,
float  y,
float  mx = 0,
float  my = 0 
) [inline, virtual]

Helper to test point-in-rect.

Tests whether a given point is inside our rect bounds, with optional margin for slop-factor with inaccurate tests (i.e., finger-hit-box).

Parameters:
x X coordinate of point in UI space
y Y coordinate of point in UI space
mx Margin in pixels in x-axis
my Margin in pixels in y-axis
Returns:
true if tests as inside rect, false otherwise.

virtual void NvUIRect::Set ( float  l,
float  t,
float  w,
float  h,
float  z = 0.0f 
) [inline, virtual]

General value setter.

Parameters:
l left edge position
t top edge position
w width of rect
h height of rect
z [optional] z-depth of rect


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