Merge branch 'master' into gallium-0.2
[mesa.git] / src / glut / dos / internal.h
1 /*
2 * DOS/DJGPP Mesa Utility Toolkit
3 * Version: 1.0
4 *
5 * Copyright (C) 2005 Daniel Borca All Rights Reserved.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * DANIEL BORCA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24
25
26 #ifndef INTERNAL_H_included
27 #define INTERNAL_H_included
28
29 #include <GL/glut.h>
30
31 #include "GL/dmesa.h"
32
33
34 #define MAX_WINDOWS 2
35 #define MAX_TIMER_CB 8
36 #define RESERVED_COLORS 0
37
38
39 /* GLUT function types */
40 typedef void (GLUTCALLBACK *GLUTdisplayCB) (void);
41 typedef void (GLUTCALLBACK *GLUTreshapeCB) (int, int);
42 typedef void (GLUTCALLBACK *GLUTkeyboardCB) (unsigned char, int, int);
43 typedef void (GLUTCALLBACK *GLUTmouseCB) (int, int, int, int);
44 typedef void (GLUTCALLBACK *GLUTmotionCB) (int, int);
45 typedef void (GLUTCALLBACK *GLUTpassiveCB) (int, int);
46 typedef void (GLUTCALLBACK *GLUTentryCB) (int);
47 typedef void (GLUTCALLBACK *GLUTvisibilityCB) (int);
48 typedef void (GLUTCALLBACK *GLUTwindowStatusCB) (int);
49 typedef void (GLUTCALLBACK *GLUTidleCB) (void);
50 typedef void (GLUTCALLBACK *GLUTtimerCB) (int);
51 typedef void (GLUTCALLBACK *GLUTmenuStateCB) (int); /* DEPRECATED. */
52 typedef void (GLUTCALLBACK *GLUTmenuStatusCB) (int, int, int);
53 typedef void (GLUTCALLBACK *GLUTselectCB) (int);
54 typedef void (GLUTCALLBACK *GLUTspecialCB) (int, int, int);
55 typedef void (GLUTCALLBACK *GLUTspaceMotionCB) (int, int, int);
56 typedef void (GLUTCALLBACK *GLUTspaceRotateCB) (int, int, int);
57 typedef void (GLUTCALLBACK *GLUTspaceButtonCB) (int, int);
58 typedef void (GLUTCALLBACK *GLUTdialsCB) (int, int);
59 typedef void (GLUTCALLBACK *GLUTbuttonBoxCB) (int, int);
60 typedef void (GLUTCALLBACK *GLUTtabletMotionCB) (int, int);
61 typedef void (GLUTCALLBACK *GLUTtabletButtonCB) (int, int, int, int);
62 typedef void (GLUTCALLBACK *GLUTjoystickCB) (unsigned int, int, int, int);
63
64 typedef void (GLUTCALLBACK *GLUTdestroyCB) (void);
65 typedef void (GLUTCALLBACK *GLUTmouseWheelCB) (int, int, int, int);
66 typedef void (GLUTCALLBACK *GLUTmenuDestroyCB) (void);
67
68
69 typedef struct {
70 GLuint bpp, alpha;
71 GLuint depth, stencil;
72 GLuint accum;
73
74 GLint geometry[2];
75 GLuint refresh;
76
77 GLint flags;
78 } GLUTvisual;
79
80 typedef struct {
81 GLint x, y;
82 GLint width, height;
83 GLuint mode;
84 } GLUTdefault;
85
86 typedef struct {
87 void (*func) (int);
88 int value;
89 int time;
90 } GLUTSShotCB;
91
92 typedef struct GLUTwindow {
93 int num; /* window id */
94
95 DMesaContext context;
96 DMesaBuffer buffer;
97
98 int show_mouse;
99 GLboolean redisplay;
100
101 /* GLUT settable or visible window state. */
102 int xpos;
103 int ypos;
104 int width; /* window width in pixels */
105 int height; /* window height in pixels */
106
107 /* Per-window callbacks. */
108 GLUTdisplayCB display; /* redraw */
109 GLUTreshapeCB reshape; /* resize (width,height) */
110 GLUTmouseCB mouse; /* mouse (button,state,x,y) */
111 GLUTmotionCB motion; /* motion (x,y) */
112 GLUTpassiveCB passive; /* passive motion (x,y) */
113 GLUTentryCB entry; /* window entry/exit (state) */
114 GLUTkeyboardCB keyboard; /* keyboard (ASCII,x,y) */
115 GLUTkeyboardCB keyboardUp; /* keyboard up (ASCII,x,y) */
116 GLUTwindowStatusCB windowStatus; /* window status */
117 GLUTvisibilityCB visibility; /* visibility */
118 GLUTspecialCB special; /* special key */
119 GLUTspecialCB specialUp; /* special up key */
120 GLUTbuttonBoxCB buttonBox; /* button box */
121 GLUTdialsCB dials; /* dials */
122 GLUTspaceMotionCB spaceMotion; /* Spaceball motion */
123 GLUTspaceRotateCB spaceRotate; /* Spaceball rotate */
124 GLUTspaceButtonCB spaceButton; /* Spaceball button */
125 GLUTtabletMotionCB tabletMotion; /* tablet motion */
126 GLUTtabletButtonCB tabletButton; /* tablet button */
127 GLUTjoystickCB joystick; /* joystick */
128
129 GLUTdestroyCB destroy; /* destroy */
130 GLUTmouseWheelCB mouseWheel; /* mouse wheel */
131
132 /* specific data */
133 void *data;
134 } GLUTwindow;
135
136 typedef struct {
137 int width, height;
138 int xorig, yorig;
139 int xmove;
140 const unsigned char *bitmap;
141 } GLUTBitmapChar;
142
143 typedef struct {
144 const char *name;
145 int height;
146 int num;
147 const GLUTBitmapChar *const *table;
148 } GLUTBitmapFont;
149
150 typedef struct {
151 const GLfloat x, y;
152 } GLUTStrokeVertex;
153
154 typedef struct {
155 const unsigned num;
156 const GLUTStrokeVertex *vertex;
157 } GLUTStrokeStrip;
158
159 typedef struct {
160 const GLfloat right;
161 const unsigned num;
162 const GLUTStrokeStrip *strip;
163 } GLUTStrokeChar;
164
165 typedef struct {
166 const char *name;
167 const unsigned num;
168 const GLUTStrokeChar *const *table;
169 const GLfloat height;
170 const GLfloat descent;
171 } GLUTStrokeFont;
172
173
174 extern char *__glutProgramName;
175
176 extern GLUTvisual _glut_visual;
177 extern GLUTdefault _glut_default;
178
179 extern GLuint _glut_fps;
180 extern GLUTidleCB _glut_idle_func;
181 extern GLUTmenuStatusCB _glut_menu_status_func;
182 extern GLUTSShotCB _glut_timer_cb[];
183
184 extern GLUTwindow *_glut_current, *_glut_windows[];
185
186 extern int _glut_mouse; /* number of buttons, if mouse installed */
187 extern int _glut_mouse_x, _glut_mouse_y; /* mouse coords, relative to current win */
188
189
190 extern void _glut_mouse_init (void);
191 extern void _glut_fatal(char *format,...);
192 extern void *_glut_font (void *font);
193
194
195 #include "pc_hw/pc_hw.h"
196
197 #endif