1 /** @file hu_msg.h Important game state change messages. 2 * 3 * @authors Copyright © 2003-2017 Jaakko Keränen <jaakko.keranen@iki.fi> 4 * @authors Copyright © 2006-2014 Daniel Swanson <danij@dengine.net> 5 * @authors Copyright © 1993-1996 id Software, Inc. 6 * 7 * @par License 8 * GPL: http://www.gnu.org/licenses/gpl.html 9 * 10 * <small>This program is free software; you can redistribute it and/or modify 11 * it under the terms of the GNU General Public License as published by the 12 * Free Software Foundation; either version 2 of the License, or (at your 13 * option) any later version. This program is distributed in the hope that it 14 * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty 15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 16 * Public License for more details. You should have received a copy of the GNU 17 * General Public License along with this program; if not, write to the Free 18 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 19 * 02110-1301 USA</small> 20 */ 21 22 #ifndef LIBCOMMON_HUD_MESSAGE_H 23 #define LIBCOMMON_HUD_MESSAGE_H 24 25 #include "common.h" 26 27 #ifdef __cplusplus 28 extern "C" { 29 #endif 30 31 typedef enum { 32 MSG_CANCEL = -1, 33 MSG_NO, 34 MSG_YES, 35 NUM_MESSAGE_RESPONSES 36 } msgresponse_t; 37 38 typedef int (C_DECL *msgfunc_t) (msgresponse_t response, int userValue, void *userPointer); 39 40 typedef enum { 41 MSG_ANYKEY, 42 MSG_YESNO, 43 NUM_MESSAGE_TYPES 44 } msgtype_t; 45 46 /** 47 * Called during the PreInit of each game during start up. 48 * Register Cvars and CCmds for the important messages. 49 */ 50 void Hu_MsgRegister(void); 51 52 /** 53 * Called during init. 54 */ 55 void Hu_MsgInit(void); 56 57 /** 58 * Called during engine shutdown. 59 */ 60 void Hu_MsgShutdown(void); 61 62 /** 63 * Updates on Game Tick. 64 */ 65 void Hu_MsgTicker(void); 66 67 /** 68 * If an "any key" message is active, respond to the event. 69 */ 70 int Hu_MsgResponder(event_t *ev); 71 72 /** 73 * Draw any active message. 74 */ 75 void Hu_MsgDrawer(void); 76 77 dd_bool Hu_IsMessageActive(void); 78 dd_bool Hu_IsMessageActiveWithCallback(msgfunc_t callback); 79 80 /** 81 * Begin a new game state message/question. 82 */ 83 void Hu_MsgStart(msgtype_t type, char const *msg, msgfunc_t callback, int userValue, void *userPointer); 84 85 #ifdef __cplusplus 86 } // extern "C" 87 #endif 88 89 #endif // LIBCOMMON_HUD_MESSAGE_H 90