diff --git a/jRed.bmp b/jRed.bmp deleted file mode 100644 index b6dea0f..0000000 Binary files a/jRed.bmp and /dev/null differ diff --git a/red.bmp b/o1.bmp similarity index 100% rename from red.bmp rename to o1.bmp diff --git a/o2.bmp b/o2.bmp new file mode 100644 index 0000000..bcce8b6 Binary files /dev/null and b/o2.bmp differ diff --git a/jWhite.bmp b/o3.bmp similarity index 100% rename from jWhite.bmp rename to o3.bmp diff --git a/lightRed.bmp b/oLight1.bmp similarity index 100% rename from lightRed.bmp rename to oLight1.bmp diff --git a/oLight2.bmp b/oLight2.bmp new file mode 100644 index 0000000..c80e6ef Binary files /dev/null and b/oLight2.bmp differ diff --git a/jLightWhite.bmp b/oLight3.bmp similarity index 100% rename from jLightWhite.bmp rename to oLight3.bmp diff --git a/viewer.cpp b/viewer.cpp index c6d8c33..527be6f 100644 --- a/viewer.cpp +++ b/viewer.cpp @@ -124,10 +124,10 @@ void Viewer::on_realize() return; texture = new GLuint[7]; - LoadGLTextures("red.bmp", texture[0]); - LoadGLTextures("blue.bmp", texture[1]); - LoadGLTextures("lightRed.bmp", texture[2]); - LoadGLTextures("lightBlue.bmp", texture[3]); + LoadGLTextures("x1.bmp", texture[0]); + LoadGLTextures("o1.bmp", texture[1]); + LoadGLTextures("xLight1.bmp", texture[2]); + LoadGLTextures("oLight1.bmp", texture[3]); LoadGLTextures("black.bmp", texture[4]); LoadGLTextures("normal.bmp", bumpMap); LoadGLTextures("floor.bmp", floorTexId); @@ -1680,7 +1680,7 @@ bool Viewer::gameTick() int returnVal = game->tick(); int cubesDeletedAfterTick = game->getLinesCleared(); // String streams used to print score and lines cleared - std::stringstream scoreStream, linesStream; + std::stringstream scoreStream, linesStream, newTexStream; std::string s; // Update the score @@ -1689,10 +1689,24 @@ bool Viewer::gameTick() if (cubesDeletedBeforeTick/100 < cubesDeletedAfterTick/100) { - LoadGLTextures("jWhite.bmp", texture[0]); - LoadGLTextures("jRed.bmp", texture[1]); - LoadGLTextures("jLightWhite.bmp", texture[2]); - LoadGLTextures("jLightRed.bmp", texture[3]); + int level = cubesDeletedAfterTick/100 + 1; + if (level > 3) + level = 3; + + newTexStream << level; + s = "x" + newTexStream.str() + ".bmp"; + LoadGLTextures(s.c_str(), texture[0]); + + s = "o" + newTexStream.str() + ".bmp"; + LoadGLTextures(s.c_str(), texture[1]); + + s = "xLight" + newTexStream.str() + ".bmp"; + LoadGLTextures(s.c_str(), texture[2]); + + s = "oLight" + newTexStream.str() + ".bmp"; + LoadGLTextures(s.c_str(), texture[3]); + + s = ""; } // If a line was cleared update the linesCleared widget if (returnVal > 0) @@ -1759,7 +1773,14 @@ void Viewer::newGame() linesStream << game->getLinesCleared(); linesClearedLabel->set_text("Lines Cleared:\t" + linesStream.str()); + + // Load level 1 textures + LoadGLTextures("x1.bmp", texture[0]); + LoadGLTextures("o1.bmp", texture[1]); + LoadGLTextures("xLight1.bmp", texture[2]); + LoadGLTextures("oLight1.bmp", texture[3]); invalidate(); + } void Viewer::setScoreWidgets(Gtk::Label *score, Gtk::Label *linesCleared) @@ -1801,7 +1822,7 @@ void Viewer::drawStartScreen(bool pick, GLuint texId) // quick and dirty bitmap loader...for 24 bit bitmaps with 1 plane only. // See http://www.dcs.ed.ac.uk/~mxr/gfx/2d/BMP.txt for more info. -int Viewer::ImageLoad(char *filename, Image *image) { +int Viewer::ImageLoad(const char *filename, Image *image) { FILE *file; unsigned long size; // size of the image in bytes. unsigned long i; // standard counter. @@ -1882,7 +1903,7 @@ int Viewer::ImageLoad(char *filename, Image *image) { } // Load Bitmaps And Convert To Textures -int Viewer::LoadGLTextures(char *filename, GLuint &texid) { +int Viewer::LoadGLTextures(const char *filename, GLuint &texid) { // Load Texture Image *image1; diff --git a/viewer.hpp b/viewer.hpp index 274e019..6d19158 100644 --- a/viewer.hpp +++ b/viewer.hpp @@ -76,8 +76,8 @@ class Viewer : public Gtk::GL::DrawingArea { }; typedef struct Image Image; - int ImageLoad(char *filename, Image *image); - int LoadGLTextures(char *filename, GLuint &texid); + int ImageLoad(const char *filename, Image *image); + int LoadGLTextures(const char *filename, GLuint &texid); // Bump mapping stuff int GenNormalizationCubeMap(unsigned int size, GLuint &texid); diff --git a/blue.bmp b/x1.bmp similarity index 100% rename from blue.bmp rename to x1.bmp diff --git a/x2.bmp b/x2.bmp new file mode 100644 index 0000000..8cf5371 Binary files /dev/null and b/x2.bmp differ diff --git a/x3.bmp b/x3.bmp new file mode 100644 index 0000000..a873dfc Binary files /dev/null and b/x3.bmp differ diff --git a/x4.bmp b/x4.bmp new file mode 100644 index 0000000..abbd26a Binary files /dev/null and b/x4.bmp differ diff --git a/lightBlue.bmp b/xLight1.bmp similarity index 100% rename from lightBlue.bmp rename to xLight1.bmp diff --git a/xLight2.bmp b/xLight2.bmp new file mode 100644 index 0000000..dad4e12 Binary files /dev/null and b/xLight2.bmp differ diff --git a/jLightRed.bmp b/xLight3.bmp similarity index 100% rename from jLightRed.bmp rename to xLight3.bmp