HOG2
mapalgorithms
MapUnit.cpp
Go to the documentation of this file.
1
/*
2
* MapUnit.cpp
3
* hog2
4
*
5
* Created by Nathan Sturtevant on 4/23/07.
6
* Copyright 2007 Nathan Sturtevant, University of Alberta. All rights reserved.
7
*
8
*/
9
10
#include "
MapUnit.h
"
11
#include "
GLUtil.h
"
12
13
void
MapUnit::OpenGLDraw
(
const
MapEnvironment
*me,
const
MapSimulationInfo
*)
const
14
{
15
// me->OpenGLDraw(loc);
16
Map
*map = me->
GetMap
();
17
GLdouble xx, yy, zz, rad;
18
if
((
loc
.
x
>= map->
GetMapWidth
()) || (
loc
.
y
>= map->
GetMapHeight
()))
19
return
;
20
map->
GetOpenGLCoord
(
loc
.
x
,
loc
.
y
, xx, yy, zz, rad);
21
glColor3f(
r
,
g
,
b
);
22
// if (getObjectType() == kDisplayOnly)
23
// drawTriangle(xx, yy, zz, rad);
24
// else
25
DrawSphere
(xx, yy, zz, rad);
26
}
loc::x
int x
Definition:
MapGenerators.cpp:296
SimulationInfo
Definition:
SimulationInfo.h:13
loc::y
int y
Definition:
MapGenerators.cpp:296
MapEnvironment::GetMap
Map * GetMap() const
Definition:
Map2DEnvironment.h:200
DrawSphere
void DrawSphere(GLdouble _x, GLdouble _y, GLdouble _z, GLdouble tRadius)
Definition:
GLUtil.cpp:433
MapEnvironment
Definition:
Map2DEnvironment.h:133
loc
Definition:
MapGenerators.cpp:296
MapUnit::b
GLfloat b
Definition:
MapUnit.h:34
MapUnit::OpenGLDraw
virtual void OpenGLDraw(const MapEnvironment *, const MapSimulationInfo *) const
Definition:
MapUnit.cpp:13
Map::GetMapWidth
long GetMapWidth() const
return the width of the map
Definition:
Map.h:163
GLUtil.h
MapUnit::g
GLfloat g
Definition:
MapUnit.h:34
Map::GetMapHeight
long GetMapHeight() const
return the height of the map
Definition:
Map.h:165
MapUnit::r
GLfloat r
Definition:
MapUnit.h:34
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
MapUnit.h
Map
A tile-based representation of the world.
Definition:
Map.h:142
Generated by
1.8.17