qaf::BigTexture Class Reference

#include <qafBigTexture.h>

List of all members.


Detailed Description

Stores an arbitrary-sized image.

Following a "slower and working is better than faster and broken" philosopy, BigTexture will juggle textures and sub-textures for you, ensuring your large tile libraries will look the same no matter what the video card's texture dimension constraints are.

BigTexture is an extension for Haaf's Game Engine, using Direct3DX as its image loader.

When you create a BigTexture object, the constructor will automatically divide the source image into smaller images until all of them fit within the video card's texture dimension constraints. This is transparent to the user; you just tell BT to render a rectangular area from the source image.


Public Member Functions

 BigTexture (const char *sourceImage)
 Loads the image, breaking it into sub-textures as needed.
int getImageWidth () const
 
Returns:
The original image's width, in pixels.

int getImageHeight () const
 
Returns:
The original image's height, in pixels.

void renderRectangle (int x0, int y0, int tx=0, int ty=0, int width=0, int height=0, unsigned long color=0xFFFFFFFF, unsigned long blend=2, bool flipX=false, bool flipY=false) const
 Draws an axis-aligned rectangular area from this image.
void renderTriple (const hgeTriple *triple) const
 Use this to render a triangular section of the big texture.
void renderQuad (const hgeQuad *quad) const
 Use this to render a freeform rectangular area of the texture.
virtual ~BigTexture ()
 Deletes the sub-textures.

Classes

struct  SubTexture


Constructor & Destructor Documentation

qaf::BigTexture::BigTexture ( const char *  sourceImage  ) 

Loads the image, breaking it into sub-textures as needed.

If any errors are encountered, they will be reported in the HGE log file.

This process is very slow; you should manage your BTs so as to minimize the creation/destruction of these objects.

See also:
Environment::loadBigTexture()


Member Function Documentation

void qaf::BigTexture::renderRectangle ( int  x0,
int  y0,
int  tx = 0,
int  ty = 0,
int  width = 0,
int  height = 0,
unsigned long  color = 0xFFFFFFFF,
unsigned long  blend = 2,
bool  flipX = false,
bool  flipY = false 
) const

Draws an axis-aligned rectangular area from this image.

Make sure you invoke this method between a pair of Gfx_BeginScene()/Gfx_EndScene() calls.

Parameters:
x0 Screen coordinates of the rectangle's top-left corner
y0 Screen coordinates of the rectangle's top-left corner
tx Coordinates of the rectangle's top-left corner in the image space.
ty Coordinates of the rectangle's top-left corner in the image space
width Width of the rectangular area to be drawn. If zero or negative, the image's width is used.
height Height of the rectangular area to be drawn. If zero or negative, the image's height is used.
color Has the same effect as the color field in hgeVertex. Default is full-alpha white.
blend Has the same effect as the blend field in hgeQuad.
flipX If true, the rectangle will be flipped along the X axis.
flipY If true, the rectangle will be flipped along the Y axis.
Note:
If the rectangle exceeds the image's bounds, it will be clipped.

void qaf::BigTexture::renderTriple ( const hgeTriple *  triple  )  const

Use this to render a triangular section of the big texture.

All the hgeTriple fields have their usual meanings; this method works exactly like HGE::Gfx_RenderTriple(), with the following exceptions:

This method is much slower than its "core" HGE equivalent; use it sparingly.

You are advised to disable HGE_TEXTUREFILTER before invoking this method.

void qaf::BigTexture::renderQuad ( const hgeQuad *  quad  )  const

Use this to render a freeform rectangular area of the texture.

See renderTriple() for more information.


The documentation for this class was generated from the following file:
Generated on Sun Mar 25 12:32:14 2007 for Qaf Framework by  doxygen 1.5.1-p1