]> icculus.org git repositories - btb/d2x.git/blob - include/console.h
implement all controls as console commands.
[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 #include "concntl.h"
29
30 enum {
31         CON_CLOSED,     //! The console is closed (and not shown)
32         CON_CLOSING,    //! The console is still open and visible but closing
33         CON_OPENING,    //! The console is visible and opening but not yet fully open
34         CON_OPEN        //! The console is open and visible
35 };
36
37 /*! Takes keys from the keyboard and inputs them to the console if the console isVisible().
38         If the event was not handled (i.e. WM events or unknown ctrl- or alt-sequences)
39         the function returns the event for further processing. */
40 int CON_Events(int event);
41 /*! Makes the console visible */
42 void CON_Show(void);
43 /*! Hides the console */
44 void CON_Hide(void);
45 /*! Returns 1 if the console is visible, 0 else */
46 int CON_isVisible(void);
47 /*! Draws the console to the screen if it isVisible()*/
48 void CON_DrawConsole(void);
49 /*! Initializes the console */
50 void CON_Init(void);
51 /*! Initializes the graphical console */
52 void CON_InitGFX(int w, int h);
53 /*! printf for the console */
54 void CON_Out(const char *str, ...);
55 /*! Changes the size of the console */
56 void CON_Resize(int w, int h);
57
58
59 /* Priority levels */
60 #define CON_CRITICAL -2
61 #define CON_URGENT   -1
62 #define CON_NORMAL    0
63 #define CON_VERBOSE   1
64 #define CON_DEBUG     2
65
66 void con_printf(int level, char *fmt, ...);
67
68 /* Console CVars */
69 /* How discriminating we are about which messages are displayed */
70 extern cvar_t con_threshold;
71
72
73 #endif /* _CONSOLE_H_ */