mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Merge branch 'manual-link' into 'master'
Add Online Manual and I_OpenURL stuff See merge request KartKrew/Kart!2396
This commit is contained in:
commit
93dae32e99
5 changed files with 64 additions and 0 deletions
|
|
@ -195,5 +195,15 @@ void I_GetCursorPosition(INT32 *x, INT32 *y)
|
|||
(void)y;
|
||||
}
|
||||
|
||||
boolean I_HasOpenURL()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void I_OpenURL(const char *data)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#include "../sdl/dosstr.c"
|
||||
|
||||
|
|
|
|||
|
|
@ -309,6 +309,10 @@ void I_RegisterSysCommands(void);
|
|||
|
||||
void I_CursedWindowMovement(int xd, int yd);
|
||||
|
||||
boolean I_HasOpenURL(void);
|
||||
|
||||
void I_OpenURL(const char *data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1213,6 +1213,7 @@ extern struct extrasmenu_s {
|
|||
typedef enum
|
||||
{
|
||||
extras_addons = 0,
|
||||
extras_manual,
|
||||
extras_tutorial,
|
||||
extras_challenges,
|
||||
extras_statistics,
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
#include "../f_finale.h"
|
||||
#include "../k_credits.h"
|
||||
#include "../m_pw.h"
|
||||
#include "../i_system.h"
|
||||
|
||||
static void M_Credits(INT32 choice)
|
||||
{
|
||||
|
|
@ -26,6 +27,32 @@ static void M_Credits(INT32 choice)
|
|||
F_StartCredits();
|
||||
}
|
||||
|
||||
const char *manual_url = "https://kartkrew.org/rr-manual";
|
||||
|
||||
static void M_ManualSelect(INT32 choice)
|
||||
{
|
||||
if (choice != MA_YES)
|
||||
return;
|
||||
|
||||
I_OpenURL(manual_url);
|
||||
}
|
||||
|
||||
static void M_Manual(INT32 choice)
|
||||
{
|
||||
(void)choice;
|
||||
restoreMenu = currentMenu;
|
||||
|
||||
if (I_HasOpenURL())
|
||||
{
|
||||
M_StartMessage("Online Manual", va("This will open a page in your default browser:\n\x86%s", manual_url), M_ManualSelect, MM_YESNO, "Let's go!", "Not now...");
|
||||
}
|
||||
else
|
||||
{
|
||||
I_ClipboardCopy(manual_url, strlen(manual_url));
|
||||
M_StartMessage("Online Manual", va("A URL has been copied to your clipboard:\n\x86%s", manual_url), NULL, MM_NOTHING, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
menuitem_t EXTRAS_Main[] =
|
||||
{
|
||||
// The following has NULL strings for text and tooltip.
|
||||
|
|
@ -35,6 +62,9 @@ menuitem_t EXTRAS_Main[] =
|
|||
{IT_STRING | IT_CALL, NULL, NULL,
|
||||
NULL, {.routine = M_Addons}, 0, 0},
|
||||
|
||||
{IT_STRING | IT_CALL, "Online Manual", "Learn everything there is to know about handling, items, and strategy.",
|
||||
NULL, {.routine = M_Manual}, 0, 0},
|
||||
|
||||
{IT_STRING | IT_CALL, "Tutorial", "Help Dr. Robotnik and Tails test out their new Ring Racers.",
|
||||
NULL, {.routine = M_LevelSelectInit}, 0, GT_TUTORIAL},
|
||||
|
||||
|
|
|
|||
|
|
@ -1013,6 +1013,25 @@ I_CursedWindowMovement (int xd, int yd)
|
|||
SDL_SetWindowPosition(window, window_x + xd, window_y + yd);
|
||||
}
|
||||
|
||||
boolean I_HasOpenURL()
|
||||
{
|
||||
#if (SDL_VERSION_ATLEAST(2, 0, 14))
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void I_OpenURL(const char *data)
|
||||
{
|
||||
#if (SDL_VERSION_ATLEAST(2, 0, 14))
|
||||
SDL_OpenURL(data);
|
||||
#else
|
||||
(void)data;
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
// I_JoyScale
|
||||
//
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue