Fix onscreen keyboard capital letters, make it sort of transparent too

This commit is contained in:
UnknownShadow200 2024-04-12 11:48:19 +10:00
parent 361859cd09
commit 4bda9ee2c1
5 changed files with 104 additions and 90 deletions

View File

@ -177,13 +177,17 @@ void Context2D_Free(struct Context2D* ctx) {
Mem_Free(ctx->bmp.scan0); Mem_Free(ctx->bmp.scan0);
} }
#define BitmapColor_Raw(r, g, b) (BitmapColor_R_Bits(r) | BitmapColor_G_Bits(g) | BitmapColor_B_Bits(b))
void Gradient_Noise(struct Context2D* ctx, BitmapCol color, int variation, void Gradient_Noise(struct Context2D* ctx, BitmapCol color, int variation,
int x, int y, int width, int height) { int x, int y, int width, int height) {
struct Bitmap* bmp = (struct Bitmap*)ctx; struct Bitmap* bmp = (struct Bitmap*)ctx;
BitmapCol* dst; BitmapCol* dst;
int R, G, B, xx, yy, n; int R, G, B, xx, yy, n;
float noise; int noise, delta;
cc_uint32 alpha;
if (!Drawer2D_Clamp(ctx, &x, &y, &width, &height)) return; if (!Drawer2D_Clamp(ctx, &x, &y, &width, &height)) return;
alpha = BitmapColor_A_Bits(color);
for (yy = 0; yy < height; yy++) { for (yy = 0; yy < height; yy++) {
dst = Bitmap_GetRow(bmp, y + yy) + x; dst = Bitmap_GetRow(bmp, y + yy) + x;
@ -191,13 +195,20 @@ void Gradient_Noise(struct Context2D* ctx, BitmapCol color, int variation,
for (xx = 0; xx < width; xx++, dst++) { for (xx = 0; xx < width; xx++, dst++) {
n = (x + xx) + (y + yy) * 57; n = (x + xx) + (y + yy) * 57;
n = (n << 13) ^ n; n = (n << 13) ^ n;
noise = 1.0f - ((n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0f;
R = BitmapCol_R(color) + (int)(noise * variation); Drawer2D_ClampPixel(R); /*
G = BitmapCol_G(color) + (int)(noise * variation); Drawer2D_ClampPixel(G); float noise = 1.0f - ((n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0f;
B = BitmapCol_B(color) + (int)(noise * variation); Drawer2D_ClampPixel(B); int delta = (int)(noise * variation);
*/
/* Fixed point equivalent to the above expression */
noise = ((n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff);
delta = (((1024 - noise / 0x100000)) * variation) >> 10;
*dst = BitmapColor_RGB(R, G, B); R = BitmapCol_R(color) + delta; Drawer2D_ClampPixel(R);
G = BitmapCol_G(color) + delta; Drawer2D_ClampPixel(G);
B = BitmapCol_B(color) + delta; Drawer2D_ClampPixel(B);
*dst = BitmapColor_Raw(R, G, B) | alpha;
} }
} }
} }

View File

@ -429,6 +429,7 @@ void Widget_Reset(void* widget) {
w->verAnchor = ANCHOR_MIN; w->verAnchor = ANCHOR_MIN;
w->xOffset = 0; w->yOffset = 0; w->xOffset = 0; w->yOffset = 0;
w->MenuClick = NULL; w->MenuClick = NULL;
w->meta.ptr = NULL;
} }
int Widget_Contains(void* widget, int x, int y) { int Widget_Contains(void* widget, int x, int y) {

View File

@ -139,7 +139,10 @@ void Screen_InputUp(void* screen, int key);
/* (does nothing) */ /* (does nothing) */
void Screen_PointerUp(void* s, int id, int x, int y); void Screen_PointerUp(void* s, int id, int x, int y);
typedef void (*Widget_LeftClick)(void* screen, void* widget); typedef void (*Widget_LeftClick)(void* screen, void* widget);
union WidgetMeta { int val; void* ptr; };
struct WidgetVTABLE { struct WidgetVTABLE {
/* Draws this widget on-screen. */ /* Draws this widget on-screen. */
void (*Render)(void* elem, double delta); void (*Render)(void* elem, double delta);
@ -175,7 +178,8 @@ struct WidgetVTABLE {
cc_uint8 flags; /* Flags controlling the widget's interactability */ \ cc_uint8 flags; /* Flags controlling the widget's interactability */ \
cc_uint8 horAnchor, verAnchor; /* The reference point for when this widget is resized */ \ cc_uint8 horAnchor, verAnchor; /* The reference point for when this widget is resized */ \
int xOffset, yOffset; /* Offset from the reference point */ \ int xOffset, yOffset; /* Offset from the reference point */ \
Widget_LeftClick MenuClick; Widget_LeftClick MenuClick; \
union WidgetMeta meta;
/* Whether a widget is prevented from being interacted with */ /* Whether a widget is prevented from being interacted with */
#define WIDGET_FLAG_DISABLED 0x01 #define WIDGET_FLAG_DISABLED 0x01

View File

@ -348,7 +348,8 @@ static void ListScreen_MoveForwards(void* screen, void* b) {
} }
static cc_string ListScreen_UNSAFE_GetCur(struct ListScreen* s, void* widget) { static cc_string ListScreen_UNSAFE_GetCur(struct ListScreen* s, void* widget) {
int i = Screen_Index(s, widget); struct ButtonWidget* btn = (struct ButtonWidget*)widget;
int i = btn->meta.val;
return ListScreen_UNSAFE_Get(s, s->currentIndex + i); return ListScreen_UNSAFE_Get(s, s->currentIndex + i);
} }
@ -399,6 +400,7 @@ static void ListScreen_Init(void* screen) {
for (i = 0; i < LIST_SCREEN_ITEMS; i++) for (i = 0; i < LIST_SCREEN_ITEMS; i++)
{ {
ButtonWidget_Add(s, &s->btns[i], 300, s->EntryClick); ButtonWidget_Add(s, &s->btns[i], 300, s->EntryClick);
s->btns[i].meta.val = i;
} }
width = s->UploadClick && Input_TouchMode ? 140 : 400; width = s->UploadClick && Input_TouchMode ? 140 : 400;
@ -2387,9 +2389,8 @@ static void MenuOptionsScreen_Layout(void* screen);
static struct MenuOptionsScreen { static struct MenuOptionsScreen {
Screen_Body Screen_Body
struct MenuInputDesc* descs;
const char* descriptions[MENUOPTS_MAX_OPTS + 1]; const char* descriptions[MENUOPTS_MAX_OPTS + 1];
int activeI; struct ButtonWidget* activeBtn;
InitMenuOptions DoInit, DoRecreateExtra, OnHacksChanged; InitMenuOptions DoInit, DoRecreateExtra, OnHacksChanged;
int numButtons, numCore; int numButtons, numCore;
struct FontDesc titleFont, textFont; struct FontDesc titleFont, textFont;
@ -2399,6 +2400,7 @@ static struct MenuOptionsScreen {
const char* extHelpDesc; const char* extHelpDesc;
} MenuOptionsScreen_Instance; } MenuOptionsScreen_Instance;
static struct MenuInputDesc menuOpts_descs[MENUOPTS_MAX_OPTS];
static struct Widget* menuOpts_widgets[MENUOPTS_MAX_OPTS + 1] = { static struct Widget* menuOpts_widgets[MENUOPTS_MAX_OPTS + 1] = {
NULL,NULL,NULL,NULL,NULL, NULL,NULL,NULL,NULL,NULL, NULL,NULL,NULL,NULL,NULL, NULL,NULL,NULL,NULL,NULL,
NULL, NULL,
@ -2423,21 +2425,22 @@ static void MenuOptionsScreen_SetFPS(const cc_string* v) {
Game_SetFpsLimit(method); Game_SetFpsLimit(method);
} }
static void MenuOptionsScreen_Update(struct MenuOptionsScreen* s, int i) { static void MenuOptionsScreen_Update(struct MenuOptionsScreen* s, struct ButtonWidget* btn) {
cc_string title; char titleBuffer[STRING_SIZE]; cc_string title; char titleBuffer[STRING_SIZE];
String_InitArray(title, titleBuffer); String_InitArray(title, titleBuffer);
String_AppendConst(&title, s->buttons[i].optName); String_AppendConst(&title, btn->optName);
if (s->buttons[i].GetValue) { if (btn->GetValue) {
String_AppendConst(&title, ": "); String_AppendConst(&title, ": ");
s->buttons[i].GetValue(&title); btn->GetValue(&title);
} }
ButtonWidget_Set(&s->buttons[i], &title, &s->titleFont); ButtonWidget_Set(btn, &title, &s->titleFont);
} }
CC_NOINLINE static void MenuOptionsScreen_Set(struct MenuOptionsScreen* s, int i, const cc_string* text) { CC_NOINLINE static void MenuOptionsScreen_Set(struct MenuOptionsScreen* s,
s->buttons[i].SetValue(text); struct ButtonWidget* btn, const cc_string* text) {
MenuOptionsScreen_Update(s, i); btn->SetValue(text);
MenuOptionsScreen_Update(s, btn);
} }
CC_NOINLINE static void MenuOptionsScreen_FreeExtHelp(struct MenuOptionsScreen* s) { CC_NOINLINE static void MenuOptionsScreen_FreeExtHelp(struct MenuOptionsScreen* s) {
@ -2467,7 +2470,7 @@ static void MenuOptionsScreen_SelectExtHelp(struct MenuOptionsScreen* s, int idx
cc_string descRaw, descLines[5]; cc_string descRaw, descLines[5];
MenuOptionsScreen_FreeExtHelp(s); MenuOptionsScreen_FreeExtHelp(s);
if (s->activeI >= 0) return; if (s->activeBtn) return;
desc = s->descriptions[idx]; desc = s->descriptions[idx];
if (!desc) return; if (!desc) return;
@ -2485,14 +2488,14 @@ static void MenuOptionsScreen_SelectExtHelp(struct MenuOptionsScreen* s, int idx
static void MenuOptionsScreen_OnDone(const cc_string* value, cc_bool valid) { static void MenuOptionsScreen_OnDone(const cc_string* value, cc_bool valid) {
struct MenuOptionsScreen* s = &MenuOptionsScreen_Instance; struct MenuOptionsScreen* s = &MenuOptionsScreen_Instance;
if (valid) { if (valid) {
MenuOptionsScreen_Set(s, s->activeI, value); MenuOptionsScreen_Set(s, s->activeBtn, value);
/* Marking screen as dirty fixes changed option widget appearing wrong */ /* Marking screen as dirty fixes changed option widget appearing wrong */
/* for a few frames (e.g. Chatlines options changed from '12' to '1') */ /* for a few frames (e.g. Chatlines options changed from '12' to '1') */
s->dirty = true; s->dirty = true;
} }
MenuOptionsScreen_SelectExtHelp(s, s->activeI); MenuOptionsScreen_SelectExtHelp(s, Screen_Index(s, s->activeBtn));
s->activeI = -1; s->activeBtn = NULL;
} }
static int MenuOptionsScreen_PointerMove(void* screen, int id, int x, int y) { static int MenuOptionsScreen_PointerMove(void* screen, int id, int x, int y) {
@ -2501,7 +2504,7 @@ static int MenuOptionsScreen_PointerMove(void* screen, int id, int x, int y) {
if (i == -1 || i == s->selectedI) return true; if (i == -1 || i == s->selectedI) return true;
s->selectedI = i; s->selectedI = i;
if (s->activeI == -1) MenuOptionsScreen_SelectExtHelp(s, i); if (!s->activeBtn) MenuOptionsScreen_SelectExtHelp(s, i);
return true; return true;
} }
@ -2517,6 +2520,7 @@ static void MenuOptionsScreen_InitButtons(struct MenuOptionsScreen* s, const str
btn->optName = btns[i].name; btn->optName = btns[i].name;
btn->GetValue = btns[i].GetValue; btn->GetValue = btns[i].GetValue;
btn->SetValue = btns[i].SetValue; btn->SetValue = btns[i].SetValue;
btn->meta.ptr = &menuOpts_descs[i];
s->widgets[i] = (struct Widget*)btn; s->widgets[i] = (struct Widget*)btn;
} }
s->numButtons = count; s->numButtons = count;
@ -2534,35 +2538,33 @@ static void MenuOptionsScreen_Bool(void* screen, void* widget) {
isOn = String_CaselessEqualsConst(&value, "ON"); isOn = String_CaselessEqualsConst(&value, "ON");
value = String_FromReadonly(isOn ? "OFF" : "ON"); value = String_FromReadonly(isOn ? "OFF" : "ON");
MenuOptionsScreen_Set(s, Screen_Index(s, btn), &value); MenuOptionsScreen_Set(s, btn, &value);
} }
static void MenuOptionsScreen_Enum(void* screen, void* widget) { static void MenuOptionsScreen_Enum(void* screen, void* widget) {
cc_string value; char valueBuffer[STRING_SIZE]; cc_string value; char valueBuffer[STRING_SIZE];
struct MenuOptionsScreen* s = (struct MenuOptionsScreen*)screen; struct MenuOptionsScreen* s = (struct MenuOptionsScreen*)screen;
struct ButtonWidget* btn = (struct ButtonWidget*)widget; struct ButtonWidget* btn = (struct ButtonWidget*)widget;
int index;
struct MenuInputDesc* desc; struct MenuInputDesc* desc;
const char* const* names; const char* const* names;
int raw, count; int raw, count;
index = Screen_Index(s, btn);
String_InitArray(value, valueBuffer); String_InitArray(value, valueBuffer);
btn->GetValue(&value); btn->GetValue(&value);
desc = &s->descs[index]; desc = (struct MenuInputDesc*)btn->meta.ptr;
names = desc->meta.e.Names; names = desc->meta.e.Names;
count = desc->meta.e.Count; count = desc->meta.e.Count;
raw = (Utils_ParseEnum(&value, 0, names, count) + 1) % count; raw = (Utils_ParseEnum(&value, 0, names, count) + 1) % count;
value = String_FromReadonly(names[raw]); value = String_FromReadonly(names[raw]);
MenuOptionsScreen_Set(s, index, &value); MenuOptionsScreen_Set(s, btn, &value);
} }
static void MenuInputOverlay_CheckStillValid(struct MenuOptionsScreen* s) { static void MenuInputOverlay_CheckStillValid(struct MenuOptionsScreen* s) {
if (s->activeI == -1) return; if (!s->activeBtn) return;
if (s->widgets[s->activeI]->flags & WIDGET_FLAG_DISABLED) { if (s->activeBtn->flags & WIDGET_FLAG_DISABLED) {
/* source button is disabled now, so close open input overlay */ /* source button is disabled now, so close open input overlay */
MenuInputOverlay_Close(&MenuInputOverlay, false); MenuInputOverlay_Close(&MenuInputOverlay, false);
} }
@ -2575,11 +2577,11 @@ static void MenuOptionsScreen_Input(void* screen, void* widget) {
struct MenuInputDesc* desc; struct MenuInputDesc* desc;
MenuOptionsScreen_FreeExtHelp(s); MenuOptionsScreen_FreeExtHelp(s);
s->activeI = Screen_Index(s, btn); s->activeBtn = btn;
String_InitArray(value, valueBuffer); String_InitArray(value, valueBuffer);
btn->GetValue(&value); btn->GetValue(&value);
desc = &s->descs[s->activeI]; desc = (struct MenuInputDesc*)btn->meta.ptr;
MenuInputOverlay_Show(desc, &value, MenuOptionsScreen_OnDone, Gui.TouchUI); MenuInputOverlay_Show(desc, &value, MenuOptionsScreen_OnDone, Gui.TouchUI);
} }
@ -2603,7 +2605,7 @@ static void MenuOptionsScreen_Init(void* screen) {
s->descriptions[i] = NULL; s->descriptions[i] = NULL;
} }
s->activeI = -1; s->activeBtn = NULL;
s->selectedI = -1; s->selectedI = -1;
s->DoInit(s); s->DoInit(s);
@ -2656,8 +2658,9 @@ static void MenuOptionsScreen_ContextRecreated(void* screen) {
Gui_MakeBodyFont(&s->textFont); Gui_MakeBodyFont(&s->textFont);
Screen_UpdateVb(screen); Screen_UpdateVb(screen);
for (i = 0; i < s->numButtons; i++) { for (i = 0; i < s->numButtons; i++)
if (s->widgets[i]) MenuOptionsScreen_Update(s, i); {
if (s->widgets[i]) MenuOptionsScreen_Update(s, &s->buttons[i]);
} }
ButtonWidget_SetConst(&s->done, "Done", &s->titleFont); ButtonWidget_SetConst(&s->done, "Done", &s->titleFont);
@ -2673,13 +2676,12 @@ static const struct ScreenVTABLE MenuOptionsScreen_VTABLE = {
Menu_PointerDown, Screen_PointerUp, MenuOptionsScreen_PointerMove, Screen_TMouseScroll, Menu_PointerDown, Screen_PointerUp, MenuOptionsScreen_PointerMove, Screen_TMouseScroll,
MenuOptionsScreen_Layout, MenuOptionsScreen_ContextLost, MenuOptionsScreen_ContextRecreated MenuOptionsScreen_Layout, MenuOptionsScreen_ContextLost, MenuOptionsScreen_ContextRecreated
}; };
void MenuOptionsScreen_Show(struct MenuInputDesc* descs, InitMenuOptions init) { void MenuOptionsScreen_Show(InitMenuOptions init) {
struct MenuOptionsScreen* s = &MenuOptionsScreen_Instance; struct MenuOptionsScreen* s = &MenuOptionsScreen_Instance;
s->grabsInput = true; s->grabsInput = true;
s->closable = true; s->closable = true;
s->VTABLE = &MenuOptionsScreen_VTABLE; s->VTABLE = &MenuOptionsScreen_VTABLE;
s->descs = descs;
s->DoInit = init; s->DoInit = init;
s->DoRecreateExtra = NULL; s->DoRecreateExtra = NULL;
s->OnHacksChanged = NULL; s->OnHacksChanged = NULL;
@ -2783,11 +2785,10 @@ static void ClassicOptionsScreen_InitWidgets(struct MenuOptionsScreen* s) {
} }
void ClassicOptionsScreen_Show(void) { void ClassicOptionsScreen_Show(void) {
static struct MenuInputDesc descs[11]; MenuInput_Enum(menuOpts_descs[2], viewDistNames, VIEW_COUNT);
MenuInput_Enum(descs[2], viewDistNames, VIEW_COUNT); MenuInput_Enum(menuOpts_descs[7], FpsLimit_Names, FPS_LIMIT_COUNT);
MenuInput_Enum(descs[7], FpsLimit_Names, FPS_LIMIT_COUNT);
MenuOptionsScreen_Show(descs, ClassicOptionsScreen_InitWidgets); MenuOptionsScreen_Show(ClassicOptionsScreen_InitWidgets);
} }
@ -2858,20 +2859,19 @@ static void EnvSettingsScreen_InitWidgets(struct MenuOptionsScreen* s) {
} }
void EnvSettingsScreen_Show(void) { void EnvSettingsScreen_Show(void) {
static struct MenuInputDesc descs[11]; MenuInput_Hex(menuOpts_descs[0], ENV_DEFAULT_CLOUDS_COLOR);
MenuInput_Hex(descs[0], ENV_DEFAULT_CLOUDS_COLOR); MenuInput_Hex(menuOpts_descs[1], ENV_DEFAULT_SKY_COLOR);
MenuInput_Hex(descs[1], ENV_DEFAULT_SKY_COLOR); MenuInput_Hex(menuOpts_descs[2], ENV_DEFAULT_FOG_COLOR);
MenuInput_Hex(descs[2], ENV_DEFAULT_FOG_COLOR); MenuInput_Float(menuOpts_descs[3], 0, 1000, 1);
MenuInput_Float(descs[3], 0, 1000, 1); MenuInput_Int(menuOpts_descs[4], -10000, 10000, World.Height + 2);
MenuInput_Int(descs[4], -10000, 10000, World.Height + 2);
MenuInput_Hex(descs[5], ENV_DEFAULT_SUN_COLOR); MenuInput_Hex(menuOpts_descs[5], ENV_DEFAULT_SUN_COLOR);
MenuInput_Hex(descs[6], ENV_DEFAULT_SHADOW_COLOR); MenuInput_Hex(menuOpts_descs[6], ENV_DEFAULT_SHADOW_COLOR);
MenuInput_Enum(descs[7], Weather_Names, Array_Elems(Weather_Names)); MenuInput_Enum(menuOpts_descs[7], Weather_Names, Array_Elems(Weather_Names));
MenuInput_Float(descs[8], -100, 100, 1); MenuInput_Float(menuOpts_descs[8], -100, 100, 1);
MenuInput_Int(descs[9], -2048, 2048, World.Height / 2); MenuInput_Int(menuOpts_descs[9], -2048, 2048, World.Height / 2);
MenuOptionsScreen_Show(descs, EnvSettingsScreen_InitWidgets); MenuOptionsScreen_Show(EnvSettingsScreen_InitWidgets);
} }
@ -2968,14 +2968,13 @@ static void GraphicsOptionsScreen_InitWidgets(struct MenuOptionsScreen* s) {
} }
void GraphicsOptionsScreen_Show(void) { void GraphicsOptionsScreen_Show(void) {
static struct MenuInputDesc descs[8]; MenuInput_Float(menuOpts_descs[0], 1, 100, 20);
MenuInput_Float(descs[0], 1, 100, 20); MenuInput_Enum(menuOpts_descs[1], FpsLimit_Names, FPS_LIMIT_COUNT);
MenuInput_Enum(descs[1], FpsLimit_Names, FPS_LIMIT_COUNT); MenuInput_Int(menuOpts_descs[2], 8, 4096, 512);
MenuInput_Int(descs[2], 8, 4096, 512); MenuInput_Enum(menuOpts_descs[5], NameMode_Names, NAME_MODE_COUNT);
MenuInput_Enum(descs[5], NameMode_Names, NAME_MODE_COUNT); MenuInput_Enum(menuOpts_descs[6], ShadowMode_Names, SHADOW_MODE_COUNT);
MenuInput_Enum(descs[6], ShadowMode_Names, SHADOW_MODE_COUNT);
MenuOptionsScreen_Show(descs, GraphicsOptionsScreen_InitWidgets); MenuOptionsScreen_Show(GraphicsOptionsScreen_InitWidgets);
} }
@ -3035,10 +3034,10 @@ static void ChatOptionsScreen_InitWidgets(struct MenuOptionsScreen* s) {
} }
void ChatOptionsScreen_Show(void) { void ChatOptionsScreen_Show(void) {
static struct MenuInputDesc descs[6]; MenuInput_Float(menuOpts_descs[0], 0.25f, 4.00f, 1);
MenuInput_Float(descs[0], 0.25f, 4.00f, 1); MenuInput_Int(menuOpts_descs[1], 0, 30, Gui.DefaultLines);
MenuInput_Int(descs[1], 0, 30, Gui.DefaultLines);
MenuOptionsScreen_Show(descs, ChatOptionsScreen_InitWidgets); MenuOptionsScreen_Show(ChatOptionsScreen_InitWidgets);
} }
@ -3094,10 +3093,10 @@ static void GuiOptionsScreen_InitWidgets(struct MenuOptionsScreen* s) {
} }
void GuiOptionsScreen_Show(void) { void GuiOptionsScreen_Show(void) {
static struct MenuInputDesc descs[8]; MenuInput_Float(menuOpts_descs[2], 0.25f, 4.00f, 1);
MenuInput_Float(descs[2], 0.25f, 4.00f, 1); MenuInput_Float(menuOpts_descs[3], 0.25f, 4.00f, 1);
MenuInput_Float(descs[3], 0.25f, 4.00f, 1);
MenuOptionsScreen_Show(descs, GuiOptionsScreen_InitWidgets); MenuOptionsScreen_Show(GuiOptionsScreen_InitWidgets);
} }
@ -3223,11 +3222,11 @@ static void HacksSettingsScreen_InitWidgets(struct MenuOptionsScreen* s) {
} }
void HacksSettingsScreen_Show(void) { void HacksSettingsScreen_Show(void) {
static struct MenuInputDesc descs[11]; MenuInput_Float(menuOpts_descs[1], 0.1f, 50, 10);
MenuInput_Float(descs[1], 0.1f, 50, 10); MenuInput_Float(menuOpts_descs[3], 0.1f, 2048, 1.233f);
MenuInput_Float(descs[3], 0.1f, 2048, 1.233f); MenuInput_Int(menuOpts_descs[9], 1, 179, 70);
MenuInput_Int(descs[9], 1, 179, 70);
MenuOptionsScreen_Show(descs, HacksSettingsScreen_InitWidgets); MenuOptionsScreen_Show(HacksSettingsScreen_InitWidgets);
} }
@ -3294,17 +3293,16 @@ static void MiscSettingsScreen_InitWidgets(struct MenuOptionsScreen* s) {
} }
void MiscOptionsScreen_Show(void) { void MiscOptionsScreen_Show(void) {
static struct MenuInputDesc descs[8]; MenuInput_Float(menuOpts_descs[0], 1, 1024, 5);
MenuInput_Float(descs[0], 1, 1024, 5); MenuInput_Int(menuOpts_descs[1], 0, 100, DEFAULT_MUSIC_VOLUME);
MenuInput_Int(descs[1], 0, 100, DEFAULT_MUSIC_VOLUME); MenuInput_Int(menuOpts_descs[2], 0, 100, DEFAULT_SOUNDS_VOLUME);
MenuInput_Int(descs[2], 0, 100, DEFAULT_SOUNDS_VOLUME);
#ifdef CC_BUILD_WIN #ifdef CC_BUILD_WIN
MenuInput_Int(descs[6], 1, 200, 40); MenuInput_Int(menuOpts_descs[6], 1, 200, 40);
#else #else
MenuInput_Int(descs[6], 1, 200, 30); MenuInput_Int(menuOpts_descs[6], 1, 200, 30);
#endif #endif
MenuOptionsScreen_Show(descs, MiscSettingsScreen_InitWidgets); MenuOptionsScreen_Show(MiscSettingsScreen_InitWidgets);
} }
@ -3433,7 +3431,7 @@ static void NostalgiaAppearanceScreen_InitWidgets(struct MenuOptionsScreen* s) {
} }
void NostalgiaAppearanceScreen_Show(void) { void NostalgiaAppearanceScreen_Show(void) {
MenuOptionsScreen_Show(NULL, NostalgiaAppearanceScreen_InitWidgets); MenuOptionsScreen_Show(NostalgiaAppearanceScreen_InitWidgets);
} }
@ -3465,7 +3463,7 @@ static void NostalgiaScreen_Version(void* screen, void* widget) {
Options_SetInt(OPT_GAME_VERSION, ver); Options_SetInt(OPT_GAME_VERSION, ver);
GameVersion_Load(); GameVersion_Load();
MenuOptionsScreen_Update(s, Screen_Index(s, widget)); MenuOptionsScreen_Update(s, widget);
} }
static void NostalgiaScreen_GetVersion(cc_string* v) { String_AppendConst(v, Game_Version.Name); } static void NostalgiaScreen_GetVersion(cc_string* v) { String_AppendConst(v, Game_Version.Name); }
@ -3505,7 +3503,7 @@ static void NostalgiaFunctionalityScreen_InitWidgets(struct MenuOptionsScreen* s
} }
void NostalgiaFunctionalityScreen_Show(void) { void NostalgiaFunctionalityScreen_Show(void) {
MenuOptionsScreen_Show(NULL, NostalgiaFunctionalityScreen_InitWidgets); MenuOptionsScreen_Show(NostalgiaFunctionalityScreen_InitWidgets);
} }

View File

@ -40,10 +40,10 @@ static const char* kb_table_lower[] =
}; };
static const char* kb_table_upper[] = static const char* kb_table_upper[] =
{ {
"1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "=", "Backspace", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "_", "+", "Backspace",
"Q", "W", "E", "R", "T", "Y", "U", "I", "o", "p", "(", ")", "& ", "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "[", "]", "& ",
"A", "S", "D", "F", "G", "H", "J", "K", "L", "?", ";", "'", "Enter", "A", "S", "D", "F", "G", "H", "J", "K", "L", "?", ":", "\"", "Enter",
"Z", "X", "C", "V", "B", "N", "M", ".", ",","\\", "!", "@", "/ ", "Z", "X", "C", "V", "B", "N", "M", "<", ">","*", "%", "#", "/ ",
"Caps", "Shift", "Space", "Close" "Caps", "Shift", "Space", "Close"
}; };
@ -79,9 +79,9 @@ static void VirtualKeyboard_Close(void);
static void VirtualKeyboard_Hook(void); static void VirtualKeyboard_Hook(void);
#define KB_NORMAL_COLOR BitmapCol_Make(0x7F, 0x7F, 0x7F, 0x40) #define KB_NORMAL_COLOR BitmapCol_Make(0x7F, 0x7F, 0x7F, 0x90)
#define KB_SELECTED_COLOR BitmapCol_Make(0xAF, 0xAF, 0xAF, 0x40) #define KB_SELECTED_COLOR BitmapCol_Make(0xAF, 0xAF, 0xAF, 0x90)
#define KB_BACKGROUND_COLOR BitmapCol_Make(0xFF, 0xFF, 0xFF, 0x40) #define KB_BACKGROUND_COLOR BitmapCol_Make(0xFF, 0xFF, 0xFF, 0x90)
static void VirtualKeyboard_Draw(struct Context2D* ctx) { static void VirtualKeyboard_Draw(struct Context2D* ctx) {
struct DrawTextArgs args; struct DrawTextArgs args;