// CWall implementation // // Author: Josh Jenkins // Inertia Productions 2003 // http://homepages.ihug.com.au/~grom #include "CWall.h" // Class declaration //////////////////////////////////////////////////////////////////// // Constructor CWall::CWall(): width(13.0f), // Initialize width and height height(0.5f) { color[0] = 1; // Set the wall color color[1] = 0; color[2] = 0; } //////////////////////////////////////////////////////////////////// // Destructor CWall::~CWall() { } //////////////////////////////////////////////////////////////////// // Draw to opengl screen CWall::Draw() { glColor3fv(color); // Set the color using the rgb color set glPushMatrix(); // Store the matrix so we can do the translation glTranslatef(x, y, 0); // Position wall at x,y glBegin(GL_QUADS); // Draw the board with center at (0,0) glVertex3f(0, 0, 0); glVertex3f(0, -height, 0); glVertex3f(width, -height, 0); glVertex3f(width, 0, 0); glEnd(); glPopMatrix(); // Restore previous matrix }