2
* Copyright (C) 2006 Claudio Ciccani <klan@users.sf.net>
4
* This library is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU Lesser General Public
6
* License as published by the Free Software Foundation; either
7
* version 2 of the License, or (at your option) any later version.
9
* This library is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
* Lesser General Public License for more details.
14
* You should have received a copy of the GNU Lesser General Public
15
* License along with this library; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
#ifndef __GLUT_INTERNAL_H__
21
#define __GLUT_INTERNAL_H__
27
#include <directfb_version.h>
30
#include "GL/directfbgl.h"
33
#define VERSION_CODE( M, m, r ) (((M) << 16) | ((m) << 8) | ((r)))
35
#define DIRECTFB_VERSION_CODE VERSION_CODE( DIRECTFB_MAJOR_VERSION, \
36
DIRECTFB_MINOR_VERSION, \
37
DIRECTFB_MICRO_VERSION )
40
#define DEFAULT_WIDTH 640
41
#define DEFAULT_HEIGHT 480
44
* Window request flags
46
#define WINDOW_REQUEST_POSITION 0x00000001
47
#define WINDOW_REQUEST_RESIZE 0x00000002
48
#define WINDOW_REQUEST_RESTACK 0x00000004
49
#define WINDOW_REQUEST_SHOW 0x00000008
50
#define WINDOW_REQUEST_HIDE 0x00000010
51
#define WINDOW_REQUEST_DESTROY 0x00000020
54
* GLUT Window implementation
56
typedef struct __GlutWindow_s {
60
IDirectFBWindow *window; /* NULL = fullscreen (game mode) */
61
IDirectFBSurface *surface;
64
/* cursor position in fullscreen mode */
67
/* joystick position */
71
/* pressed modifiers */
75
/* current cursor shape */
92
struct __GlutWindow_s *next;
93
struct __GlutWindow_s *prev;
98
extern IDirectFB *dfb;
99
extern IDirectFBDisplayLayer *primary;
100
extern IDirectFBEventBuffer *events;
101
extern IDirectFBInputDevice *keyboard;
102
extern IDirectFBInputDevice *mouse;
103
extern IDirectFBInputDevice *joystick;
105
extern GLenum g_display_mode;
106
extern GLuint g_width;
107
extern GLuint g_height;
111
extern GLboolean g_idle;
112
extern __GlutWindow *g_current;
113
extern __GlutWindow *g_game;
118
extern __GlutWindow* __glutCreateWindow( GLboolean fullscreen );
119
extern __GlutWindow* __glutFindWindow( DFBWindowID id );
120
extern void __glutSetWindow( __GlutWindow *window );
121
extern void __glutHandleWindows( void );
122
extern void __glutDestroyWindow( __GlutWindow *window );
123
extern void __glutDestroyWindows( void );
125
extern void __glutHandleTimers( void );
126
extern void __glutFreeTimers( void );
129
/* Global Callbacks */
130
extern void (GLUTCALLBACK *display_func) (void);
131
extern void (GLUTCALLBACK *reshape_func) (int width, int height);
132
extern void (GLUTCALLBACK *keyboard_func) (unsigned char key, int x, int y);
133
extern void (GLUTCALLBACK *mouse_func) (int button, int state, int x, int y);
134
extern void (GLUTCALLBACK *motion_func) (int x, int y);
135
extern void (GLUTCALLBACK *passive_motion_func) (int x, int y);
136
extern void (GLUTCALLBACK *entry_func) (int state);
137
extern void (GLUTCALLBACK *visibility_func) (int state);
138
extern void (GLUTCALLBACK *idle_func) (void);
139
extern void (GLUTCALLBACK *menu_state_func) (int state);
140
extern void (GLUTCALLBACK *special_func) (int key, int x, int y);
141
extern void (GLUTCALLBACK *spaceball_motion_func) (int x, int y, int z);
142
extern void (GLUTCALLBACK *spaceball_rotate_func) (int x, int y, int z);
143
extern void (GLUTCALLBACK *spaceball_button_func) (int button, int state);
144
extern void (GLUTCALLBACK *button_box_func) (int button, int state);
145
extern void (GLUTCALLBACK *dials_func) (int dial, int value);
146
extern void (GLUTCALLBACK *tablet_motion_func) (int x, int y);
147
extern void (GLUTCALLBACK *tabled_button_func) (int button, int state, int x, int y);
148
extern void (GLUTCALLBACK *menu_status_func) (int status, int x, int y);
149
extern void (GLUTCALLBACK *overlay_display_func) (void);
150
extern void (GLUTCALLBACK *window_status_func) (int state);
151
extern void (GLUTCALLBACK *keyboard_up_func) (unsigned char key, int x, int y);
152
extern void (GLUTCALLBACK *special_up_func) (int key, int x, int y);
153
extern void (GLUTCALLBACK *joystick_func) (unsigned int buttons, int x, int y, int z);
157
# define __glutAssert( exp ) {\
159
fprintf( stderr, "(!!) *** Assertion [%s] failed in %s() ***\n",\
160
#exp, __FUNCTION__ );
166
# define __glutAssert( exp )
169
#define __glutWarning( format, ... ) {\
170
fprintf( stderr, "(!) GLUT: " format "!\n", ## __VA_ARGS__ );\
174
#define __glutFatalError( format, ... ) {\
175
fprintf( stderr, "(!) GLUT: " format "!\n", ## __VA_ARGS__ );\
176
fprintf( stderr, "\t-> from %s() at line %d\n", __FUNCTION__, __LINE__ );\
182
#endif /* __GLUT_INTERNAL_H__ */