#define MASK_A 0xFF000000
#endif
-using namespace std; // For STL stuff
-
//
// Button class implementation
//
/*
Some notes about this class:
-- Button colors are hardwired
+- Button colors are hardwired (for plain text buttons)
*/
Button::Button(uint32 x/*= 0*/, uint32 y/*= 0*/, uint32 w/*= 0*/, uint32 h/*= 0*/,
extents.h = buttonUp->h;
}
-Button::Button(uint32 x, uint32 y, uint32 w, uint32 h, string s, Element * parent/*= NULL*/):
+Button::Button(uint32 x, uint32 y, uint32 w, uint32 h, std::string s, Element * parent/*= NULL*/):
Element(x, y, w, h, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0xFF, parent),
activated(false), clicked(false), inside(false),
buttonUp(NULL), buttonDown(NULL), buttonHover(NULL), surfacesAreLocal(true),
// Create the button surfaces here...
}
-Button::Button(uint32 x, uint32 y, string s, Element * parent/*= NULL*/):
+Button::Button(uint32 x, uint32 y, std::string s, Element * parent/*= NULL*/):
Element(x, y, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0xFF, parent),
activated(false), clicked(false), inside(false),
buttonUp(NULL), buttonDown(NULL), buttonHover(NULL), surfacesAreLocal(true),
if (buttonUp == NULL)
return; // Bail out if no surface was created...
- SDL_Rect rect = GetScreenCoords();
-
// Now, draw the appropriate button state!
SDL_Surface * picToShow = buttonUp;
if (buttonDown != NULL && inside && clicked)
picToShow = buttonDown;
+ SDL_Rect rect = GetScreenCoords();
+
+//Need to do coverage list blitting here, to avoid unnecessary drawing when doing mouseovers
+//Also, need to add suport in Gui()...
SDL_BlitSurface(picToShow, NULL, screen, &rect); // This handles alpha blending too! :-D
needToRefreshScreen = true;