summaryrefslogtreecommitdiffstats
path: root/src/help.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/help.c')
-rw-r--r--src/help.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/help.c b/src/help.c
index 71c2f35..0399c36 100644
--- a/src/help.c
+++ b/src/help.c
@@ -85,7 +85,7 @@ _db_help_triangle(SDL_Renderer *renderer, Uint8 r, Uint8 g, Uint8 b, Uint8 a,
SDL_RenderDrawPoints(renderer, points, i);
}
-void
+int
db_help(void)
{
char *font_path;
@@ -121,6 +121,8 @@ db_help(void)
return;
}
+ TTF_CloseFont(font);
+
texture = SDL_CreateTextureFromSurface(renderer, surface);
if (texture == NULL) {
db_err("Failed to create texture (%s)", SDL_GetError());
@@ -141,7 +143,7 @@ db_help(void)
while (SDL_WaitEvent(&event)) {
switch (event.type) {
case SDL_QUIT:
- _db_help_quit = 1;
+ _db_help_quit = 2;
break;
case SDL_KEYDOWN:
switch (event.key.keysym.sym) {
@@ -181,7 +183,7 @@ db_help(void)
default:
break;
}
- if (_db_help_quit == 1) {
+ if (_db_help_quit > 0) {
break;
}
SDL_SetRenderDrawColor(renderer, 0x7F, 0x7F, 0x7F, 0xFF);
@@ -204,4 +206,9 @@ db_help(void)
}
SDL_RenderPresent(renderer);
}
+
+ SDL_FreeSurface(surface);
+ SDL_DestroyTexture(texture);
+
+ return _db_help_quit - 1;
}