gui::texture Class Reference

The base of the GUI's appearence. More...

#include <gui_texture.hpp>

Inheritance diagram for gui::texture:
gui::layered_region gui::region gui::uiobject

List of all members.

Public Types

enum  blend_mode {
  BLEND_NONE, BLEND_BLEND, BLEND_KEY, BLEND_ADD,
  BLEND_MOD
}

Public Member Functions

 texture (manager *pManager)
 Constructor.
virtual ~texture ()
 Destructor.
virtual std::string serialize (const std::string &sTab) const
 Prints all relevant information about this widget in a string.
virtual void render ()
 Renders this widget on the current render target.
virtual void copy_from (uiobject *pObj)
 Copies an uiobject's parameters into this texture (inheritance).
blend_mode get_blend_mode () const
 Returns this texture's blending mode.
const colorget_color () const
 Returns this texture's color.
const gradientget_gradient () const
 Returns this texture's gradient.
const std::array< float, 8 > & get_tex_coord () const
 Returns this texture's texture coordinates.
bool get_tex_coord_modifies_rect () const
 Checks if this texture's dimensions are affected by texture coordinates.
const std::string & get_texture () const
 Returns this textures's texture file.
color get_vertex_color () const
 Returns this textures's vertex color.
bool is_desaturated () const
 Checks if this texture is desaturated.
void set_blend_mode (blend_mode mBlendMode)
 Sets this texture's blending mode.
void set_blend_mode (const std::string &sBlendMode)
 Sets this texture's blending mode.
void set_desaturated (bool bIsDesaturated)
 Makes this texture appear without any color.
void set_gradient (const gradient &mGradient)
 Adds a gradient effect to this texture.
void set_tex_coord (const std::array< float, 4 > &lCoordinates)
 Sets this texture's texture coordinates.
void set_tex_coord (const std::array< float, 8 > &lCoordinates)
 Sets this texture's texture coordinates.
void set_tex_coord_modifies_rect (bool bTexCoordModifiesRect)
 Sets whether this texture's dimensions are affected by texture coordinates.
void set_texture (const std::string &sFile)
 Sets this texture's texture file.
void set_texture (utils::refptr< render_target > pRenderTarget)
 Reads texture data from a render_target.
void set_color (const color &mColor)
 Sets this texture's color.
void set_sprite (utils::refptr< sprite > pSprite)
 Directly sets this texture's underlying sprite.
void set_vertex_color (const color &mColor)
 Sets this texture's vertex color.
virtual void create_glue ()
 Creates the associated Lua glue.
virtual void parse_block (xml::block *pBlock)
 Parses data from an xml::block.

Static Public Member Functions

static void register_glue (utils::wptr< lua::state > pLua)
 Registers this widget to the provided lua::state.

Detailed Description

The base of the GUI's appearence.

This object contains either a texture taken from a file, or a plain color.

Definition at line 15 of file gui_texture.hpp.


Member Enumeration Documentation

Enumerator:
BLEND_NONE 
BLEND_BLEND 
BLEND_KEY 
BLEND_ADD 
BLEND_MOD 

Definition at line 19 of file gui_texture.hpp.


Constructor & Destructor Documentation

gui::texture::texture ( manager pManager  )  [explicit]

Constructor.

Definition at line 14 of file gui_texture.cpp.

gui::texture::~texture (  )  [virtual]

Destructor.

Definition at line 23 of file gui_texture.cpp.


Member Function Documentation

void gui::texture::copy_from ( uiobject pObj  )  [virtual]

Copies an uiobject's parameters into this texture (inheritance).

Parameters:
pObj The uiobject to copy

Definition at line 101 of file gui_texture.cpp.

void gui::texture::create_glue (  )  [virtual]

Creates the associated Lua glue.

Reimplemented from gui::layered_region.

Definition at line 92 of file gui_texture.cpp.

texture::blend_mode gui::texture::get_blend_mode (  )  const

Returns this texture's blending mode.

Returns:
This texture's blending mode

Definition at line 128 of file gui_texture.cpp.

const color & gui::texture::get_color (  )  const

Returns this texture's color.

Returns:
This texture's color (color::EMPTY if none)

Definition at line 133 of file gui_texture.cpp.

const gradient & gui::texture::get_gradient (  )  const

Returns this texture's gradient.

Returns:
This texture's gradient (Gradient::NONE if none)

Definition at line 138 of file gui_texture.cpp.

const std::array< float, 8 > & gui::texture::get_tex_coord (  )  const

Returns this texture's texture coordinates.

Returns:
This texture's texture coordinates
Note:
The texture coordinates are arranged as a rectangle, which is made of four points : 1 (top left), 2 (top right), 3 (bottom right) and 4 (bottom left).
The returned array is composed like this : (x1, y1, x2, y2, x3, y3, x4, y4).

Definition at line 143 of file gui_texture.cpp.

bool gui::texture::get_tex_coord_modifies_rect (  )  const

Checks if this texture's dimensions are affected by texture coordinates.

Returns:
'true' if this texture's dimensions are affected by texture coordinates

Definition at line 148 of file gui_texture.cpp.

const std::string & gui::texture::get_texture (  )  const

Returns this textures's texture file.

Returns:
This textures's texture file (empty string if none).

Definition at line 153 of file gui_texture.cpp.

color gui::texture::get_vertex_color (  )  const

Returns this textures's vertex color.

