Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

Renderer Class Reference

#include <renderer.h>

List of all members.

Public Member Functions

 Renderer (const uint cityW, const uint cityL)
void RotateLeft (const uint &factor=1)
void RotateRight (const uint &factor=1)
void MoveLeft (const uint &factor=1)
void MoveRight (const uint &factor=1)
void MoveUp (const uint &factor=1)
void MoveDown (const uint &factor=1)
void Home ()
void ZoomIn ()
void ZoomOut ()
void ToggleGrid ()
void ToggleCompass ()
void ToggleProjection ()
void ToggleWireFrame ()
void DisplaySplash (const uint &rcuiX=0, const uint &rcuiY=0)
void Display (const Map *pcMap, const Layer *pcLayer)
void DisplayHighlight (const Map *pcMap, const Layer *pcLayer, const OPENCITY_TOOL_CODE &enumTool)
void DisplayHighlight (const Map *pcMap, const Layer *pcLayer, uint uiW1, uint uiL1, uint uiW2, uint uiL2, const OPENCITY_TOOL_CODE &enumTool)
void DisplayBuildPreview (const uint &uiW, const uint &uiL, const GLubyte &rcubR, const GLubyte &rcubG, const GLubyte &rcubB, const OPENCITY_GRAPHIC_CODE &gcode) const
void DisplaySelection (const Map *pcMap, const Layer *pcLayer)
void DisplaySelection (const Map *pcMap, const Layer *pcLayer, const uint &rcuiW1, const uint &rcuiL1, const uint &rcuiW2, const uint &rcuiL2)
void DisplayText (const uint &rcuiX, const uint &rcuiY, const GLubyte &rcubR, const GLubyte &rcubG, const GLubyte &rcubB, const string &rcText)
const bool GetSelectedWHFrom (const uint &rcuiMouseX, const uint &rcuiMouseY, uint &ruiW, uint &ruiL, const Map *pcMap, const Layer *pcLayer)
const bool GetSelectedWHFrom (const uint &rcuiMouseX, const uint &rcuiMouseY, uint &ruiW, uint &ruiL, const Map *pcMap, const Layer *pcLayer, const uint &rcuiW1, const uint &rcuiL1, const uint &rcuiW2, const uint &rcuiL2)
void SetWinSize (const int &rciWidth, const int &rciHeight)

Public Attributes

bool boolHeightChange

Private Member Functions

void _DisplayTerrain () const
void _DisplayWater () const
void _DisplayMapGrid (const Map *pcmap)
void _DisplayCompass () const
void _DisplayStatusBar () const
void _PrepareView () const

Private Attributes

bool bDisplayGrid
bool bDisplayCompass
bool bWireFrame
OC_UBYTE ubProjectionType
GLfloat fScaleRatio
GLfloat fXTransDelta
 The delta used for translation in the X direction.
GLfloat fZTransDelta
GLdouble dEyeX
 kept for the future when the user can
GLdouble dEyeY
 move the eye's coordinates
GLdouble dEyeZ
GLuint _uiGridList
 GL list of the grid.
GLuint _uiFontBase
 The base font list index.
GLuint _uiTerrainList
 GL list of the terrain.
GLuint _uiWaterList
 GL list of the water texture.
GLuint _uiTerrainTex
 Terrain texture.
GLuint _uiWaterTex
 Water texture.
GLuint _uiSplashTex
 Splash texture.
GLdouble dDeltaX
GLdouble dDeltaZ
GLdouble dYRotateAngle
 used for calculating the rotation of the map
GLdouble dmatrixRotate [16]
int iWinHeight
 used for calculating the viewport & the perspective ratio
int iWinWidth
uint _uiCityWidth
 The city width & height.
uint _uiCityLength
SDL_Surface * psurfaceScreen
 pointer to the screen SDL display surface


Detailed Description

Deal with the OpenGL library to render game's objects. This class shouldn't play with SDL functions but OpenGL

Definition at line 45 of file renderer.h.


Member Function Documentation

void Renderer::_DisplayMapGrid const Map pcmap  )  [private]
 

Draw the dotted grid. This method uses OpenGL display list inside.

Definition at line 1344 of file renderer.cpp.

References _uiCityWidth, _uiGridList, boolHeightChange, and Map::GetLinearHeight().

Referenced by Display().

void Renderer::_DisplayTerrain  )  const [private]
 

Draw the terrain as an _unique_ TRIANGLE_STRIP which is known as the fastest primitive in OpenGL. It starts at the north-west and when it reaches the north-east map edge, it starts drawing from the north-east to the north-west eadge. Finally the algorithm draws from the north to the south.

Definition at line 1026 of file renderer.cpp.

References _uiCityWidth, _uiTerrainList, _uiTerrainTex, boolHeightChange, Map::GetSquareHeight(), and GlobalVar::gpMapMgr.

Referenced by Display().

void Renderer::_PrepareView  )  const [private]
 

Prepare the world before drawing the entire scene

Definition at line 1470 of file renderer.cpp.

References iWinHeight.

Referenced by Display().

void Renderer::Display const Map pcMap,
const Layer pcLayer
 

Display the layer and the map to the back buffer. The caller must swap the buffers to show the changes

Definition at line 574 of file renderer.cpp.

References _DisplayMapGrid(), _DisplayTerrain(), _PrepareView(), _uiCityWidth, boolHeightChange, GraphicManager::DisplayStructure(), Layer::GetLinearStructure(), and GlobalVar::gpGraphicMgr.

void Renderer::DisplayBuildPreview const uint &  uiW,
const uint &  uiL,
const GLubyte &  rcubR,
const GLubyte &  rcubG,
const GLubyte &  rcubB,
const OPENCITY_GRAPHIC_CODE &  gcode
const
 

Display the specified graphic code with a bounding rectangle

Definition at line 699 of file renderer.cpp.

References GraphicManager::DisplayGC(), Map::GetSquareMaxHeight(), PropertyManager::GetWLH(), GlobalVar::gpGraphicMgr, GlobalVar::gpMapMgr, and GlobalVar::gpPropertyMgr.

void Renderer::DisplaySplash const uint &  rcuiX = 0,
const uint &  rcuiY = 0
 

Display the splash screen at the specified coordinates

Definition at line 525 of file renderer.cpp.

References _uiSplashTex, and Texture::Load().

void Renderer::Home  ) 
 

Reinit the map's position as if the game has just been launched

Definition at line 285 of file renderer.cpp.

References dDeltaX, dDeltaZ, dEyeX, dEyeY, dYRotateAngle, and fXTransDelta.

void Renderer::SetWinSize const int &  rciWidth,
const int &  rciHeight
 

This method _must_ be called whenever the window's size changes. It calculates the viewport and set the correct internal window's width and height

Definition at line 995 of file renderer.cpp.

References iWinHeight.


Member Data Documentation

bool Renderer::boolHeightChange
 

The City class use this to notify the renderer class that the height of the map has changed and the current buffered informations need to be recalculated

Definition at line 192 of file renderer.h.

Referenced by _DisplayMapGrid(), _DisplayTerrain(), City::_Load(), and Display().

GLdouble Renderer::dDeltaX [private]
 

Contains the X value for the translation of the layer. It is used by MoveLeft() and MoveRight()

Definition at line 223 of file renderer.h.

Referenced by Home().

GLdouble Renderer::dDeltaZ [private]
 

Contains the Z value for the translation. It is used by MoveUp() and MoveDown()

Definition at line 228 of file renderer.h.

Referenced by Home().


The documentation for this class was generated from the following files:
Generated on Sat Nov 11 10:21:11 2006 for OpenCity by  doxygen 1.4.2