//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ class PushButton { public: // constructor PushButton(int x, int y, int w, int h, char *text, float r = 0.5, float g = 0.5, float b = 0.5); // destructor ~PushButton(); // void methods void Draw(); void Depress(); // value-returning methods bool WasClicked(int mouse_x, int mouse_y); private: int LeftX, BotY, Width, Height; char * Label; float Red, Green, Blue; }; // end of class PushButton PushButton::PushButton(int x, int y, int w, int h, char *text, float r, float g, float b) { LeftX = x; BotY = y; Width = w; Height = h; Red = r; Green = g; Blue = b; Label = new char[strlen(text)+1]; strcpy(Label, text); } // end of PushButton::PushButton PushButton::~PushButton() { delete [] Label; } // end of PushButton::~PushButton void PushButton::Draw() { // draw button glBegin(GL_POLYGON); glColor3f(Red, Green, Blue); glVertex2i(LeftX, BotY); glVertex2i(LeftX + Width, BotY); glVertex2i(LeftX + Width, BotY + Height); glVertex2i(LeftX, BotY + Height); glEnd(); // place text in center of button int textwidth = 0; for (unsigned k=0; k