Use grayscale IPF for disabled widget variations instead of specific images

This commit is contained in:
Charles Dang 2013-06-08 22:51:40 +11:00
parent d971585a20
commit 7fe8cc5f84
8 changed files with 15 additions and 15 deletions

View File

@ -45,7 +45,7 @@
[image]
w = {SIZE}
h = {SIZE}
name = {IMAGE} + "-disabled.png{IPF}"
name = {IMAGE} + ".png~GS(){IPF}"
[/image]
[image]

View File

@ -44,7 +44,7 @@
[image]
w = "(width)"
h = "(height)"
name = "buttons/{BASE_NAME}-disabled.png{IPF}"
name = "buttons/{BASE_NAME}.png~GS(){IPF}"
[/image]
{GUI__CENTERED_TEXT ({FONT_SIZE}) () ({GUI__FONT_COLOR_DISABLED__TITLE})}

View File

@ -89,7 +89,7 @@ if(positioner_length - {POSITIONER_LEFT} - {POSITIONER_RIGHT} < 0
[/state_enabled]
[state_disabled]
{_GUI_STATE ({GROOVE_LEFT}) ({GROOVE_RIGHT}) ({POSITIONER_LEFT}) ({POSITIONER_RIGHT}) "-disabled.png" ({IMAGE_MIDDLE}) }
{_GUI_STATE ({GROOVE_LEFT}) ({GROOVE_RIGHT}) ({POSITIONER_LEFT}) ({POSITIONER_RIGHT}) ".png~GS()" ({IMAGE_MIDDLE}) }
[/state_disabled]
[state_pressed]

View File

@ -45,7 +45,7 @@
[image]
w = {SIZE}
h = {SIZE}
name = {IMAGE} + "-disabled.png{IPF}"
name = {IMAGE} + ".png~GS(){IPF}"
[/image]
[image]

View File

@ -52,7 +52,7 @@
[draw]
[image]
name = "buttons/checkbox-disabled.png"
name = "buttons/checkbox.png~GS()"
[/image]
{_GUI_TEXT ({EXTRA_WIDTH}) ({FONT_SIZE}) ({GUI__FONT_COLOR_DISABLED__TITLE}) }
@ -98,7 +98,7 @@
[draw]
[image]
name = "buttons/checkbox-disabled-pressed.png"
name = "buttons/checkbox-pressed.png~GS()"
[/image]
{_GUI_TEXT ({EXTRA_WIDTH}) ({FONT_SIZE}) ({GUI__FONT_COLOR_DISABLED__TITLE}) }

View File

@ -88,7 +88,7 @@ if(positioner_length - {POSITIONER_TOP} - {POSITIONER_BOTTOM} < 0
[/state_enabled]
[state_disabled]
{_GUI_STATE ({GROOVE_TOP}) ({GROOVE_BOTTOM}) ({POSITIONER_TOP}) ({POSITIONER_BOTTOM}) "-disabled.png" ({IMAGE_MIDDLE}) }
{_GUI_STATE ({GROOVE_TOP}) ({GROOVE_BOTTOM}) ({POSITIONER_TOP}) ({POSITIONER_BOTTOM}) ".png~GS()" ({IMAGE_MIDDLE}) }
[/state_disabled]
[state_pressed]

View File

@ -97,8 +97,8 @@ void button::load_images() {
surface pressed_image(image::get_image(button_image_name_ + "-pressed.png"));
surface active_image(image::get_image(button_image_name_ + "-active.png"));
surface disabled_image;
if (file_exists(game_config::path + "/images/" + button_image_name_ + "-disabled.png"))
disabled_image.assign((image::get_image(button_image_name_ + "-disabled.png")));
if (file_exists(game_config::path + "/images/" + button_image_name_ + ".png~GS()"))
disabled_image.assign((image::get_image(button_image_name_ + ".png~GS()")));
surface pressed_disabled_image, pressed_active_image, touched_image;
static const Uint32 disabled_btn_color = 0xAAAAAA;
@ -109,10 +109,10 @@ void button::load_images() {
overlayPressedImage_.assign(image::get_image(button_overlay_image_name_ + size_postfix + "-pressed.png"));
if (file_exists(game_config::path + "/images/" + button_overlay_image_name_ + size_postfix + "-active.png"))
overlayActiveImage_.assign(image::get_image(button_overlay_image_name_ + size_postfix + "-active.png"));
if (file_exists(game_config::path + "/images/" + button_overlay_image_name_ + size_postfix + "-pressed-disabled.png"))
overlayPressedDisabledImage_.assign(image::get_image(button_overlay_image_name_ + size_postfix + "-pressed-disabled.png"));
if (file_exists(game_config::path + "/images/" + button_overlay_image_name_ + "_30-disabled.png"))
overlayDisabledImage_.assign(image::get_image(button_overlay_image_name_ + "_30-disabled.png"));
if (file_exists(game_config::path + "/images/" + button_overlay_image_name_ + size_postfix + "-pressed.png~GS()"))
overlayPressedDisabledImage_.assign(image::get_image(button_overlay_image_name_ + size_postfix + "-pressed.png~GS()"));
if (file_exists(game_config::path + "/images/" + button_overlay_image_name_ + "_30.png~GS()"))
overlayDisabledImage_.assign(image::get_image(button_overlay_image_name_ + "_30.png~GS()"));
if (overlayDisabledImage_.null())
overlayDisabledImage_ = blend_surface(greyscale_image(overlayImage_),
disabled_btn_adjust, disabled_btn_color);
@ -143,7 +143,7 @@ void button::load_images() {
if (pressed_active_image.null())
pressed_active_image.assign(pressed_image);
pressed_disabled_image.assign(image::get_image(button_image_name_ + "-disabled-pressed.png"));
pressed_disabled_image.assign(image::get_image(button_image_name_ + "pressed.png~GS()"));
if (pressed_disabled_image.null())
pressed_disabled_image = blend_surface(greyscale_image(pressed_image),
disabled_btn_adjust, disabled_btn_color);

View File

@ -26,7 +26,7 @@
namespace {
const std::string slider_image = ".png";
const std::string disabled_image = "-disabled.png";
const std::string disabled_image = ".png~GS()";
const std::string pressed_image = "-pressed.png";
const std::string active_image = "-active.png";
}