summaryrefslogtreecommitdiff
path: root/src/glut/dos/internal.h
blob: 063c2d00d966176d937932ea0ddaa51b5c42744d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
/*
 * DOS/DJGPP Mesa Utility Toolkit
 * Version:  1.0
 *
 * Copyright (C) 2005  Daniel Borca   All Rights Reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included
 * in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * DANIEL BORCA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

 
#ifndef INTERNAL_H_included
#define INTERNAL_H_included

#include <GL/glut.h>

#include "GL/dmesa.h"


#define MAX_WINDOWS     2
#define MAX_TIMER_CB    8
#define RESERVED_COLORS 0


/* GLUT  function types */
typedef void (GLUTCALLBACK *GLUTdisplayCB) (void);
typedef void (GLUTCALLBACK *GLUTreshapeCB) (int, int);
typedef void (GLUTCALLBACK *GLUTkeyboardCB) (unsigned char, int, int);
typedef void (GLUTCALLBACK *GLUTmouseCB) (int, int, int, int);
typedef void (GLUTCALLBACK *GLUTmotionCB) (int, int);
typedef void (GLUTCALLBACK *GLUTpassiveCB) (int, int);
typedef void (GLUTCALLBACK *GLUTentryCB) (int);
typedef void (GLUTCALLBACK *GLUTvisibilityCB) (int);
typedef void (GLUTCALLBACK *GLUTwindowStatusCB) (int);
typedef void (GLUTCALLBACK *GLUTidleCB) (void);
typedef void (GLUTCALLBACK *GLUTtimerCB) (int);
typedef void (GLUTCALLBACK *GLUTmenuStateCB) (int);  /* DEPRECATED. */
typedef void (GLUTCALLBACK *GLUTmenuStatusCB) (int, int, int);
typedef void (GLUTCALLBACK *GLUTselectCB) (int);
typedef void (GLUTCALLBACK *GLUTspecialCB) (int, int, int);
typedef void (GLUTCALLBACK *GLUTspaceMotionCB) (int, int, int);
typedef void (GLUTCALLBACK *GLUTspaceRotateCB) (int, int, int);
typedef void (GLUTCALLBACK *GLUTspaceButtonCB) (int, int);
typedef void (GLUTCALLBACK *GLUTdialsCB) (int, int);
typedef void (GLUTCALLBACK *GLUTbuttonBoxCB) (int, int);
typedef void (GLUTCALLBACK *GLUTtabletMotionCB) (int, int);
typedef void (GLUTCALLBACK *GLUTtabletButtonCB) (int, int, int, int);
typedef void (GLUTCALLBACK *GLUTjoystickCB) (unsigned int, int, int, int);

typedef void (GLUTCALLBACK *GLUTdestroyCB) (void);
typedef void (GLUTCALLBACK *GLUTmouseWheelCB) (int, int, int, int);
typedef void (GLUTCALLBACK *GLUTmenuDestroyCB) (void);


typedef struct {
   GLuint bpp, alpha;
   GLuint depth, stencil;
   GLuint accum;

   GLint geometry[2];
   GLuint refresh;

   GLint flags;
} GLUTvisual;

typedef struct {
   GLint x, y;
   GLint width, height;
   GLuint mode;
} GLUTdefault;

typedef struct {
   void (*func) (int);
   int value;
   int time;
} GLUTSShotCB;

typedef struct GLUTwindow {
   int num;                         /* window id */

   DMesaContext context;
   DMesaBuffer buffer;

   int show_mouse;
   GLboolean redisplay;

   /* GLUT settable or visible window state. */
   int xpos;
   int ypos;
   int width;                       /* window width in pixels */
   int height;                      /* window height in pixels */

   /* Per-window callbacks. */
   GLUTdisplayCB      display;      /* redraw */
   GLUTreshapeCB      reshape;      /* resize (width,height) */
   GLUTmouseCB        mouse;        /* mouse (button,state,x,y) */
   GLUTmotionCB       motion;       /* motion (x,y) */
   GLUTpassiveCB      passive;      /* passive motion (x,y) */
   GLUTentryCB        entry;        /* window entry/exit (state) */
   GLUTkeyboardCB     keyboard;     /* keyboard (ASCII,x,y) */
   GLUTkeyboardCB     keyboardUp;   /* keyboard up (ASCII,x,y) */
   GLUTwindowStatusCB windowStatus; /* window status */
   GLUTvisibilityCB   visibility;   /* visibility */
   GLUTspecialCB      special;      /* special key */
   GLUTspecialCB      specialUp;    /* special up key */
   GLUTbuttonBoxCB    buttonBox;    /* button box */
   GLUTdialsCB        dials;        /* dials */
   GLUTspaceMotionCB  spaceMotion;  /* Spaceball motion */
   GLUTspaceRotateCB  spaceRotate;  /* Spaceball rotate */
   GLUTspaceButtonCB  spaceButton;  /* Spaceball button */
   GLUTtabletMotionCB tabletMotion; /* tablet motion */
   GLUTtabletButtonCB tabletButton; /* tablet button */
   GLUTjoystickCB     joystick;     /* joystick */

   GLUTdestroyCB      destroy;      /* destroy */
   GLUTmouseWheelCB   mouseWheel;   /* mouse wheel */

   /* specific data */
   void *data;
} GLUTwindow;

typedef struct {
   int width, height;
   int xorig, yorig;
   int xmove;
   const unsigned char *bitmap;
} GLUTBitmapChar;

typedef struct {
   const char *name;
   int height;
   int num;
   const GLUTBitmapChar *const *table;
} GLUTBitmapFont;

typedef struct {
   const GLfloat x, y;
} GLUTStrokeVertex;

typedef struct {
   const unsigned num;
   const GLUTStrokeVertex *vertex;
} GLUTStrokeStrip;

typedef struct {
   const GLfloat right;
   const unsigned num;
   const GLUTStrokeStrip *strip;
} GLUTStrokeChar;

typedef struct {
   const char *name;
   const unsigned num;
   const GLUTStrokeChar *const *table;
   const GLfloat height;
   const GLfloat descent;
} GLUTStrokeFont;


extern char *__glutProgramName;

extern GLUTvisual _glut_visual;
extern GLUTdefault _glut_default;

extern GLuint _glut_fps;
extern GLUTidleCB _glut_idle_func;
extern GLUTmenuStatusCB _glut_menu_status_func;
extern GLUTSShotCB _glut_timer_cb[];

extern GLUTwindow *_glut_current, *_glut_windows[];

extern int _glut_mouse;                  /* number of buttons, if mouse installed */
extern int _glut_mouse_x, _glut_mouse_y; /* mouse coords, relative to current win */


extern void _glut_mouse_init (void);
extern void _glut_fatal(char *format,...);
extern void *_glut_font (void *font);


#include "pc_hw/pc_hw.h"

#endif