mirror of https://github.com/mgba-emu/mgba.git
mGUI: Add arrow keys to symbol and add unicode codepoints
This commit is contained in:
parent
f37c72044e
commit
6c3fb29d53
|
@ -55,6 +55,10 @@ enum GUIIcon {
|
|||
GUI_ICON_BUTTON_HOME,
|
||||
GUI_ICON_STATUS_FAST_FORWARD,
|
||||
GUI_ICON_STATUS_MUTE,
|
||||
GUI_ICON_LEFT,
|
||||
GUI_ICON_UP,
|
||||
GUI_ICON_RIGHT,
|
||||
GUI_ICON_DOWN,
|
||||
GUI_ICON_MAX,
|
||||
};
|
||||
|
||||
|
|
BIN
res/font-new.png
BIN
res/font-new.png
Binary file not shown.
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
BIN
res/icons.png
BIN
res/icons.png
Binary file not shown.
Before Width: | Height: | Size: 541 B After Width: | Height: | Size: 619 B |
BIN
res/icons2x.png
BIN
res/icons2x.png
Binary file not shown.
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.4 KiB |
|
@ -152,6 +152,10 @@ const struct GUIIconMetric defaultIconMetrics[] = {
|
|||
[GUI_ICON_BUTTON_TRIANGLE] = { 34, 34, 12, 11 },
|
||||
[GUI_ICON_BUTTON_SQUARE] = { 50, 34, 12, 11 },
|
||||
[GUI_ICON_BUTTON_HOME] = { 66, 34, 12, 11 },
|
||||
[GUI_ICON_LEFT] = { 82, 34, 12, 12 },
|
||||
[GUI_ICON_UP] = { 98, 34, 12, 12 },
|
||||
[GUI_ICON_RIGHT] = { 114, 34, 12, 12 },
|
||||
[GUI_ICON_DOWN] = { 130, 34, 12, 12 },
|
||||
[GUI_ICON_STATUS_FAST_FORWARD] = { 2, 50, 12, 12 },
|
||||
[GUI_ICON_STATUS_MUTE] = { 17, 50, 14, 12 },
|
||||
};
|
||||
|
|
|
@ -40,17 +40,40 @@ void GUIFontPrint(struct GUIFont* font, int x, int y, enum GUIAlignment align, u
|
|||
size_t len = strlen(text);
|
||||
while (len) {
|
||||
uint32_t c = utf8Char(&text, &len);
|
||||
if (c == '\1') {
|
||||
bool icon = false;
|
||||
switch (c) {
|
||||
case 1:
|
||||
c = utf8Char(&text, &len);
|
||||
if (c < GUI_ICON_MAX) {
|
||||
GUIFontDrawIcon(font, x, y, (align & GUI_ALIGN_HCENTER) | GUI_ALIGN_BOTTOM, GUI_ORIENT_0, color, c);
|
||||
unsigned w;
|
||||
GUIFontIconMetrics(font, c, &w, 0);
|
||||
x += w;
|
||||
icon = true;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
case 0x2190:
|
||||
case 0x2191:
|
||||
case 0x2192:
|
||||
case 0x2193:
|
||||
c = GUI_ICON_LEFT + c - 0x2190;
|
||||
icon = true;
|
||||
break;
|
||||
case 0x23E9:
|
||||
c = GUI_ICON_STATUS_FAST_FORWARD;
|
||||
icon = true;
|
||||
break;
|
||||
case 0x1F507:
|
||||
c = GUI_ICON_STATUS_MUTE;
|
||||
icon = true;
|
||||
break;
|
||||
default:
|
||||
GUIFontDrawGlyph(font, x, y, color, c);
|
||||
x += GUIFontGlyphWidth(font, c);
|
||||
break;
|
||||
}
|
||||
|
||||
if (icon) {
|
||||
GUIFontDrawIcon(font, x, y, GUI_ALIGN_BOTTOM, GUI_ORIENT_0, color, c);
|
||||
unsigned w;
|
||||
GUIFontIconMetrics(font, c, &w, 0);
|
||||
x += w;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue