-
-
Notifications
You must be signed in to change notification settings - Fork 14
GUI Functions
Below you'll find all the API functions that provide a GUI for user interaction, whether it be simply showing the user a message or getting input from the user.
// in PKSM v7.0.1 and below
void gui_warn(char* lineOne, char* lineTwo);
// After PKSM v7.0.1
void gui_warn(char* warning);
gui_warn
is for showing users a simple message
- only allows the user to exit with
A
. - In PKSM v7.0.1 and below, use of newlines (
\n
) is not advised in the arguments of this function. - After PKSM v7.0.1, newlines (
\n
) are allowed but testing of looks should be done if using more than one.
"Warn" is somewhat of a misnomer -- it was originally made to warn users that something wrong or unexpected happened, but can be used to show any simple information to the user
// in PKSM v7.0.1 and below
int gui_choice(char* lineOne, char* lineTwo);
// After PKSM v7.0.1
int gui_choice(char* message);
gui_choice
is for providing the user with a simple binary choice
- returns
1
if the user exits withA
or it returns0
if the user exits withB
- In PKSM v7.0.1and below, use of newlines (
\n
) is not advised in the arguments of this function. - After PKSM v7.0.1, newlines (
\n
) are allowed but testing of looks should be done if using more than one.
int gui_menu_6x5(char* question, int options, char** labels, struct pkx* pokemon, enum Generation generation);
gui_menu_6x5
brings up a grid of Pokémon sprites for the user to choose from.
-
char* question
: Text shown on the bottom screen. Newlines (\n
) are allowed -
int options
: Total number of options to be displayed to the user -
char** labels
: Array of strings to use as text labels for the options -
enum Generation generation
: Which generation of species info and sprites should be used in the display (some species have different forms in different generations, like Pikachu) -
struct pkx* pokemon
: Array ofpkx
structs
struct pkx {
int species;
int form;
};
-
int species
is the National Dex number of the Pokémon you want to display.0
results in an egg -
int form
is always necessary, even if all the species you're working with do not have alternate forms. If you're not trying to display a certain alternate form, setform
to0
.
int gui_menu_20x2(char* question, int options, char** labels);
-
char* question
: Text shown on the bottom screen. Newlines (\n
) are allowed -
int options
: Total number of options to be displayed to the user -
char** labels
: Array of strings to use as text labels for the options
void gui_numpad(unsigned int* out, char* hint, int maxDigits);
Brings up the numpad to allow user input.
-
unsigned int* out
: pointer to an existingunsigned int
variable to hold the user's input -
char* hint
: string to be shown if the user clicks on theWhat?
button in the bottom left. Newlines (\n
) are allowed but testing of looks should be done if using more than one. -
int maxDigits
: max length of the number provided by user
void gui_keyboard(char* out, char* hint, int maxChars);
Brings up the keyboard to allow user input.
-
char* out
: pointer to an existing string variable that should be large enough to hold whatever you're prompting the user for, including theNULL
terminator -
char* hint
: string shown in input box when it's empty. Newlines (\n
) are allowed, but only the first and last lines will be visible to the user. -
int maxChars
: The number of UTF-16 codepoints allowed to be input, including the null terminator. The data written toout
is UTF-8 encoded
int gui_boxes(int* fromStorage, int* box, int* slot, int doCrypt);
- All arguments except
doCrypt
should be pointers to existing variables -
fromStorage
: whether or not the user's selection is in PKSM's storage (1
) or save's PC (0
) -
box
,slot
: Box and slot numbers of user's selection -
doCrypt
: whether this should (1
) or should not (0
) it should decrypt and encrypt the boxes itself- If you use
gui_boxes
aftersav_box_decrypt
, make sure this is0
- If you use
- Returns
0
if a selection was successfully made
void bank_select();
Brings up the same bank selection screen as seen when changing banks in Storage.
bank_select
added after v7.0.1
Enjoy using PKSM? Consider supporting FlagBrew on Patreon