summaryrefslogtreecommitdiffstats
path: root/Renderer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Renderer.cpp')
-rw-r--r--Renderer.cpp33
1 files changed, 12 insertions, 21 deletions
diff --git a/Renderer.cpp b/Renderer.cpp
index e2ededc..42614a7 100644
--- a/Renderer.cpp
+++ b/Renderer.cpp
@@ -91,7 +91,9 @@ void Renderer::drawCross(const Vertex &m, float r) {
}
void Renderer::renderObject(const LevelObject &object, bool selected, bool highlighted, float scale) {
- if(object.isOfType("Room"))
+ if(object.isOfType("LevelVertex"))
+ renderLevelVertex(*(LevelVertex*)&object, selected, highlighted, scale);
+ else if(object.isOfType("Room"))
renderRoom(*(Room*)&object, selected, highlighted, scale);
else if(object.isOfType("PlayerStart"))
renderPlayerStart(*(PlayerStart*)&object, selected, highlighted, scale);
@@ -99,13 +101,18 @@ void Renderer::renderObject(const LevelObject &object, bool selected, bool highl
renderPortal(*(Portal*)&object, selected, highlighted, scale);
}
-void Renderer::renderVertex(const Vertex &vertex, bool selected, bool highlighted, float scale) {
+void Renderer::renderLevelVertex(const LevelVertex &vertex, bool selected, bool highlighted, float scale) {
+ if(!selected && !highlighted) return;
+
glColor4f(0.0f, 0.0f, 0.0f, 1.0f);
- fillCircle(vertex, 3/scale, 16);
+ fillCircle(*vertex, 3.5f/scale, 16);
glLineWidth(1.0f);
- glColor4f(9.0f, 0.7f, 0.0f, 0.9f);
- drawCircle(vertex, 3/scale, 16);
+ if(highlighted)
+ glColor4f(1.0f, 0.9f, 0.0f, 0.9f);
+ else
+ glColor4f(1.0f, 0.7f, 0.0f, 0.9f);
+ drawCircle(*vertex, 3.5f/scale, 16);
}
void Renderer::renderRoom(const Room &room, bool selected, bool highlighted, float scale) {
@@ -130,11 +137,6 @@ void Renderer::renderRoom(const Room &room, bool selected, bool highlighted, flo
}
drawPolygon(room);
-
- if(selected || highlighted) {
- for(Room::const_iterator v = room.begin(); v != room.end(); v++)
- renderVertex(*v, false, false, scale);
- }
}
void Renderer::renderPlayerStart(const PlayerStart &start, bool selected, bool highlighted, float scale) {
@@ -192,17 +194,6 @@ void Renderer::renderPortal(const Portal &portal, bool selected, bool highlighte
glVertex2f(portal.getPosition().getX()+x, portal.getPosition().getY()+y);
glEnd();
-
- if(highlighted || selected) {
- renderVertex(Vertex(portal.getPosition().getX()-x+ts, portal.getPosition().getY()-y-tc),
- false, false, scale);
- renderVertex(Vertex(portal.getPosition().getX()-x-ts, portal.getPosition().getY()-y+tc),
- false, false, scale);
- renderVertex(Vertex(portal.getPosition().getX()+x+ts, portal.getPosition().getY()+y-tc),
- false, false, scale);
- renderVertex(Vertex(portal.getPosition().getX()+x-ts, portal.getPosition().getY()+y+tc),
- false, false, scale);
- }
}
void Renderer::render(const Level &level, const Rectangle &rect, float scale) {