From 31e57879b75af60667f6c07e448e1571eae164cb Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Thu, 18 Mar 2021 14:27:00 -0400 Subject: main: Add dir and SDL struct accessor functions --- (limited to 'src') 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 #include #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 . + */ + +#ifndef DB_MAIN_H_ +#define DB_MAIN_H_ + +#include + +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_ */ -- cgit v0.9.1