6 #include "../rtlib/fb.h"
10 #define DISABLE_OPENGL
13 #define PI 3.1415926535897932384626
15 #define BYTES_PER_PIXEL(d) (((d) + 7) / 8)
16 #define BPP_MASK(b) ((int)((1LL << ((b) << 3)) - 1))
18 #define DRIVER_LOCK() do { fb_GfxLock(); } while (0)
19 #define DRIVER_UNLOCK() do { fb_GfxUnlock(1, 0); } while (0)
20 #define SET_DIRTY(c,y,h) { if (__fb_gfx->framebuffer == (c)->line[0]) fb_hMemSet(__fb_gfx->dirty + (y), TRUE, (h)); }
22 #define EVENT_LOCK() { fb_MutexLock(__fb_gfx->event_mutex); }
23 #define EVENT_UNLOCK() { fb_MutexUnlock(__fb_gfx->event_mutex); }
25 #define DRIVER_NULL -1
26 #define DRIVER_FULLSCREEN 0x00000001
27 #define DRIVER_OPENGL 0x00000002
28 #define DRIVER_NO_SWITCH 0x00000004
29 #define DRIVER_NO_FRAME 0x00000008
30 #define DRIVER_SHAPED_WINDOW 0x00000010
31 #define DRIVER_ALWAYS_ON_TOP 0x00000020
32 #define DRIVER_ALPHA_PRIMITIVES 0x00000040
33 #define DRIVER_HIGH_PRIORITY 0x00000080
34 #define DRIVER_OPENGL_OPTIONS 0x000F0000
35 #define HAS_STENCIL_BUFFER 0x00010000
36 #define HAS_ACCUMULATION_BUFFER 0x00020000
37 #define HAS_MULTISAMPLE 0x00040000
39 #define HAS_MMX 0x01000000
40 #define SCREEN_EXIT 0x80000000
41 #define PRINT_SCROLL_WAS_OFF 0x00000004
42 #define ALPHA_PRIMITIVES 0x00000008
43 #define OPENGL_PRIMITIVES 0x00000010
44 #define HIGH_PRIORITY 0x00000020
45 #define QB_COMPATIBILITY 0x10000000
46 #define OPENGL_SUPPORT 0x20000000
48 #define CTX_BUFFER_INIT 0x00000001
49 #define CTX_BUFFER_SET 0x00000002
50 #define CTX_WINDOW_ACTIVE 0x00000004
51 #define CTX_WINDOW_SCREEN 0x00000008
52 #define CTX_VIEWPORT_SET 0x00000010
53 #define CTX_VIEW_SCREEN 0x00000020
55 #define COORD_TYPE_AA 0
56 #define COORD_TYPE_AR 1
57 #define COORD_TYPE_RA 2
58 #define COORD_TYPE_RR 3
59 #define COORD_TYPE_A 4
60 #define COORD_TYPE_R 5
61 #define COORD_TYPE_MASK 0x00000007
62 #define DEFAULT_COLOR_1 0x80000000
63 #define DEFAULT_COLOR_2 0x40000000
64 #define VIEW_SCREEN 0x00000001
66 #define LINE_TYPE_LINE 0
68 #define LINE_TYPE_BF 2
70 #define PAINT_TYPE_FILL 0
71 #define PAINT_TYPE_PATTERN 1
73 #define MASK_COLOR_32 0xFF00FF
74 #define MASK_COLOR_16 0xF81F
76 #define MASK_RB_32 0x00FF00FF
77 #define MASK_G_32 0x0000FF00
78 #define MASK_GA_32 0xFF00FF00
79 #define MASK_A_32 0xFF000000
81 #define MASK_RB_16 0xF81F
82 #define MASK_R_16 0xF800
83 #define MASK_G_16 0x07E0
84 #define MASK_B_16 0x001F
86 #define PUT_HEADER_NEW 0x7
88 #define PUT_MODE_TRANS 0
89 #define PUT_MODE_PSET 1
90 #define PUT_MODE_PRESET 2
91 #define PUT_MODE_AND 3
93 #define PUT_MODE_XOR 5
94 #define PUT_MODE_ALPHA 6
95 #define PUT_MODE_ADD 7
96 #define PUT_MODE_CUSTOM 8
97 #define PUT_MODE_BLEND 9
100 #define WINDOW_TITLE_SIZE 128
102 #define EVENT_KEY_PRESS 1
103 #define EVENT_KEY_RELEASE 2
104 #define EVENT_KEY_REPEAT 3
105 #define EVENT_MOUSE_MOVE 4
106 #define EVENT_MOUSE_BUTTON_PRESS 5
107 #define EVENT_MOUSE_BUTTON_RELEASE 6
108 #define EVENT_MOUSE_DOUBLE_CLICK 7
109 #define EVENT_MOUSE_WHEEL 8
110 #define EVENT_MOUSE_ENTER 9
111 #define EVENT_MOUSE_EXIT 10
112 #define EVENT_WINDOW_GOT_FOCUS 11
113 #define EVENT_WINDOW_LOST_FOCUS 12
114 #define EVENT_WINDOW_CLOSE 13
115 #define EVENT_MOUSE_HWHEEL 14
117 #define MAX_EVENTS 128
119 #define BUTTON_LEFT 0x1
120 #define BUTTON_RIGHT 0x2
121 #define BUTTON_MIDDLE 0x4
122 #define BUTTON_X1 0x8
123 #define BUTTON_X2 0x10
125 #define GET_WINDOW_POS 0
126 #define GET_WINDOW_TITLE 1
127 #define GET_WINDOW_HANDLE 2
128 #define GET_DESKTOP_SIZE 3
129 #define GET_SCREEN_SIZE 4
130 #define GET_SCREEN_DEPTH 5
131 #define GET_SCREEN_BPP 6
132 #define GET_SCREEN_PITCH 7
133 #define GET_SCREEN_REFRESH 8
134 #define GET_DRIVER_NAME 9
135 #define GET_TRANSPARENT_COLOR 10
136 #define GET_VIEWPORT 11
137 #define GET_PEN_POS 12
139 #define GET_ALPHA_PRIMITIVES 14
140 #define GET_GL_EXTENSIONS 15
141 #define GET_HIGH_PRIORITY 16
143 #define SET_FIRST_SETTER 100
144 #define SET_WINDOW_POS 100
145 #define SET_WINDOW_TITLE 101
146 #define SET_PEN_POS 102
147 #define SET_DRIVER_NAME 103
148 #define SET_ALPHA_PRIMITIVES 104
149 #define SET_GL_COLOR_BITS 105
150 #define SET_GL_COLOR_RED_BITS 106
151 #define SET_GL_COLOR_GREEN_BITS 107
152 #define SET_GL_COLOR_BLUE_BITS 108
153 #define SET_GL_COLOR_ALPHA_BITS 109
154 #define SET_GL_DEPTH_BITS 110
155 #define SET_GL_STENCIL_BITS 111
156 #define SET_GL_ACCUM_BITS 112
157 #define SET_GL_ACCUM_RED_BITS 113
158 #define SET_GL_ACCUM_GREEN_BITS 114
159 #define SET_GL_ACCUM_BLUE_BITS 115
160 #define SET_GL_ACCUM_ALPHA_BITS 116
161 #define SET_GL_NUM_SAMPLES 117
163 #define POLL_EVENTS 200
167 typedef void (
PUTTER)(
unsigned char *,
unsigned char *, int, int, int, int, int,
BLENDER *,
void *);
287 int (*
init)(
char *title,
int w,
int h,
int depth,
int refresh_rate,
int flags);
353 int (*
get_mouse)(
int *x,
int *y,
int *z,
int *buttons,
int *clip);
393 int *(*fetch_modes)(
int depth,
int *
size);
447 extern void *(*fb_hMemCpy)(
void *dest,
const void *src,
size_t size);
448 extern void *(*fb_hMemSet)(
void *dest,
int value,
size_t size);
449 extern void *(*fb_hPixelCpy)(
void *dest,
const void *src,
size_t size);
450 extern void *(*fb_hPixelSet)(
void *dest,
int color,
size_t size);
478 extern FBCALL int fb_hEncode(
const unsigned char *in_buffer, ssize_t in_size,
unsigned char *out_buffer, ssize_t *out_size);
479 extern FBCALL int fb_hDecode(
const unsigned char *in_buffer, ssize_t in_size,
unsigned char *out_buffer, ssize_t *out_size);
483 extern unsigned int fb_hMakeColor(
int bpp,
unsigned int index,
int r,
int g,
int b);
493 extern void fb_hGfxBox(
int x1,
int y1,
int x2,
int y2,
unsigned int color,
int full,
unsigned int style);
510 extern FBCALL int fb_GfxScreen(
int mode,
int depth,
int num_pages,
int flags,
int refresh_rate);
526 extern FBCALL void fb_GfxPset(
void *target,
float x,
float y,
unsigned int color,
int coord_type,
int ispreset);
530 extern FBCALL void fb_GfxView(
int x1,
int y1,
int x2,
int y2,
unsigned int fill_color,
unsigned int border_color,
int screen);
532 extern FBCALL void fb_GfxLine(
void *target,
float x1,
float y1,
float x2,
float y2,
unsigned int color,
int type,
unsigned int style,
int coord_type);
533 extern FBCALL void fb_GfxEllipse(
void *target,
float x,
float y,
float radius,
unsigned int color,
float aspect,
float start,
float end,
int fill,
int coord_type);
534 extern FBCALL int fb_GfxGet(
void *target,
float x1,
float y1,
float x2,
float y2,
unsigned char *dest,
int coord_type,
FBARRAY *array);
535 extern FBCALL int fb_GfxGetQB(
void *target,
float x1,
float y1,
float x2,
float y2,
unsigned char *dest,
int coord_type,
FBARRAY *array);
536 extern FBCALL int fb_GfxPut(
void *target,
float x,
float y,
unsigned char *src,
int x1,
int y1,
int x2,
int y2,
int coord_type,
int mode,
PUTTER *putter,
int alpha,
BLENDER *blender,
void *param);
538 extern FBCALL void fb_GfxPaint(
void *target,
float fx,
float fy,
unsigned int color,
unsigned int border_color,
FBSTRING *pattern,
int mode,
int coord_type);
540 extern FBCALL int fb_GfxDrawString(
void *target,
float fx,
float fy,
int coord_type,
FBSTRING *
string,
unsigned int color,
void *font,
int mode,
PUTTER *putter,
BLENDER *blender,
void *param);
546 extern FBCALL int fb_GfxGetJoystick(
int id, ssize_t *buttons,
float *a1,
float *a2,
float *a3,
float *a4,
float *a5,
float *a6,
float *a7,
float *a8);
549 extern FBCALL void fb_GfxControl_i(
int what, ssize_t *param1, ssize_t *param2, ssize_t *param3, ssize_t *param4);
565 int fb_GfxColor(
int fg_color,
int bg_color,
int flags);
580 int fb_GfxGetMouse(
int *x,
int *y,
int *z,
int *buttons,
int *clip);
582 int fb_GfxOut(
unsigned short port,
unsigned char value);
584 int fb_GfxLineInput(
FBSTRING *text,
void *dst, ssize_t dst_len,
int fillrem,
int addquestion,
int addnewline );
586 unsigned int fb_GfxReadXY(
int col,
int row,
int colorflag );
608 void fb_hPutTrans (
unsigned char *src,
unsigned char *dest,
int w,
int h,
int src_pitch,
int dest_pitch,
int alpha,
BLENDER *blender,
void *param);
609 void fb_hPutPSet (
unsigned char *src,
unsigned char *dest,
int w,
int h,
int src_pitch,
int dest_pitch,
int alpha,
BLENDER *blender,
void *param);
610 void fb_hPutPReset(
unsigned char *src,
unsigned char *dest,
int w,
int h,
int src_pitch,
int dest_pitch,
int alpha,
BLENDER *blender,
void *param);
611 void fb_hPutAnd (
unsigned char *src,
unsigned char *dest,
int w,
int h,
int src_pitch,
int dest_pitch,
int alpha,
BLENDER *blender,
void *param);
612 void fb_hPutOr (
unsigned char *src,
unsigned char *dest,
int w,
int h,
int src_pitch,
int dest_pitch,
int alpha,
BLENDER *blender,
void *param);
613 void fb_hPutXor (
unsigned char *src,
unsigned char *dest,
int w,
int h,
int src_pitch,
int dest_pitch,
int alpha,
BLENDER *blender,
void *param);
614 void fb_hPutAlpha (
unsigned char *src,
unsigned char *dest,
int w,
int h,
int src_pitch,
int dest_pitch,
int alpha,
BLENDER *blender,
void *param);
615 void fb_hPutBlend (
unsigned char *src,
unsigned char *dest,
int w,
int h,
int src_pitch,
int dest_pitch,
int alpha,
BLENDER *blender,
void *param);
616 void fb_hPutAdd (
unsigned char *src,
unsigned char *dest,
int w,
int h,
int src_pitch,
int dest_pitch,
int alpha,
BLENDER *blender,
void *param);
617 void fb_hPutCustom(
unsigned char *src,
unsigned char *dest,
int w,
int h,
int src_pitch,
int dest_pitch,
int alpha,
BLENDER *blender,
void *param);
621 #define FB_GFX_ACTIVE() \
630 #define FB_GFX_GET_CODEPAGE() \
635 #define FB_GFX_GET_CHARSET() \