#include <tiledsurface.h>
Public Member Functions | |
TiledSurface (uint width, uint height, const Graphics::PixelFormat &pixelFormat) | |
void | copyRectToSurface (const void *src, int srcPitch, int x, int y, int w, int h) |
void | update () |
void | draw (SurfaceRenderer *surfaceRenderer) const |
void | fill (uint32 color) |
Graphics::Surface * | getBackingSurface () |
const Graphics::Surface * | getBackingSurface () const |
uint16 | getWidth () const |
uint16 | getHeight () const |
Surface implementation using OpenGL texture tiles
void OpenGL::TiledSurface::copyRectToSurface | ( | const void * | src, |
int | srcPitch, | ||
int | x, | ||
int | y, | ||
int | w, | ||
int | h | ||
) |
Copy image data to the surface.
The format of the input data needs to match the format returned by getFormat. This does not immediately updates the textures.
x | X coordinate of upper left corner to copy data to. |
y | Y coordinate of upper left corner to copy data to. |
w | Width of the image data to copy. |
h | Height of the image data to copy. |
src | Pointer to image data. |
srcPitch | The number of bytes in a row of the image data. |
void OpenGL::TiledSurface::update | ( | ) |
Update the OpenGL textures from the backing surface
void OpenGL::TiledSurface::draw | ( | SurfaceRenderer * | surfaceRenderer | ) | const |
Draw as a 2D surface
The destination rect is as follow : x: left [0.0, 1.0] right y: top [0.0, 1.0] bottom
surfaceRenderer |
void OpenGL::TiledSurface::fill | ( | uint32 | color | ) |
Fill the surface with a fixed color.
color | Color value in format returned by getFormat. |
Graphics::Surface* OpenGL::TiledSurface::getBackingSurface | ( | ) |
Get the backing surface
This can be used to update the image data, but causes a full update. Using copyRectToSurface is preferred
const Graphics::Surface* OpenGL::TiledSurface::getBackingSurface | ( | ) | const |
Get the backing surface
This const version can be used to read image data without causing a full texture invalidation.
|
inline |
Get the dimensions in pixels of the surface
This does not include the unused area in the textures at the edges of the grid.