summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2021-03-18 14:27:00 (EDT)
committer P. J. McDermott <pj@pehjota.net>2021-03-18 14:27:00 (EDT)
commit31e57879b75af60667f6c07e448e1571eae164cb (patch)
tree30ec7f8778ccc22afeb3543ed47d64bb4e38a1fb /src
parent5ba4795b7eb6cde37b7704ab7a0a1e0a61fdd991 (diff)
downloaddodge-balls-31e57879b75af60667f6c07e448e1571eae164cb.zip
dodge-balls-31e57879b75af60667f6c07e448e1571eae164cb.tar.gz
dodge-balls-31e57879b75af60667f6c07e448e1571eae164cb.tar.bz2
main: Add dir and SDL struct accessor functions
Diffstat (limited to 'src')
-rw-r--r--src/local.mk1
-rw-r--r--src/main.c31
-rw-r--r--src/main.h31
3 files changed, 63 insertions, 0 deletions
diff --git a/src/local.mk b/src/local.mk
index 4503ce7..508b1db 100644
--- a/src/local.mk
+++ b/src/local.mk
@@ -4,6 +4,7 @@ dodge_balls_SOURCES += \
%reldir%/locale.c \
%reldir%/locale.h \
%reldir%/main.c \
+ %reldir%/main.h \
%reldir%/output.c \
%reldir%/output.h \
%reldir%/util.c \
diff --git a/src/main.c b/src/main.c
index 10d6359..3a2c93f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -24,6 +24,7 @@
#include <stdlib.h>
#include <string.h>
#include "game.h"
+#include "main.h"
#include "output.h"
static const char *_db_games_dir;
@@ -107,6 +108,36 @@ _db_quit(void)
SDL_Quit();
}
+const char *
+db_get_games_dir(void)
+{
+ return _db_games_dir;
+}
+
+const char *
+db_get_fonts_dir(void)
+{
+ return _db_fonts_dir;
+}
+
+SDL_Window *
+db_get_window(void)
+{
+ return _db_window;
+}
+
+SDL_Renderer *
+db_get_renderer(void)
+{
+ return _db_renderer;
+}
+
+SDL_Texture *
+db_get_texture(void)
+{
+ return _db_texture;
+}
+
int
main(int argc, char *argv[])
{
diff --git a/src/main.h b/src/main.h
new file mode 100644
index 0000000..5e6bae2
--- /dev/null
+++ b/src/main.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2021 P. J. McDermott
+ *
+ * This file is part of Dodge Balls
+ *
+ * Dodge Balls is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dodge Balls is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dodge Balls. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef DB_MAIN_H_
+#define DB_MAIN_H_
+
+#include <SDL.h>
+
+const char *db_get_games_dir(void) __attribute__((__pure__));
+const char *db_get_fonts_dir(void) __attribute__((__pure__));
+SDL_Window *db_get_window(void) __attribute__((__pure__));
+SDL_Renderer *db_get_renderer(void) __attribute__((__pure__));
+SDL_Texture *db_get_texture(void) __attribute__((__pure__));
+
+#endif /* DB_MAIN_H_ */