2 * Mesa 3-D graphics library
4 * Copyright (C) 1995-2006 Brian Paul
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the Free
18 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 * Library for glut using mesa fbdev driver
24 * Written by Sean D'Epagnier (c) 2006
33 void (*DisplayFunc
)(void) = NULL
;
34 void (*ReshapeFunc
)(int width
, int height
) = NULL
;
35 void (*KeyboardFunc
)(unsigned char key
, int x
, int y
) = NULL
;
36 void (*KeyboardUpFunc
)(unsigned char key
, int x
, int y
) = NULL
;
37 void (*MouseFunc
)(int key
, int state
, int x
, int y
) = NULL
;
38 void (*MotionFunc
)(int x
, int y
) = NULL
;
39 void (*PassiveMotionFunc
)(int x
, int y
) = NULL
;
40 void (*VisibilityFunc
)(int state
) = NULL
;
41 void (*SpecialFunc
)(int key
, int x
, int y
) = NULL
;
42 void (*SpecialUpFunc
)(int key
, int x
, int y
) = NULL
;
43 void (*IdleFunc
)(void) = NULL
;
44 void (*MenuStatusFunc
)(int state
, int x
, int y
) = NULL
;
45 void (*MenuStateFunc
)(int state
) = NULL
;
47 void glutDisplayFunc(void (*func
)(void))
52 void glutOverlayDisplayFunc(void (*func
)(void))
56 void glutWindowStatusFunc(void (*func
)(int state
))
60 void glutReshapeFunc(void (*func
)(int width
, int height
))
65 void glutKeyboardFunc(void (*func
)(unsigned char key
, int x
, int y
))
70 void glutKeyboardUpFunc(void (*func
)(unsigned char key
, int x
, int y
))
72 KeyboardUpFunc
= func
;
75 void glutMouseFunc(void (*func
)(int button
, int state
, int x
, int y
))
80 void glutMotionFunc(void (*func
)(int x
, int y
))
85 void glutPassiveMotionFunc(void (*func
)(int x
, int y
))
87 PassiveMotionFunc
= func
;
90 void glutJoystickFunc(void (*func
)(unsigned int buttonMask
,
91 int x
, int y
, int z
), int pollInterval
)
95 void glutVisibilityFunc(void (*func
)(int state
))
97 VisibilityFunc
= func
;
100 void glutEntryFunc(void (*func
)(int state
))
104 void glutSpecialFunc(void (*func
)(int key
, int x
, int y
))
109 void glutSpecialUpFunc(void (*func
)(int key
, int x
, int y
))
111 SpecialUpFunc
= func
;
114 void glutSpaceballMotionFunc(void (*func
)(int x
, int y
, int z
))
118 void glutSpaceballRotateFunc(void (*func
)(int x
, int y
, int z
))
122 void glutSpaceballButtonFunc(void (*func
)(int button
, int state
))
126 void glutButtonBoxFunc(void (*func
)(int button
, int state
))
130 void glutDialsFunc(void (*func
)(int dial
, int value
))
134 void glutTabletMotionFunc(void (*func
)(int x
, int y
))
138 void glutTabletButtonFunc(void (*func
)(int button
, int state
,
143 void glutMenuStatusFunc(void (*func
)(int status
, int x
, int y
))
145 MenuStatusFunc
= func
;
148 void glutMenuStateFunc(void (*func
)(int status
))
150 MenuStateFunc
= func
;
153 void glutIdleFunc(void (*func
)(void))
158 void glutTimerFunc(unsigned int msecs
,
159 void (*func
)(int value
), int value
)
161 struct GlutTimer
**head
= &GlutTimers
, *timer
= malloc(sizeof *timer
);
162 timer
->time
= glutGet(GLUT_ELAPSED_TIME
) + msecs
;
164 timer
->value
= value
;
166 while(*head
&& (*head
)->time
< timer
->time
)
167 head
= &(*head
)->next
;