HOG2
AbsMapUnit.cpp
Go to the documentation of this file.
1 /*
2  * AbsMapUnit.cpp
3  * hog2
4  *
5  * Created by Nathan Sturtevant on 4/27/07.
6  * Copyright 2007 Nathan Sturtevant, University of Alberta. All rights reserved.
7  *
8  */
9 
10 #include "AbsMapUnit.h"
11 
12 void AbsMapUnit::OpenGLDraw(const AbsMapEnvironment *me, const AbsMapSimulationInfo *) const
13 {
14  Map *map = me->GetMap();
15  GLdouble xx, yy, zz, rad;
16  if ((loc.x >= map->GetMapWidth()) || (loc.y >= map->GetMapHeight()))
17  return;
18  map->GetOpenGLCoord(loc.x, loc.y, xx, yy, zz, rad);
19  glColor3f(r, g, b);
20  // if (getObjectType() == kDisplayOnly)
21  // drawTriangle(xx, yy, zz, rad);
22  // else
23  DrawSphere(xx, yy, zz, rad);
24 }
loc::x
int x
Definition: MapGenerators.cpp:296
SimulationInfo
Definition: SimulationInfo.h:13
loc::y
int y
Definition: MapGenerators.cpp:296
DrawSphere
void DrawSphere(GLdouble _x, GLdouble _y, GLdouble _z, GLdouble tRadius)
Definition: GLUtil.cpp:433
AbsMapUnit::r
GLfloat r
Definition: AbsMapUnit.h:42
AbsMapUnit::OpenGLDraw
virtual void OpenGLDraw(const AbsMapEnvironment *, const AbsMapSimulationInfo *) const
Definition: AbsMapUnit.cpp:12
AbsMapUnit.h
loc
Definition: MapGenerators.cpp:296
AbsMapUnit::b
GLfloat b
Definition: AbsMapUnit.h:42
AbsMapUnit::g
GLfloat g
Definition: AbsMapUnit.h:42
Map::GetMapWidth
long GetMapWidth() const
return the width of the map
Definition: Map.h:163
Map::GetMapHeight
long GetMapHeight() const
return the height of the map
Definition: Map.h:165
Map::GetOpenGLCoord
bool GetOpenGLCoord(int _x, int _y, GLdouble &x, GLdouble &y, GLdouble &z, GLdouble &radius) const
Get the openGL coordinates of a given tile.
Definition: Map.cpp:1826
Map
A tile-based representation of the world.
Definition: Map.h:142