NvUIGraphic Class Reference
A graphical element, with no interactivity. More...
#include <NvUI.h>
Public Member Functions | |
NvUIGraphic (const std::string &texname, float dstw=0, float dsth=0) | |
Basic constructor, taking texture filename as source. | |
NvUIGraphic (NvUITexture *tex, float dstw=0, float dsth=0) | |
Basic constructor, taking NvUITexture object as source. | |
virtual bool | LoadTexture (const std::string &texname, bool resetDimensions=true) |
Loads a texture from cache or file. | |
void | SetTexture (NvUITexture *tex) |
Change this graphic to use a specific NvUITexture object. | |
virtual void | Draw (const NvUIDrawState &drawState) |
Does the heavy lifting to render our texture at target position/dimensions. | |
virtual void | SetColor (NvPackedColor color) |
Sets a color value to multiply with during fragment processing. | |
void | FlushTexture () |
If we have a texture object, deletes our reference, and nulls out our member. | |
NvUITexture * | GetTex () |
Protected Attributes | |
NvUITexture * | m_tex |
The texture we render from. | |
bool | m_scale |
Are we scaling the texture (pixel size other than original width/height texel size)? | |
NvPackedColor | m_color |
An RGB color to modulate with the texels of the graphic (alpha is ignored for the moment). |
Detailed Description
A graphical element, with no interactivity.This class renders a texture (or portion of one) to the screen, but has no interactivity with the user, just the visual. Other UI classes derive from this functionality, or otherwise utilize or proxy to it.
NvUIGraphic can be initialized from a texture on disk, an existing NvUITexture object, or an existing GL texture ID.
Constructor & Destructor Documentation
NvUIGraphic::NvUIGraphic | ( | const std::string & | texname, | |
float | dstw = 0 , |
|||
float | dsth = 0 | |||
) |
Basic constructor, taking texture filename as source.
Note it uses the texture size for target w/h unless default params overridden, in which case it will scale the texture appropriately.
- Parameters:
-
texname Texture filename (and path if any needed) in a std::string. dstw Target width dimension, defaults to texture width if not overridden. dsth Target height dimension, defaults to texture height if not overridden.
NvUIGraphic::NvUIGraphic | ( | NvUITexture * | tex, | |
float | dstw = 0 , |
|||
float | dsth = 0 | |||
) |
Basic constructor, taking NvUITexture object as source.
Note it uses the texture size for target w/h unless default params overridden, in which case it will scale the texture appropriately.
- Parameters:
-
tex Source NvUITexture object pointer. dstw Target width dimension, defaults to texture width if not overridden. dsth Target height dimension, defaults to texture height if not overridden.
Member Function Documentation
virtual void NvUIGraphic::Draw | ( | const NvUIDrawState & | drawState | ) | [virtual] |
Does the heavy lifting to render our texture at target position/dimensions.
Reimplemented from NvUIElement.
Reimplemented in NvUIGraphicFrame.
void NvUIGraphic::FlushTexture | ( | ) |
If we have a texture object, deletes our reference, and nulls out our member.
virtual bool NvUIGraphic::LoadTexture | ( | const std::string & | texname, | |
bool | resetDimensions = true | |||
) | [virtual] |
Loads a texture from cache or file.
This actually ends up loading data using the NvUITexture::CacheTexture method, to take advantage of the texture cache, and loaded from disk into the cache if not already there.
- Parameters:
-
texname Filename of texture to load resetDimensions Whether to set our dimensions to match those of the texture. Defaults true.
Reimplemented in NvUIGraphicFrame.
virtual void NvUIGraphic::SetColor | ( | NvPackedColor | color | ) | [virtual] |
Sets a color value to multiply with during fragment processing.
Setting to white (1,1,1,x) color effectively disables colorization.
void NvUIGraphic::SetTexture | ( | NvUITexture * | tex | ) |
Change this graphic to use a specific NvUITexture object.
Member Data Documentation
NvUITexture* NvUIGraphic::m_tex [protected] |
The texture we render from.
The documentation for this class was generated from the following file: