1 /** @file libgamefw.h Common framework for games. 2 * 3 * @authors Copyright (c) 2016-2017 Jaakko Keränen <jaakko.keranen@iki.fi> 4 * 5 * @par License 6 * GPL: http://www.gnu.org/licenses/gpl.html 7 * 8 * <small>This program is free software; you can redistribute it and/or modify 9 * it under the terms of the GNU General Public License as published by the 10 * Free Software Foundation; either version 2 of the License, or (at your 11 * option) any later version. This program is distributed in the hope that it 12 * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty 13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 14 * Public License for more details. You should have received a copy of the GNU 15 * General Public License along with this program; if not, see: 16 * http://www.gnu.org/licenses</small> 17 */ 18 19 #ifndef LIBGAMEFW_H 20 #define LIBGAMEFW_H 21 22 #include <de/types.h> 23 24 /* 25 * The LIBGAMEFW_PUBLIC macro is used for declaring exported symbols. It must be 26 * applied in all exported classes and functions. DEF files are not used for 27 * exporting symbols on Windows. 28 */ 29 #if defined(_WIN32) && defined(_MSC_VER) 30 # ifdef __LIBGAMEFW__ 31 // This is defined when compiling the library. 32 # define LIBGAMEFW_PUBLIC __declspec(dllexport) 33 # else 34 # define LIBGAMEFW_PUBLIC __declspec(dllimport) 35 # endif 36 #else 37 // No need to use any special declarators. 38 # define LIBGAMEFW_PUBLIC 39 #endif 40 41 typedef enum gfw_game_id_e { 42 GFW_DOOM, 43 GFW_HERETIC, 44 GFW_HEXEN, 45 GFW_DOOM64, 46 GFW_STRIFE, 47 GFW_GAME_ID_COUNT 48 } gfw_game_id_t; 49 50 // Color indices. 51 enum { CR, CG, CB, CA }; 52 53 // The Base API is required when using these defines: 54 #define GAMETIC (*((timespan_t*) DD_GetVariable(DD_GAMETIC))) 55 #define IS_SERVER (DD_GetInteger(DD_SERVER)) 56 #define IS_CLIENT (DD_GetInteger(DD_CLIENT)) 57 #define IS_NETGAME (DD_GetInteger(DD_NETGAME)) 58 #define IS_DEDICATED (DD_GetInteger(DD_NOVIDEO)) 59 #define CONSOLEPLAYER (DD_GetInteger(DD_CONSOLEPLAYER)) 60 #define DISPLAYPLAYER (DD_GetInteger(DD_DISPLAYPLAYER)) 61 62 #ifdef __cplusplus 63 extern "C" { 64 #endif 65 66 /** 67 * Sets the current game. 68 * 69 * The current game setting can affect the behavior of some operations. This is 70 * particularly useful when vanilla-compatible game-specific behavior is needed. 71 * 72 * @note When refactoring code and moving it into libgamefw, this game enum 73 * should be used to replace the old __JDOOM__ etc. defines. 74 * 75 * @param game Current game. 76 */ 77 LIBGAMEFW_PUBLIC void gfw_SetCurrentGame(gfw_game_id_t game); 78 79 LIBGAMEFW_PUBLIC gfw_game_id_t gfw_CurrentGame(); 80 81 #ifdef __cplusplus 82 } // extern "C" 83 #endif 84 85 #ifdef __cplusplus 86 87 /// libgamefw uses the @c gfw namespace for all its C++ symbols. 88 namespace gfw { 89 90 typedef gfw_game_id_t GameId; 91 92 } // namespace gfw 93 94 #endif // __cplusplus 95 96 #endif // LIBGAMEFW_H 97