Skip to content

Commit

Permalink
Changed file names to something more standard
Browse files Browse the repository at this point in the history
Have 3 levels worth of tiles
  • Loading branch information
Krishna committed Mar 26, 2010
1 parent 5ebb897 commit c1e2a8a
Show file tree
Hide file tree
Showing 16 changed files with 34 additions and 13 deletions.
Binary file removed jRed.bmp
Binary file not shown.
File renamed without changes.
Binary file added o2.bmp
Binary file not shown.
File renamed without changes.
File renamed without changes.
Binary file added oLight2.bmp
Binary file not shown.
File renamed without changes.
43 changes: 32 additions & 11 deletions viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions viewer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
File renamed without changes.
Binary file added x2.bmp
Binary file not shown.
Binary file added x3.bmp
Binary file not shown.
Binary file added x4.bmp
Binary file not shown.
File renamed without changes.
Binary file added xLight2.bmp
Binary file not shown.
File renamed without changes.

0 comments on commit c1e2a8a

Please sign in to comment.