1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-22 17:18:39 +00:00

Add more visual feedback for button states (#8916)

- Add style properties for overriding the the hovered/pressed state
  - By default, hovered buttons are a lighter version of the base color
  - By default, pressed buttons are a darker version of the base color
- Add hovered bg image support for image buttons (style property)
This commit is contained in:
Hugues Ross 2019-10-12 12:44:23 -04:00 committed by SmallJoker
parent 894008ce6f
commit 69a2099c04
10 changed files with 151 additions and 39 deletions

View file

@ -21,6 +21,7 @@
#include "guiKeyChangeMenu.h"
#include "debug.h"
#include "guiButton.h"
#include "serialization.h"
#include <string>
#include <IGUICheckBox.h>
@ -157,7 +158,7 @@ void GUIKeyChangeMenu::regenerateGui(v2u32 screensize)
core::rect<s32> rect(0, 0, 100 * s, 30 * s);
rect += topleft + v2s32(offset.X + 150 * s, offset.Y - 5 * s);
const wchar_t *text = wgettext(k->key.name());
k->button = Environment->addButton(rect, this, k->id, text);
k->button = GUIButton::addButton(Environment, rect, this, k->id, text);
delete[] text;
}
if ((i + 1) % KMaxButtonPerColumns == 0) {
@ -217,16 +218,14 @@ void GUIKeyChangeMenu::regenerateGui(v2u32 screensize)
core::rect<s32> rect(0, 0, 100 * s, 30 * s);
rect += topleft + v2s32(size.X / 2 - 105 * s, size.Y - 40 * s);
const wchar_t *text = wgettext("Save");
Environment->addButton(rect, this, GUI_ID_BACK_BUTTON,
text);
GUIButton::addButton(Environment, rect, this, GUI_ID_BACK_BUTTON, text);
delete[] text;
}
{
core::rect<s32> rect(0, 0, 100 * s, 30 * s);
rect += topleft + v2s32(size.X / 2 + 5 * s, size.Y - 40 * s);
const wchar_t *text = wgettext("Cancel");
Environment->addButton(rect, this, GUI_ID_ABORT_BUTTON,
text);
GUIButton::addButton(Environment, rect, this, GUI_ID_ABORT_BUTTON, text);
delete[] text;
}
}