|
0 A.D. | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Base class for (relatively) simple drawing of data onto terrain tiles, intended for debugging purposes and for the Atlas editor (hence not trying to be very efficient).
To start drawing a terrain overlay, first create a subclass of TerrainOverlay. Override the method GetTileExtents if you want to change the range over which it is drawn. Override ProcessTile to do your processing for each tile, which should call RenderTile and RenderTileOutline as appropriate. See the end of TerrainOverlay.h for an example.
A TerrainOverlay object will be rendered for as long as it exists.
Field Summary | |
private int |
m_i
|
private int |
m_j
|
private CTerrain* |
m_Terrain
|
Constructor Summary | |
private |
TerrainOverlay( const TerrainOverlay& )
|
protected |
TerrainOverlay( int priority = 100 )
Construct the object and register it with the global list of terrain overlays. |
|
virtual ~TerrainOverlay()
|
Method Summary | |
protected virtual void |
GetTileExtents( int& min_i_inclusive, int& min_j_inclusive, int& max_i_inclusive, int& max_j_inclusive )
Override to limit the range over which ProcessTile will be called. |
protected virtual void |
ProcessTile( int i, int j )= 0
Override to perform processing of each tile. |
private void |
Render()
|
static void |
RenderOverlays()
Copying not allowed. |
protected void |
RenderTile( const CColor& colour, bool draw_hidden )
Draw a filled quad on top of the current tile. |
protected void |
RenderTileOutline( const CColor& colour, int line_width, bool draw_hidden )
Draw all TerrainOverlay objects that exist. |
Field Detail |
private int m_i;
private int m_j;
private CTerrain* m_Terrain;
Constructor Detail |
private TerrainOverlay( const TerrainOverlay& );
protected TerrainOverlay( int priority = 100 );
The priority parameter controls the order in which overlays are drawn, if several exist - they are processed in order of increasing priority, so later ones draw on top of earlier ones. Most should use the default of 100. Numbers from 200 are used by Atlas.
priority
- controls the order of drawingpublic virtual ~TerrainOverlay();
Method Detail |
protected virtual void GetTileExtents( int& min_i_inclusive, int& min_j_inclusive, int& max_i_inclusive, int& max_j_inclusive );
min_i_inclusive
- [output] smallest i coordinate, in tile-space units
(1 unit per tile, +i is world-space +x and game-space East)
min_j_inclusive
- [output] smallest j coordinate
(+j is world-space +z and game-space North)
max_i_inclusive
- [output] largest i coordinate
max_j_inclusive
- [output] largest j coordinateprotected virtual void ProcessTile( int i, int j )= 0;
i
- i coordinate of tile being processed
j
- j coordinate of tile being processedprivate void Render();
public static void RenderOverlays();
protected void RenderTile( const CColor& colour, bool draw_hidden );
colour
- colour to draw. May be transparent (alpha < 1)
draw_hidden
- true if hidden tiles (i.e. those behind other tiles)
should be drawnprotected void RenderTileOutline( const CColor& colour, int line_width, bool draw_hidden );
|
0 A.D.
Generated on September 04, 2007 at 18:14 CppDoc v2.4.0 |
|||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |