2007-01-29 01:18:16 +00:00
|
|
|
// Base services interface declaration
|
|
|
|
// for the Build Engine
|
|
|
|
// by Jonathon Fowler (jonof@edgenetwk.com)
|
|
|
|
|
|
|
|
#ifndef __baselayer_h__
|
|
|
|
#define __baselayer_h__
|
|
|
|
|
2008-02-16 22:27:08 +00:00
|
|
|
#include "compat.h"
|
|
|
|
|
2007-01-29 01:18:16 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
extern int _buildargc;
|
2007-08-17 03:16:46 +00:00
|
|
|
extern const char **_buildargv;
|
2007-01-29 01:18:16 +00:00
|
|
|
|
|
|
|
extern char quitevent, appactive;
|
|
|
|
|
2008-07-22 21:03:09 +00:00
|
|
|
extern int vsync;
|
|
|
|
|
2006-07-01 01:40:18 +00:00
|
|
|
// NOTE: these are implemented in game-land so they may be overridden in game specific ways
|
|
|
|
extern int startwin_open(void);
|
|
|
|
extern int startwin_close(void);
|
|
|
|
extern int startwin_puts(const char *);
|
|
|
|
extern int startwin_settitle(const char *);
|
|
|
|
extern int startwin_idle(void *);
|
|
|
|
|
2007-01-29 01:18:16 +00:00
|
|
|
// video
|
2008-02-16 22:27:08 +00:00
|
|
|
extern int xres, yres, bpp, fullscreen, bytesperline, imageSize;
|
|
|
|
extern intptr_t frameplace;
|
2007-01-29 01:18:16 +00:00
|
|
|
extern char offscreenrendering;
|
|
|
|
|
|
|
|
extern void (*baselayer_onvideomodechange)(int);
|
|
|
|
|
|
|
|
#ifdef USE_OPENGL
|
2008-02-24 00:46:57 +00:00
|
|
|
#include "osd.h"
|
|
|
|
extern int osdcmd_glinfo(const osdfuncparm_t *parm);
|
|
|
|
|
2007-01-29 01:18:16 +00:00
|
|
|
struct glinfo {
|
|
|
|
const char *vendor;
|
|
|
|
const char *renderer;
|
|
|
|
const char *version;
|
|
|
|
const char *extensions;
|
|
|
|
|
|
|
|
float maxanisotropy;
|
|
|
|
char bgra;
|
|
|
|
char clamptoedge;
|
|
|
|
char texcompr;
|
|
|
|
char texnpot;
|
|
|
|
char multisample;
|
|
|
|
char nvmultisamplehint;
|
|
|
|
char arbfp;
|
|
|
|
char depthtex;
|
|
|
|
char shadow;
|
|
|
|
char fbos;
|
|
|
|
char rect;
|
|
|
|
char multitex;
|
|
|
|
char envcombine;
|
2007-03-08 03:07:10 +00:00
|
|
|
char vbos;
|
2008-07-22 21:03:09 +00:00
|
|
|
char vsync;
|
2008-02-24 00:46:57 +00:00
|
|
|
char dumped;
|
2007-01-29 01:18:16 +00:00
|
|
|
};
|
|
|
|
extern struct glinfo glinfo;
|
2008-07-22 21:03:09 +00:00
|
|
|
extern void setvsync(int sync);
|
2007-01-29 01:18:16 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
extern char inputdevices;
|
|
|
|
|
|
|
|
// keys
|
|
|
|
#define KEYFIFOSIZ 64
|
|
|
|
extern char keystatus[256], keyfifo[KEYFIFOSIZ], keyfifoplc, keyfifoend;
|
|
|
|
extern unsigned char keyasciififo[KEYFIFOSIZ], keyasciififoplc, keyasciififoend;
|
2008-07-02 01:32:53 +00:00
|
|
|
extern char scantoasc[128];
|
2007-01-29 01:18:16 +00:00
|
|
|
|
|
|
|
// mouse
|
2008-04-05 23:01:58 +00:00
|
|
|
extern volatile int mousex, mousey, mouseb;
|
2007-01-29 01:18:16 +00:00
|
|
|
|
|
|
|
// joystick
|
2007-12-12 17:42:14 +00:00
|
|
|
extern int *joyaxis, *joyhat, joyb;
|
2007-01-29 01:18:16 +00:00
|
|
|
extern char joyisgamepad, joynumaxes, joynumbuttons, joynumhats;
|
2007-12-12 17:42:14 +00:00
|
|
|
extern int joyaxespresent;
|
2007-01-29 01:18:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int initsystem(void);
|
|
|
|
void uninitsystem(void);
|
|
|
|
|
|
|
|
void initprintf(const char *, ...);
|
|
|
|
void debugprintf(const char *,...);
|
|
|
|
|
|
|
|
int handleevents(void);
|
2006-12-21 12:53:11 +00:00
|
|
|
extern inline void idle(void);
|
2007-01-29 01:18:16 +00:00
|
|
|
|
2007-12-12 17:42:14 +00:00
|
|
|
typedef void (*KeyPressCallback)(int,int);
|
|
|
|
typedef void (*MousePressCallback)(int,int);
|
|
|
|
typedef void (*JoyPressCallback)(int,int);
|
2007-01-29 01:18:16 +00:00
|
|
|
int initinput(void);
|
|
|
|
void uninitinput(void);
|
|
|
|
void releaseallbuttons(void);
|
2007-12-12 17:42:14 +00:00
|
|
|
void setkeypresscallback(void (*callback)(int,int));
|
|
|
|
void setmousepresscallback(void (*callback)(int,int));
|
|
|
|
void setjoypresscallback(void (*callback)(int,int));
|
2007-01-29 01:18:16 +00:00
|
|
|
const unsigned char *getkeyname(int num);
|
|
|
|
const unsigned char *getjoyname(int what, int num); // what: 0=axis, 1=button, 2=hat
|
|
|
|
|
|
|
|
unsigned char bgetchar(void);
|
|
|
|
int bkbhit(void);
|
|
|
|
void bflushchars(void);
|
|
|
|
|
|
|
|
int initmouse(void);
|
|
|
|
void uninitmouse(void);
|
|
|
|
void grabmouse(char a);
|
2007-12-12 17:42:14 +00:00
|
|
|
void readmousexy(int *x, int *y);
|
|
|
|
void readmousebstatus(int *b);
|
2007-01-29 01:18:16 +00:00
|
|
|
void setjoydeadzone(int axis, unsigned short dead, unsigned short satur);
|
|
|
|
void getjoydeadzone(int axis, unsigned short *dead, unsigned short *satur);
|
|
|
|
|
|
|
|
int inittimer(int);
|
|
|
|
void uninittimer(void);
|
|
|
|
void sampletimer(void);
|
2007-12-12 17:42:14 +00:00
|
|
|
unsigned int getticks(void);
|
2007-01-29 01:18:16 +00:00
|
|
|
int gettimerfreq(void);
|
|
|
|
void (*installusertimercallback(void (*callback)(void)))(void);
|
|
|
|
|
|
|
|
int checkvideomode(int *x, int *y, int c, int fs, int forced);
|
|
|
|
int setvideomode(int x, int y, int c, int fs);
|
|
|
|
void getvalidmodes(void);
|
|
|
|
void resetvideomode(void);
|
|
|
|
|
|
|
|
void begindrawing(void);
|
|
|
|
void enddrawing(void);
|
|
|
|
void showframe(int);
|
|
|
|
|
|
|
|
int setpalette(int start, int num, char *dapal);
|
|
|
|
//int getpalette(int start, int num, char *dapal);
|
2008-07-19 13:12:20 +00:00
|
|
|
int setgamma(void);
|
2008-07-21 03:06:34 +00:00
|
|
|
double vid_gamma, vid_contrast, vid_brightness;
|
2007-01-29 01:18:16 +00:00
|
|
|
|
2008-07-21 09:05:53 +00:00
|
|
|
#define DEFAULT_GAMMA 1.0
|
2008-07-20 11:03:57 +00:00
|
|
|
#define DEFAULT_CONTRAST 1.2
|
2008-07-21 09:05:53 +00:00
|
|
|
#define DEFAULT_BRIGHTNESS 0.1
|
2008-07-20 11:03:57 +00:00
|
|
|
|
2007-01-29 01:18:16 +00:00
|
|
|
int switchrendermethod(int,int); // 0 = software, 1 = opengl | bool = reinit
|
|
|
|
|
|
|
|
int wm_msgbox(char *name, char *fmt, ...);
|
|
|
|
int wm_ynbox(char *name, char *fmt, ...);
|
|
|
|
void wm_setapptitle(char *name);
|
|
|
|
|
|
|
|
// baselayer.c
|
|
|
|
int baselayer_init();
|
|
|
|
|
2007-10-24 07:12:50 +00:00
|
|
|
void makeasmwriteable(void);
|
|
|
|
|
2007-01-29 01:18:16 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif // __baselayer_h__
|
|
|
|
|