Make console callback use split parameters (e.g. argc/argv style)
[attac-man.git] / oglconsole.h
blobd0c95d0cfa536fa29728e47dcf5b7cd0b7ef48e1
1 /* oglconsole -- gpl license here */
2 /* Added macro for con_printf() -- lon */
3 #define OGLCONSOLE_USE_SDL
5 #ifndef _OGLCONSOLE_H
6 #define _OGLCONSOLE_H
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
12 /* Opaque to you you lowly user */
13 typedef struct _OGLCONSOLE_Console *OGLCONSOLE_Console;
15 /* Initialize/uninitialize OGLConsole */
16 OGLCONSOLE_Console OGLCONSOLE_Create(void);
17 void OGLCONSOLE_InitText(void *console, int res_x, int res_y);
18 void OGLCONSOLE_Destroy(OGLCONSOLE_Console console);
19 void OGLCONSOLE_Quit(void);
21 int command_split(char *cmd, void **argv, int *argc, int max);
23 /* Set console which has PROGRAMMER focus (not application focus) */
25 /* This function renders the console */
26 void OGLCONSOLE_Draw(void);
27 void OGLCONSOLE_Render(OGLCONSOLE_Console console);
29 /* Print to the console */
30 void OGLCONSOLE_Print(char *s, ...);
31 void OGLCONSOLE_Output(OGLCONSOLE_Console console, const char *s, ...);
33 #define con_printf(fmt, args...) \
34 do { \
35 printf(fmt, ##args); \
36 OGLCONSOLE_Print(fmt, ##args); \
37 } while(0)
39 /* Register a callback with the console */
40 void OGLCONSOLE_EnterKey(void(*cbfun)(OGLCONSOLE_Console console,
41 int argc, char **argv));
43 /* This function tries to handle the incoming SDL event. In the future there may
44 * be non-SDL analogs for input systems such as GLUT. Returns true if the event
45 * was handled by the console. If console is hidden, no events are handled. */
46 #if defined(OGLCONSOLE_USE_SDL)
47 #include "SDL.h"
48 int OGLCONSOLE_SDLEvent(SDL_Event * e);
49 #endif
51 /* Sets the current console for receiving user input */
52 void OGLCONSOLE_FocusConsole(OGLCONSOLE_Console console);
54 /* Sets the current console for making options changes to */
55 void OGLCONSOLE_EditConsole(OGLCONSOLE_Console console);
57 /* Sets the dimensions of the console in lines and columns of characters. */
58 void OGLCONSOLE_SetDimensions(int width, int height);
60 /* Show or hide the console. */
61 void OGLCONSOLE_SetVisibility(int visible);
63 #ifdef __cplusplus
65 #endif
67 #endif