summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2021-08-04 21:11:41 (EDT)
committer P. J. McDermott <pj@pehjota.net>2021-08-04 21:12:05 (EDT)
commit10fe7025eb8025980b2ed2bcadee0e729485ae30 (patch)
treea463e965239edb3bde1e0ef10f37a34c53196bb6
parent4290eee6d45aab8e9f1c47d5d7d35e9ceccd78b2 (diff)
downloadmazefight-10fe7025eb8025980b2ed2bcadee0e729485ae30.zip
mazefight-10fe7025eb8025980b2ed2bcadee0e729485ae30.tar.gz
mazefight-10fe7025eb8025980b2ed2bcadee0e729485ae30.tar.bz2
splash: Add non-functional "Quit" button
-rw-r--r--src/defs.h1
-rw-r--r--src/splash.c22
2 files changed, 20 insertions, 3 deletions
diff --git a/src/defs.h b/src/defs.h
index 6f86aea..67de967 100644
--- a/src/defs.h
+++ b/src/defs.h
@@ -34,6 +34,7 @@
#define MF_SPLASH_LBL_M 8 /* Margin between radio buttons and labels */
#define MF_SPLASH_BOX_W 16 /* Radio button and check box width */
#define MF_SPLASH_BOX_P 2 /* Radio button and check box padding */
+#define MF_SPLASH_BTN_M 8 /* Margin between buttons */
#define MF_SPLASH_BTN_P 8 /* Button padding */
#define MF_SPLASH_TITLE_FONT_S 48 /* Title font size */
#define MF_SPLASH_TEXT_FONT_S 16 /* Regular text font size */
diff --git a/src/splash.c b/src/splash.c
index dee2eb2..40d9f1e 100644
--- a/src/splash.c
+++ b/src/splash.c
@@ -29,6 +29,13 @@
#include "util.h"
static int
+_mf_splash_quit(void *user_data)
+{
+ SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Quitting");
+ return 0;
+}
+
+static int
_mf_splash_play(void *user_data)
{
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Playing");
@@ -83,9 +90,18 @@ mf_splash(SDL_Renderer *renderer)
mftk_grid_new(2, 1, MF_SPLASH_TITLE_M, 0,
mftk_label_new(title_font, "Maze Fight",
&text_color, renderer),
- mftk_button_new(text_font, "Play", &text_color,
- &butn_color, 2, &_mf_splash_play, NULL,
- renderer)
+ mftk_grid_new(1, 2, 0, MF_SPLASH_BTN_M,
+ mftk_button_new(text_font, "Quit",
+ &text_color, &butn_color,
+ MF_SPLASH_BTN_P,
+ &_mf_splash_quit, NULL,
+ renderer),
+ mftk_button_new(text_font, "Play",
+ &text_color, &butn_color,
+ MF_SPLASH_BTN_P,
+ &_mf_splash_play, NULL,
+ renderer)
+ )
)
);
/* TODO: Widgets */