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