an attempt to make disabled buttons more obviously disabled (bug #9121)

This commit is contained in:
Patrick Parker 2007-06-22 04:14:10 +00:00
parent b1e9f99642
commit c13b07c569
4 changed files with 13 additions and 2 deletions

View File

@ -52,6 +52,7 @@ Version 1.3.3+svn:
terrain defense and turns to reach
* restore search of no-team-only map labels
* ability to delete Add-Ons
* make disabled buttons more obviously disabled
* Miscellaneous and bugfixes
* fix bug #4299: word wrap for menus with very long option strings
* various bugfixes and code cleanups

View File

@ -34,6 +34,13 @@ SDL_Color int_to_color(const Uint32 rgb) {
return to_return;
}
Uint32 color_to_int(const SDL_Color& color) {
Uint32 to_return = color.r;
to_return = (to_return << 8) & color.g;
to_return = (to_return << 8) & color.b;
return to_return;
}
SDLKey sdl_keysym_from_name(std::string const &keyname)
{
static bool initialized = false;

View File

@ -143,6 +143,7 @@ bool operator==(const SDL_Color& a, const SDL_Color& b);
bool operator!=(const SDL_Color& a, const SDL_Color& b);
SDL_Color inverse(const SDL_Color& colour);
SDL_Color int_to_color(const Uint32 rgb);
Uint32 color_to_int(const SDL_Color& rgb);
class config; // no need to include config.hpp

View File

@ -209,8 +209,10 @@ void button::draw_contents()
SDL_Color button_colour = font::BUTTON_COLOUR;
if (!enabled()) {
image = greyscale_image(image);
button_colour = font::STONED_COLOUR;
static const Uint32 disabled_btn_color = 0xAAAAAA;
static const double disabled_btn_adjust = 0.18;
image = blend_surface(greyscale_image(image), disabled_btn_adjust, disabled_btn_color);
button_colour = font::GRAY_COLOUR;
}
video().blit_surface(loc.x, loc.y, image);