From e170a04e16b07e33872a63184ee6dff4d272bf0f Mon Sep 17 00:00:00 2001 From: cypress Date: Sun, 20 Oct 2024 10:56:33 -0700 Subject: [PATCH] MENU: Draw Controller Glyphs on option --- source/menu/defs/menu_defs.qc | 8 ++++++++ source/menu/m_menu.qc | 19 +++++++++++++++++++ source/menu/main.qc | 7 +++++++ source/menu/menu_gpad.qc | 1 + source/menu/menu_main.qc | 6 +++--- 5 files changed, 38 insertions(+), 3 deletions(-) diff --git a/source/menu/defs/menu_defs.qc b/source/menu/defs/menu_defs.qc index f0a512d..2b2abd0 100644 --- a/source/menu/defs/menu_defs.qc +++ b/source/menu/defs/menu_defs.qc @@ -11,6 +11,14 @@ float menu_changetime; float current_menu; float running_platform; +float last_input_was_gamepad; + +#ifdef MENU + +float last_input_deviceid; + +#endif // MENU + enum { PLATFORM_WIN, PLATFORM_MAC, diff --git a/source/menu/m_menu.qc b/source/menu/m_menu.qc index e3029fa..c66ac64 100644 --- a/source/menu/m_menu.qc +++ b/source/menu/m_menu.qc @@ -334,6 +334,25 @@ float(string id, vector pos, vector size, string text) my_button = return sui_is_clicked(id); }; + +// +// Menu_DrawControllerGlyphDemo(order) +// Draws ABXY on the same line as an OptionVal to demonstrate +// the current cl_controllerglyphs value. +// +void(float order) Menu_DrawControllerGlyphDemo = +{ + sui_set_align([SUI_ALIGN_START, SUI_ALIGN_START]); + + vector tilemap_positions[4] = {[0, 0], [0.125, 0], [0.250, 0], [0.375, 0]}; + vector position = [450, 50 + (order * 25)]; + + for(int i = 0; i < 4; i++) { + sui_subpic(position, [MENU_TEXT_MEDIUM_x, MENU_TEXT_MEDIUM_x], sprintf("gfx/controller_glyphs/%s.tga", cvar_string("cl_controllerglyphs")), [1, 1, 1], tilemap_positions[i], [0.125, 0.125], 1, 0); + position_x += 14; + } +}; + // // Menu_DrawCreditHeader() // Wrapper for drawing the role/title in credits. diff --git a/source/menu/main.qc b/source/menu/main.qc index 780e26e..f751ec1 100644 --- a/source/menu/main.qc +++ b/source/menu/main.qc @@ -254,6 +254,13 @@ void() m_open = float(float evtype, float scanx, float chary, float devid) Menu_InputEvent = { + last_input_deviceid = devid; + + if (last_input_deviceid > 0) + last_input_was_gamepad = TRUE; + else + last_input_was_gamepad = FALSE; + float used = sui_input_event(evtype, scanx, chary, devid); if (evtype == IE_KEYDOWN && !used) diff --git a/source/menu/menu_gpad.qc b/source/menu/menu_gpad.qc index 7f266a4..70d3b94 100644 --- a/source/menu/menu_gpad.qc +++ b/source/menu/menu_gpad.qc @@ -100,6 +100,7 @@ void() Menu_Gamepad = default: glyph_string = sprintf("USER (\"%s\")", cvar_string("cl_controllerglyphs")); break; } Menu_DrawOptionValue(1, glyph_string); + Menu_DrawControllerGlyphDemo(1); Menu_Button(2, "gp_rumb", "RUMBLE", "Toggle Rumble during Gameplay Actions.") ? Menu_Gamepad_ApplyRumble() : 0; string rumble_string = ""; diff --git a/source/menu/menu_main.qc b/source/menu/menu_main.qc index 170c4ff..598de40 100644 --- a/source/menu/menu_main.qc +++ b/source/menu/menu_main.qc @@ -4,7 +4,7 @@ string() Menu_Main_GetDashboardName = { switch(running_platform) { case PLATFORM_WIN: return "Windows"; - case PLATFORM_MAC: return "MacOS"; + case PLATFORM_MAC: return "macOS"; case PLATFORM_LIN: return "Linux"; case PLATFORM_XBX: return "Xbox Dashboard"; case PLATFORM_AND: return "Android"; @@ -87,9 +87,9 @@ void() Menu_Main = } Menu_SocialBadge(1, "soc_youtube", "youtube.com/@nzpteam", 2); - Menu_SocialBadge(2, "soc_mastadon", "FIXME", 3); + Menu_SocialBadge(2, "soc_mastadon", "twitter.com/nzpteam", 3); // FIXME: Move to Mastadon Menu_SocialBadge(3, "soc_patreon", "patreon.com/cypressimplex", 4); - Menu_SocialBadge(4, "soc_discord", "discord.nzp.gay", 1); + Menu_SocialBadge(4, "soc_matrix", "discord.nzp.gay", 1); // FIXME: Move to Matrix sui_pop_frame(); }; \ No newline at end of file