My Project
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
ParaEngine::TextureParams Class Reference

for reading texture parameters from strings like "texture/whitedot.png:10 10 10 10", "texture/whitedot.png;0 0 64 64:10 10 10 10" More...

#include <TextureParams.h>

Public Member Functions

 TextureParams (const char *str)
 
void Init (const char *str)
 
TextureEntityGetTexture ()
 get the texture
 
bool IsNineTileTexture ()
 whether it is nine tile image. More...
 
bool HasSubRegion ()
 if a sub region of the original image should be used. More...
 
int GetImageRects (RECT *rcTextures)
 return all image rects More...
 
void drawTexture (CPainter *painter, int x, int y, int w, int h, const RECT *rcTextures=NULL, int nCount=-1)
 draw texture to given target. More...
 

Public Attributes

int m_left
 
int m_top
 
int m_right
 
int m_bottom
 
int m_toLeft
 
int m_toTop
 
int m_toRight
 
int m_toBottom
 
TextureEntitym_pTexture
 

Protected Member Functions

void DrawNineTileTexture (CPainter *painter, int x, int y, int w, int h, const RECT *rcTextures)
 
void DrawSingleTexture (CPainter *painter, int x, int y, int w, int h, const RECT &rc)
 

Detailed Description

for reading texture parameters from strings like "texture/whitedot.png:10 10 10 10", "texture/whitedot.png;0 0 64 64:10 10 10 10"

Member Function Documentation

§ drawTexture()

void ParaEngine::TextureParams::drawTexture ( CPainter painter,
int  x,
int  y,
int  w,
int  h,
const RECT rcTextures = NULL,
int  nCount = -1 
)

draw texture to given target.

this is a helper function.

Parameters
rcTexturesif NULL, it will use GetImageRects().
nCount1 or 9 depending on the texture type. -1 means automatic and only valid if rcTextures is NULL.

§ GetImageRects()

int ParaEngine::TextureParams::GetImageRects ( RECT rcTextures)

return all image rects

Parameters
rcTexturespass in pointer of RECT[9].
Returns
0, 1 or 9 depending on the texture type. 0 means image rect is not determined.

§ HasSubRegion()

bool ParaEngine::TextureParams::HasSubRegion ( )
inline

if a sub region of the original image should be used.

§ Init()

void ParaEngine::TextureParams::Init ( const char *  str)
Parameters
strcan be filename[; left top width height][:left top toright to bottom], such as "texture/whitedot.png", "texture/whitedot.png;0 0 64 64", "texture/whitedot.png:10 10 10 10", "texture/whitedot.png;0 0 64 64:10 10 10 10" [:left top toright to bottom] is used to specify the inner rect of the center tile in a nine texture element UI object

§ IsNineTileTexture()

bool ParaEngine::TextureParams::IsNineTileTexture ( )
inline

whether it is nine tile image.


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