--- a/src/Terrain.hh Thu Jan 22 00:28:26 2009 +0200
+++ b/src/Terrain.hh Thu Jan 22 01:53:05 2009 +0200
@@ -4,9 +4,12 @@
#include "Vector.hh"
#include "Types.hh"
#include "Config.hh"
+#include "Configuration.hh"
#include "Graphics/Drawable.hh"
+#include <vector>
+
/**
* Different types of terrain available
*/
@@ -22,27 +25,6 @@
};
/**
- * Terrain "pixel" type
- */
-typedef uint8_t TerrainPixel;
-
-/**
- * Terrain configuration
- */
-struct TerrainConfig {
- /** Size of the terrain field*/
- PixelDimensions dimensions;
-
- /** Set to nonzero to generate random map */
- int random_seed;
-
- /** Defaults */
- TerrainConfig (void) : dimensions(TERRAIN_WIDTH, TERRAIN_HEIGHT), random_seed(TERRAIN_RANDOM_SEED) { }
-};
-
-#include <vector>
-
-/**
* Terrain class. Represents game terrain and contains member
* functions to manipulate terrain and get info about it.
*
@@ -59,10 +41,13 @@
/** Terrain dimensions */
PixelDimension width, height;
-
+
+#if GRAPHICS_ENABLED
/** We pre-render the textured terrain data for display */
CL_PixelBuffer pixbuf;
+#endif
+
// XXX: terrain texture
std::vector<std::vector<int> > texture;
@@ -103,8 +88,10 @@
inline void setType (PixelDimension x, PixelDimension y, TerrainType t) {
terrain_buf[y * width + x] = (TerrainPixel) t;
+#if GRAPHICS_ENABLED
// XXX: locking?
pixbuf.draw_pixel(x, y, getTexturePixel(x, y));
+#endif
}
/**
@@ -241,6 +228,7 @@
*/
Vector getNormal (Vector point, Vector prevPoint) const;
+#if GRAPHICS_ENABLED
/**
* Draw the terrain onto the given graphics context
*
@@ -248,6 +236,7 @@
* @param camera view position
*/
virtual void draw (graphics::Display &display, PixelCoordinate camera = PixelCoordinate(0, 0));
+#endif
};
#endif