Removed unnecessary variables (factoFoo) from do_redraw. Renamed
authorsaiam
Mon, 01 Dec 2008 21:54:22 +0000
changeset 162 f760591b7481
parent 161 ea2f295c279f
child 163 e3db8a0bb89f
Removed unnecessary variables (factoFoo) from do_redraw. Renamed
Terrain::draw to Terrain::drawTerrain to make usage of the function
from inherited classes clearer.
src/proto2/Graphics.cc
src/proto2/Terrain.cc
src/proto2/Terrain.hh
--- a/src/proto2/Graphics.cc	Mon Dec 01 21:49:35 2008 +0000
+++ b/src/proto2/Graphics.cc	Mon Dec 01 21:54:22 2008 +0000
@@ -63,44 +63,19 @@
 void Graphics::do_redraw (void) {
     CL_GraphicContext *gc = win.get_gc();
     
-    // white background
+    // White background
     gc->clear(CL_Color::white);
 
-    const float factorX = GRAPHICS_RESOLUTION_WIDTH / MAP_WIDTH;
-    const float factorY = GRAPHICS_RESOLUTION_HEIGHT / MAP_HEIGHT;
+    // Draw terrain
+    state.drawTerrain(gc);
 
-    // draw terrain
-    state.draw(gc);
-    //terrain.draw(gc);
-    /*
-    // Demonstrates digging, but is very slow
-    Vector tmp(0, 0);
-    CL_Color color;
-    CL_PixelBuffer pix(1, 1, 4, CL_PixelFormat::rgba8888);
-    CL_Surface surf(pix);
-    for (tmp.x = 0; tmp.x < MAP_WIDTH; tmp.x++) {
-        for (tmp.y = 0; tmp.y < MAP_HEIGHT; tmp.y++) {
-            if (state.getType(tmp) == EMPTY) {
-                color = CL_Color(86, 41, 0);
-            } else if (state.getType(tmp) == DIRT) {
-                color = CL_Color(144, 82, 23);
-            } else if (state.getType(tmp) == ROCK) {
-                color = CL_Color(132, 136, 135);
-            } else {
-                // Fale
-            }
-            surf.set_color(color);
-            surf.draw(tmp.x, tmp.y, gc);
-        }
-        }*/
-  
-    // draw players
+    // Draw players
     for (std::list<Player*>::iterator it = state.player_list.begin(); it != state.player_list.end(); it++) {
         Player *p = *it;
         p->draw(gc);
     }        
 
-    // flip window buffer, LIEK NAO
+    // Flip window buffer, LIEK NAO
     win.flip(0);
 }
 
--- a/src/proto2/Terrain.cc	Mon Dec 01 21:49:35 2008 +0000
+++ b/src/proto2/Terrain.cc	Mon Dec 01 21:54:22 2008 +0000
@@ -272,7 +272,7 @@
     this->generatePixelBuffer();
 }
 
-void Terrain::draw(CL_GraphicContext *gc) {
+void Terrain::drawTerrain(CL_GraphicContext *gc) {
     CL_Surface surf(this->pixbuf);
     surf.draw(0,0,gc);
 }
--- a/src/proto2/Terrain.hh	Mon Dec 01 21:49:35 2008 +0000
+++ b/src/proto2/Terrain.hh	Mon Dec 01 21:54:22 2008 +0000
@@ -140,7 +140,7 @@
      *
      * @param gc CL_GraphicContext
      */
-    void draw(CL_GraphicContext *gc);
+    void drawTerrain(CL_GraphicContext *gc);
     /**
      * Draw part of the terrain for given graphiscontext.
      *