[Change] Buttons with NULL function are now disabled by default.
This commit is contained in:
parent
8c4a7a045a
commit
3b64a6984f
17
src/menu.c
17
src/menu.c
@ -58,7 +58,6 @@ static void menu_main_new(char* str);
|
||||
static void menu_main_exit(char* str);
|
||||
/* Small menu. */
|
||||
static void menu_small_close(char* str);
|
||||
static void edit_options(char* str);
|
||||
static void menu_small_exit(char* str);
|
||||
static void exit_game(void);
|
||||
/* Information menu. */
|
||||
@ -111,7 +110,7 @@ void menu_main(void) {
|
||||
"btnNew", "New Game", menu_main_new);
|
||||
window_addButton(wid, 20, 20 + (BUTTON_HEIGHT+20),
|
||||
BUTTON_WIDTH, BUTTON_HEIGHT,
|
||||
"btnOptions", "Options", (void(*)(char*)) edit_options);
|
||||
"btnOptions", "Options", NULL);
|
||||
window_addButton(wid, 20, 20, BUTTON_WIDTH, BUTTON_HEIGHT,
|
||||
"btnExit", "Exit", menu_main_exit);
|
||||
|
||||
@ -210,7 +209,7 @@ void menu_small(void) {
|
||||
|
||||
window_addButton(wid, 20, 20 + BUTTON_HEIGHT + 20,
|
||||
BUTTON_WIDTH, BUTTON_HEIGHT,
|
||||
"btnOptions", "Options", (void(*)(char*))edit_options);
|
||||
"btnOptions", "Options", NULL);
|
||||
|
||||
window_addButton(wid, 20, 20, BUTTON_WIDTH, BUTTON_HEIGHT,
|
||||
"btnExit", "Exit", menu_small_exit);
|
||||
@ -243,18 +242,6 @@ static void menu_small_exit(char* str) {
|
||||
menu_main();
|
||||
}
|
||||
|
||||
/**
|
||||
* @fn static void edit_options(char* str)
|
||||
*
|
||||
* @brief Edit the options.
|
||||
* @param str Unused.
|
||||
* @todo Make the options menu.
|
||||
*/
|
||||
static void edit_options(char* str) {
|
||||
(void)str;
|
||||
/* @todo Make options menu */
|
||||
}
|
||||
|
||||
/**
|
||||
* @fn static void exit_game(void)
|
||||
*
|
||||
|
@ -201,6 +201,8 @@ void window_addButton(const unsigned int wid, const int x, const int y,
|
||||
wgt->dat.btn.display = strdup(display);
|
||||
wgt->dat.btn.disabled = 0; /* Initially enabled. */
|
||||
wgt->dat.btn.fptr = call;
|
||||
if(wgt->dat.btn.fptr == NULL) /* Disable if function is NULL. */
|
||||
wgt->dat.btn.disabled = 1;
|
||||
|
||||
/* Position/Size. */
|
||||
wgt->w = (double) w;
|
||||
|
Loading…
Reference in New Issue
Block a user