summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main-menu.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/main-menu.c b/src/main-menu.c
index 9583668..f1a3830 100644
--- a/src/main-menu.c
+++ b/src/main-menu.c
@@ -34,6 +34,8 @@ struct _db_main_menu_button {
struct _db_main_menu_button *d;
struct _db_main_menu_button *l;
struct _db_main_menu_button *r;
+ struct _db_main_menu_button *p;
+ struct _db_main_menu_button *n;
};
static SDL_Texture *
@@ -175,6 +177,7 @@ db_main_menu(void)
&buttons[1]->rect);
/* Render game buttons */
+ buttons[1]->n = buttons[0]; /* Quit button link (may change below) */
for (i = 0; i < n; ++i) {
buttons[i + 2] = malloc(sizeof(**buttons));
if (buttons[i + 2] == NULL) {
@@ -214,6 +217,11 @@ db_main_menu(void)
}
buttons[i + 2]->l = NULL;
buttons[i + 2]->r = buttons[0];
+ buttons[i + 2]->p = buttons[i + 1];
+ buttons[i + 1]->n = buttons[i + 2];
+ }
+ if (n > 0) {
+ buttons[i + 1]->n = buttons[0];
}
/* Help button links */
@@ -225,6 +233,8 @@ db_main_menu(void)
buttons[0]->l = NULL;
}
buttons[0]->r = NULL;
+ buttons[0]->p = buttons[1 + n];
+ buttons[0]->n = buttons[1];
/* Quit button links */
buttons[1]->u = buttons[0];
@@ -235,6 +245,7 @@ db_main_menu(void)
buttons[1]->l = NULL;
}
buttons[1]->r = NULL;
+ buttons[1]->p = buttons[0];
SDL_RenderPresent(renderer);
SDL_Delay(1000);