2006-04-13 20:47:06 +00:00
|
|
|
// On-screen display (ie. console)
|
|
|
|
// for the Build Engine
|
|
|
|
// by Jonathon Fowler (jonof@edgenetwk.com)
|
|
|
|
|
|
|
|
#ifndef __osd_h__
|
|
|
|
#define __osd_h__
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
int numparms;
|
|
|
|
const char *name;
|
|
|
|
const char **parms;
|
|
|
|
const char *raw;
|
|
|
|
} osdfuncparm_t;
|
|
|
|
|
2008-06-30 00:18:59 +00:00
|
|
|
typedef struct _symbol
|
|
|
|
{
|
|
|
|
const char *name;
|
|
|
|
struct _symbol *next;
|
|
|
|
|
|
|
|
const char *help;
|
|
|
|
int (*func)(const osdfuncparm_t *);
|
|
|
|
} symbol_t;
|
|
|
|
|
2008-06-30 07:30:48 +00:00
|
|
|
symbol_t *symbols;
|
|
|
|
const char *stripcolorcodes(const char *t);
|
2008-06-30 00:18:59 +00:00
|
|
|
|
2008-06-30 00:32:05 +00:00
|
|
|
#define OSD_ALIAS 1337
|
2008-06-30 01:03:51 +00:00
|
|
|
#define OSD_UNALIASED 1338
|
2008-06-30 00:18:59 +00:00
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
#define OSDCMD_OK 0
|
|
|
|
#define OSDCMD_SHOWHELP 1
|
|
|
|
|
2008-07-07 12:35:21 +00:00
|
|
|
int OSD_ParsingScript(void);
|
2008-07-18 23:29:20 +00:00
|
|
|
|
2008-07-07 12:35:21 +00:00
|
|
|
int OSD_OSDKey(void);
|
2008-07-23 03:56:50 +00:00
|
|
|
int OSD_GetTextMode(void);
|
|
|
|
void OSD_SetTextMode(int mode);
|
2008-07-18 23:29:20 +00:00
|
|
|
|
2008-06-30 07:30:48 +00:00
|
|
|
int OSD_Exec(const char *szScript);
|
2008-07-18 23:29:20 +00:00
|
|
|
|
|
|
|
char *OSD_GetFmt(char *ptr);
|
2008-07-18 09:50:44 +00:00
|
|
|
char *OSD_GetTextPtr(void);
|
|
|
|
char *OSD_GetFmtPtr(void);
|
2008-06-30 07:30:48 +00:00
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
// initializes things
|
|
|
|
void OSD_Init(void);
|
|
|
|
|
|
|
|
// sets the file to echo output to
|
|
|
|
void OSD_SetLogFile(char *fn);
|
|
|
|
|
|
|
|
// sets the functions the OSD will call to interrogate the environment
|
|
|
|
void OSD_SetFunctions(
|
|
|
|
void (*drawchar)(int,int,char,int,int),
|
|
|
|
void (*drawstr)(int,int,char*,int,int,int),
|
|
|
|
void (*drawcursor)(int,int,int,int),
|
|
|
|
int (*colwidth)(int),
|
|
|
|
int (*rowheight)(int),
|
|
|
|
void (*clearbg)(int,int),
|
|
|
|
int (*gettime)(void),
|
|
|
|
void (*onshow)(int)
|
|
|
|
);
|
|
|
|
|
|
|
|
// sets the parameters for presenting the text
|
|
|
|
void OSD_SetParameters(
|
|
|
|
int promptshade, int promptpal,
|
|
|
|
int editshade, int editpal,
|
|
|
|
int textshade, int textpal
|
|
|
|
);
|
|
|
|
|
|
|
|
// sets the scancode for the key which activates the onscreen display
|
|
|
|
void OSD_CaptureKey(int sc);
|
|
|
|
|
|
|
|
// handles keyboard input when capturing input. returns 0 if key was handled
|
|
|
|
// or the scancode if it should be handled by the game.
|
2008-07-02 01:32:53 +00:00
|
|
|
int OSD_HandleScanCode(int sc, int press);
|
2008-07-05 09:12:36 +00:00
|
|
|
int OSD_HandleChar(char ch);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
// handles the readjustment when screen resolution changes
|
|
|
|
void OSD_ResizeDisplay(int w,int h);
|
|
|
|
|
2006-12-11 03:32:43 +00:00
|
|
|
// captures and frees osd input
|
|
|
|
void OSD_CaptureInput(int cap);
|
|
|
|
|
2006-12-11 04:38:10 +00:00
|
|
|
// sets the console version string
|
2007-04-17 05:54:12 +00:00
|
|
|
void OSD_SetVersionString(const char *version, int shade, int pal);
|
2006-12-11 04:38:10 +00:00
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
// shows or hides the onscreen display
|
|
|
|
void OSD_ShowDisplay(int onf);
|
|
|
|
|
|
|
|
// draw the osd to the screen
|
|
|
|
void OSD_Draw(void);
|
|
|
|
|
|
|
|
// just like printf
|
|
|
|
void OSD_Printf(const char *fmt, ...);
|
|
|
|
#define printOSD OSD_Printf
|
|
|
|
|
|
|
|
// executes buffered commands
|
|
|
|
void OSD_DispatchQueued(void);
|
|
|
|
|
|
|
|
// executes a string
|
|
|
|
int OSD_Dispatch(const char *cmd);
|
|
|
|
|
|
|
|
// registers a function
|
|
|
|
// name = name of the function
|
|
|
|
// help = a short help string
|
|
|
|
// func = the entry point to the function
|
|
|
|
int OSD_RegisterFunction(const char *name, const char *help, int (*func)(const osdfuncparm_t*));
|
|
|
|
|
2008-07-18 09:50:44 +00:00
|
|
|
// these correspond to the Duke palettes, so they shouldn't really be here
|
|
|
|
// ...but I don't care
|
|
|
|
|
|
|
|
#define OSDTEXT_BLUE "^00"
|
2008-07-18 13:18:12 +00:00
|
|
|
#define OSDTEXT_GOLD "^07"
|
2008-07-18 09:50:44 +00:00
|
|
|
#define OSDTEXT_DARKRED "^10"
|
|
|
|
#define OSDTEXT_GREEN "^11"
|
|
|
|
#define OSDTEXT_GRAY "^12"
|
|
|
|
#define OSDTEXT_DARKGRAY "^13"
|
|
|
|
#define OSDTEXT_DARKGREEN "^14"
|
|
|
|
#define OSDTEXT_BROWN "^15"
|
|
|
|
#define OSDTEXT_DARKBLUE "^16"
|
|
|
|
#define OSDTEXT_RED "^21"
|
|
|
|
#define OSDTEXT_YELLOW "^23"
|
2008-07-18 13:18:12 +00:00
|
|
|
#define OSDTEXT_BRIGHT "^S0"
|
|
|
|
|
2008-07-27 01:22:17 +00:00
|
|
|
#define OSD_ERROR OSDTEXT_DARKRED OSDTEXT_BRIGHT
|
2008-07-18 13:18:12 +00:00
|
|
|
#define TEXTSIZE 32768
|
2008-07-18 09:50:44 +00:00
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
#endif // __osd_h__
|
|
|
|
|