Merge pull request #1233 from ClassiCube/MenuOptions2

Simplify menu options UI code
This commit is contained in:
UnknownShadow200 2024-07-12 20:58:02 +10:00 committed by GitHub
commit 2b0941bccd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 1281 additions and 1185 deletions

1203
src/MenuOptions.c Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -14,6 +14,7 @@ struct InputDevice;
int Menu_InputDown(void* screen, int key, struct InputDevice* device);
int Menu_PointerDown(void* screen, int id, int x, int y);
int Menu_PointerMove(void* screen, int id, int x, int y);
int Menu_DoPointerMove(void* screen, int id, int x, int y);
struct SimpleButtonDesc { short x, y; const char* title; Widget_LeftClick onClick; };
void Menu_AddButtons(void* screen, struct ButtonWidget* btns, int width,
@ -67,4 +68,5 @@ void TouchOnscreenScreen_Show(void);
void MenuScreen_Render2(void* screen, float delta);
typedef void (*MenuInputDone)(const cc_string* value, cc_bool valid);
void MenuInputOverlay_Show(struct MenuInputDesc* desc, const cc_string* value, MenuInputDone onDone, cc_bool screenMode);
void MenuInputOverlay_Close(cc_bool valid);
#endif

View File

@ -28,9 +28,6 @@ CC_NOINLINE void TextWidget_Set(struct TextWidget* w, const cc_string* text, str
/* Shorthand for TextWidget_Set using String_FromReadonly */
CC_NOINLINE void TextWidget_SetConst(struct TextWidget* w, const char* text, struct FontDesc* font);
typedef void (*Button_Get)(cc_string* raw);
typedef void (*Button_Set)(const cc_string* raw);
/* A labelled button that can be clicked on. */
struct ButtonWidget {
Widget_Body
@ -38,8 +35,6 @@ struct ButtonWidget {
PackedCol color;
int minWidth, minHeight;
const char* optName;
Button_Get GetValue;
Button_Set SetValue;
};
#define BUTTONWIDGET_MAX 12