Returns:
This textures's vertex color
Note:
This color is used to filter the texture's colors : for each pixel, the original color is multiplied by this vertex color.

Definition at line 158 of file gui_texture.cpp.

bool gui::texture::is_desaturated (  )  const

Checks if this texture is desaturated.

Returns:
'true' if the texture is desaturated
Note:
Only available on certain graphic cards (most of modern ones are capable of this).

Definition at line 171 of file gui_texture.cpp.

void gui::texture::parse_block ( xml::block *  pBlock  )  [virtual]

Parses data from an xml::block.

Parameters:
pBlock The texture's xml::block

Reimplemented from gui::layered_region.

Definition at line 9 of file gui_texture_parser.cpp.

void gui::texture::register_glue ( utils::wptr< lua::state >  pLua  )  [static]

Registers this widget to the provided lua::state.

Definition at line 9 of file gui_texture_glues.cpp.

void gui::texture::render (  )  [virtual]

Renders this widget on the current render target.

Reimplemented from gui::region.

Definition at line 81 of file gui_texture.cpp.

std::string gui::texture::serialize ( const std::string &  sTab  )  const [virtual]

Prints all relevant information about this widget in a string.

Parameters:
sTab The offset to give to all lines
Returns:
All relevant information about this widget

Reimplemented from gui::layered_region.

Definition at line 27 of file gui_texture.cpp.

void gui::texture::set_blend_mode ( const std::string &  sBlendMode  ) 

Sets this texture's blending mode.

Parameters:
sBlendMode The new blending mode

Definition at line 185 of file gui_texture.cpp.

void gui::texture::set_blend_mode ( blend_mode  mBlendMode  ) 

Sets this texture's blending mode.

Parameters:
mBlendMode The new blending mode

Definition at line 176 of file gui_texture.cpp.

void gui::texture::set_color ( const color mColor  ) 

Sets this texture's color.

Parameters:
mColor The color to use
Note:
This function is not compatible with set_texture() : only the latest you have called will apply.

Definition at line 349 of file gui_texture.cpp.

void gui::texture::set_desaturated ( bool  bIsDesaturated  ) 

Makes this texture appear without any color.

Parameters:
bIsDesaturated 'true' if you want to remove colors

Definition at line 214 of file gui_texture.cpp.

void gui::texture::set_gradient ( const gradient mGradient  ) 

Adds a gradient effect to this texture.

Parameters:
mGradient The gradient to add
Note:
To remove a gradient, call set_gradient(Gradient::NONE).

Definition at line 233 of file gui_texture.cpp.

void gui::texture::set_sprite ( utils::refptr< sprite pSprite  ) 

Directly sets this texture's underlying sprite.

Parameters:
pSprite The new sprite to use
Note:
The texture's dimensions will be adjusted to fit those of the provided sprite, and same goes for texture coordinates.
Be sure to know what you're doing when you call this function.

Definition at line 360 of file gui_texture.cpp.

void gui::texture::set_tex_coord ( const std::array< float, 8 > &  lCoordinates  ) 

Sets this texture's texture coordinates.

Parameters:
lCoordinates This texture's texture coordinates
Note:
The texture coordinates are arranged as a rectangle, which is made of four points : 1 (top left), 2 (top right), 3 (bottom right) and 4 (bottom left).
The array must be arranged like this : (x1, y1, x2, y2, x3, y3, x4, y4).
This function allows rotated/deformed texture coordinates.

Definition at line 275 of file gui_texture.cpp.

void gui::texture::set_tex_coord ( const std::array< float, 4 > &  lCoordinates  ) 

Sets this texture's texture coordinates.

Parameters:
lCoordinates This texture's texture coordinates
Note:
The texture coordinates are arranged as a rectangle, which is made of four points : 1 (top left), 2 (top right), 3 (bottom right) and 4 (bottom left).
The array must be arranged like this : (x1, y1, x3, y3), or (left, top, right, bottom). Other corners are calculated using these coordinates.
This function only allows horizontal/rectangle texture coordinates.

Definition at line 260 of file gui_texture.cpp.

void gui::texture::set_tex_coord_modifies_rect ( bool  bTexCoordModifiesRect  ) 

Sets whether this texture's dimensions are affected by texture coordinates.

Parameters:
bTexCoordModifiesRect 'true' to make dimensions change with tex coords

Definition at line 290 of file gui_texture.cpp.

void gui::texture::set_texture ( utils::refptr< render_target pRenderTarget  ) 

Reads texture data from a render_target.

Parameters:
pRenderTarget The render_target from which to read the data
Note:
This function is only meant for internal use and is not available to the Lua API.
This function is not compatible with set_color() : only the latest you have called will apply.

Definition at line 327 of file gui_texture.cpp.

void gui::texture::set_texture ( const std::string &  sFile  ) 

Sets this texture's texture file.

Parameters:
sFile The file from which to read data
Note:
This function takes care of checking that the file can be opened.
This function is not compatible with set_color() : only the latest you have called will apply.

Definition at line 299 of file gui_texture.cpp.

void gui::texture::set_vertex_color ( const color mColor  ) 

Sets this texture's vertex color.

Parameters:
mColor This textures's new vertex color
Note:
This color is used to filter the texture's colors : for each pixel, the original color is multiplied by this vertex color.

Definition at line 375 of file gui_texture.cpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines

Generated on Tue Jan 1 21:58:12 2013 for gui by  doxygen 1.6.1