NvUIGraphicFrame Class Reference

A graphical frame element, representing a background and border combined. More...

#include <NvUI.h>

Inheritance diagram for NvUIGraphicFrame:

NvUIGraphic NvUIElement

List of all members.

Public Member Functions

 NvUIGraphicFrame (const std::string &texname, float texBorder)
 Constructor for a texture file that has a single x/y border thickness.
 NvUIGraphicFrame (const std::string &texname, float texBorderX, float texBorderY)
 Constructor for a texture file with independent x and y border thicknesses.
 NvUIGraphicFrame (NvUITexture *uiTex, float border)
 Constructor for an existing NvUITexture that has a single x/y border thickness.
virtual ~NvUIGraphicFrame ()
 Default destructor, tries to ensure memory is released.
virtual bool LoadTexture (const std::string &texname, bool resetDimensions=true)
 Loads a texture from cache or file.
void SetBorderThickness (float thickness)
 Set a single x/y border thickness for this frame.
void SetBorderThickness (float width, float height)
 Set independent x and y border thicknesses for this frame.
void GetBorderThickness (float *x, float *y)
 Get the x and y border thicknesses for this frame.
void SetDrawCenter (bool m_drawCenter)
 Flag for whether to draw the center piece of the 3x3 frame grid, or ignore that quad.
virtual void Draw (const NvUIDrawState &drawState)
 Renders the frame texture appropriately stretched to fit the target position/dimensions.

Protected Attributes

nv::vec2< float > m_texBorder
 How many pixels in the texture is considered to be a border.
nv::vec2< float > m_borderThickness
 Thickness of the border when drawing.
bool m_drawCenter
 Whether or not to draw the center piece or just the border.


Detailed Description

A graphical frame element, representing a background and border combined.

This class implements a flexible/dynamic frame system based off the general NvUIGraphic base class, letting the base class manage texture loading, etc.

Then, this subclass adds the concept of drawing a properly-formed frame texture which has designed in a non-stretched border area which is used in calculating mapping from texel space (source) to pixel space (destination). The frame object can then be resized with the frame border remaining a fixed 'thickness', but the edges and center stretching and contracting to match the given size/rect.


Constructor & Destructor Documentation

NvUIGraphicFrame::NvUIGraphicFrame ( const std::string &  texname,
float  texBorder 
)

Constructor for a texture file that has a single x/y border thickness.

NvUIGraphicFrame::NvUIGraphicFrame ( const std::string &  texname,
float  texBorderX,
float  texBorderY 
)

Constructor for a texture file with independent x and y border thicknesses.

NvUIGraphicFrame::NvUIGraphicFrame ( NvUITexture uiTex,
float  border 
)

Constructor for an existing NvUITexture that has a single x/y border thickness.

virtual NvUIGraphicFrame::~NvUIGraphicFrame (  )  [virtual]

Default destructor, tries to ensure memory is released.


Member Function Documentation

virtual void NvUIGraphicFrame::Draw ( const NvUIDrawState drawState  )  [virtual]

Renders the frame texture appropriately stretched to fit the target position/dimensions.

Reimplemented from NvUIGraphic.

void NvUIGraphicFrame::GetBorderThickness ( float *  x,
float *  y 
)

Get the x and y border thicknesses for this frame.

virtual bool NvUIGraphicFrame::LoadTexture ( const std::string &  texname,
bool  resetDimensions = true 
) [virtual]

Loads a texture from cache or file.

We override the default handling to force resetDimensions to false, as frames inherently stretch to render/fill the specified destination rectangle, and thus we don't want to take on the dimensions of the texture by default.

Reimplemented from NvUIGraphic.

void NvUIGraphicFrame::SetBorderThickness ( float  width,
float  height 
)

Set independent x and y border thicknesses for this frame.

void NvUIGraphicFrame::SetBorderThickness ( float  thickness  ) 

Set a single x/y border thickness for this frame.

void NvUIGraphicFrame::SetDrawCenter ( bool  m_drawCenter  ) 

Flag for whether to draw the center piece of the 3x3 frame grid, or ignore that quad.


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