]> icculus.org git repositories - btb/d2x.git/blob - include/console.h
make static
[btb/d2x.git] / include / console.h
1 /*
2  *  Code for controlling the console
3  *  Based on an early version of SDL_Console
4  *
5  *  Written By: Garrett Banuk <mongoose@mongeese.org>
6  *  Code Cleanup and heavily extended by: Clemens Wacha <reflex-2000@gmx.net>
7  *  Ported to use native Descent interfaces by: Bradley Bell <btb@icculus.org>
8  *
9  *  This is free, just be sure to give us credit when using it
10  *  in any of your programs.
11  */
12
13 #ifndef _CONSOLE_H_
14 #define _CONSOLE_H_ 1
15
16 #include "cli.h"
17 #include "cmd.h"
18 #include "cvar.h"
19
20 enum {
21         CON_CLOSED,     // The console is closed (and not shown)
22         CON_CLOSING,    // The console is still open and visible but closing
23         CON_OPENING,    // The console is visible and opening but not yet fully open
24         CON_OPEN,       // The console is open and visible
25 };
26
27 /* Takes keys from the keyboard and inputs them to the console if the console isVisible().
28  * If the event was not handled (i.e. WM events or unknown ctrl- or alt-sequences)
29  * the function returns the event for further processing. */
30 int con_key_handler(int key);
31 /* Makes the console visible */
32 void con_show(void);
33 /* Hides the console */
34 void con_hide(void);
35 /* Returns 1 if the console is visible, 0 else */
36 int con_is_visible(void);
37 /* Draws the console to the screen if it isVisible()*/
38 void con_draw(void);
39 /* Initializes the console */
40 void con_init(void);
41 /* Initializes the graphical console */
42 void con_init_gfx(int w, int h);
43 /* Changes the size of the console */
44 void con_resize(int w, int h);
45
46
47 /* Priority levels */
48 #define CON_CRITICAL -2
49 #define CON_URGENT   -1
50 #define CON_NORMAL    0
51 #define CON_VERBOSE   1
52 #define CON_DEBUG     2
53
54 void con_printf(int level, char *fmt, ...);
55
56 /* Console CVars */
57 /* How discriminating we are about which messages are displayed */
58 extern cvar_t con_threshold;
59
60
61 #endif /* _CONSOLE_H_ */