]> icculus.org git repositories - btb/d2x.git/blob - include/console.h
finish refactoring Controls
[btb/d2x.git] / include / console.h
1 /* Console, based on an old version of SDL_Console */
2
3 #ifndef _CONSOLE_H_
4 #define _CONSOLE_H_ 1
5
6 /*! \mainpage
7
8  \section intro Introduction
9  SDL_Console is a console that can be added to any SDL application. It is similar to Quake and other games consoles.
10  A console is meant to be a very simple way of interacting with a program and executing commands. You can also have
11  more than one console at a time.
12
13  \section docs Documentation
14  For a detailed description of all functions see \ref CON_console.h. Remark that functions that have the mark "Internal"
15  are only used internally. There's not much use of calling these functions.
16
17  Have Fun!
18
19  \author Garett Banuk <mongoose@mongeese.org> (Original Version)
20  \author Clemens Wacha <reflex-2000@gmx.net> (Version 2.x, Documentation)
21  \author Boris Lesner <talanthyr@tuxfamily.org> (Package Maintainer)
22  \author Bradley Bell <btb@icculus.org> (Descent Version)
23  */
24
25
26 #include "cmd.h"
27 #include "cvar.h"
28
29 enum {
30         CON_CLOSED,     //! The console is closed (and not shown)
31         CON_CLOSING,    //! The console is still open and visible but closing
32         CON_OPENING,    //! The console is visible and opening but not yet fully open
33         CON_OPEN        //! The console is open and visible
34 };
35
36 /*! Takes keys from the keyboard and inputs them to the console if the console isVisible().
37         If the event was not handled (i.e. WM events or unknown ctrl- or alt-sequences)
38         the function returns the event for further processing. */
39 int CON_Events(int event);
40 /*! Makes the console visible */
41 void CON_Show(void);
42 /*! Hides the console */
43 void CON_Hide(void);
44 /*! Returns 1 if the console is visible, 0 else */
45 int CON_isVisible(void);
46 /*! Draws the console to the screen if it isVisible()*/
47 void CON_DrawConsole(void);
48 /*! Initializes the console */
49 void CON_Init(void);
50 /*! Initializes the graphical console */
51 void CON_InitGFX(int w, int h);
52 /*! printf for the console */
53 void CON_Out(const char *str, ...);
54 /*! Changes the size of the console */
55 void CON_Resize(int w, int h);
56
57
58 /* Priority levels */
59 #define CON_CRITICAL -2
60 #define CON_URGENT   -1
61 #define CON_NORMAL    0
62 #define CON_VERBOSE   1
63 #define CON_DEBUG     2
64
65 void con_printf(int level, char *fmt, ...);
66
67 /* Console CVars */
68 /* How discriminating we are about which messages are displayed */
69 extern cvar_t con_threshold;
70
71
72 #endif /* _CONSOLE_H_ */