ruby-glfw 0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (206) hide show
  1. data/README +1 -0
  2. data/README.API +73 -0
  3. data/Rakefile +120 -0
  4. data/examples/boing.rb +519 -0
  5. data/examples/gears.rb +327 -0
  6. data/examples/keytest.rb +117 -0
  7. data/examples/listmodes.rb +20 -0
  8. data/examples/mipmaps.rb +104 -0
  9. data/examples/mipmaps.tga +0 -0
  10. data/examples/particles.rb +837 -0
  11. data/examples/pong3d.rb +741 -0
  12. data/examples/pong3d_field.tga +0 -0
  13. data/examples/pong3d_instr.tga +0 -0
  14. data/examples/pong3d_menu.tga +0 -0
  15. data/examples/pong3d_title.tga +0 -0
  16. data/examples/pong3d_winner1.tga +0 -0
  17. data/examples/pong3d_winner2.tga +0 -0
  18. data/examples/splitview.rb +432 -0
  19. data/examples/triangle.rb +89 -0
  20. data/examples/wave.rb +294 -0
  21. data/ext/glfw/glfw.c +1094 -0
  22. data/ext/glfw/mkrf_conf.rb +70 -0
  23. data/glfw-src/Makefile +220 -0
  24. data/glfw-src/compile.ami +61 -0
  25. data/glfw-src/compile.bat +217 -0
  26. data/glfw-src/compile.sh +607 -0
  27. data/glfw-src/docs/Makefile +57 -0
  28. data/glfw-src/docs/Reference.pdf +0 -0
  29. data/glfw-src/docs/UsersGuide.pdf +0 -0
  30. data/glfw-src/docs/cleanup.bat +22 -0
  31. data/glfw-src/docs/glfwdoc.sty +80 -0
  32. data/glfw-src/docs/glfwrm.tex +3034 -0
  33. data/glfw-src/docs/glfwug.tex +2024 -0
  34. data/glfw-src/docs/readme.txt +80 -0
  35. data/glfw-src/examples/Makefile.amigaos.gcc +70 -0
  36. data/glfw-src/examples/Makefile.amigaos.vbcc +70 -0
  37. data/glfw-src/examples/Makefile.dos.djgpp +71 -0
  38. data/glfw-src/examples/Makefile.macosx.gcc +96 -0
  39. data/glfw-src/examples/Makefile.win32.bcc +75 -0
  40. data/glfw-src/examples/Makefile.win32.cross-mgw +79 -0
  41. data/glfw-src/examples/Makefile.win32.cygwin +79 -0
  42. data/glfw-src/examples/Makefile.win32.lcc +74 -0
  43. data/glfw-src/examples/Makefile.win32.mgw +75 -0
  44. data/glfw-src/examples/Makefile.win32.msvc +74 -0
  45. data/glfw-src/examples/Makefile.win32.ow +74 -0
  46. data/glfw-src/examples/Makefile.win32.pellesc +74 -0
  47. data/glfw-src/examples/Makefile.x11.in +54 -0
  48. data/glfw-src/examples/boing.c +606 -0
  49. data/glfw-src/examples/bundle.sh +46 -0
  50. data/glfw-src/examples/gears.c +382 -0
  51. data/glfw-src/examples/keytest.c +264 -0
  52. data/glfw-src/examples/listmodes.c +48 -0
  53. data/glfw-src/examples/mipmaps.c +126 -0
  54. data/glfw-src/examples/mipmaps.tga +0 -0
  55. data/glfw-src/examples/mtbench.c +301 -0
  56. data/glfw-src/examples/mthello.c +48 -0
  57. data/glfw-src/examples/particles.c +1148 -0
  58. data/glfw-src/examples/pong3d.c +839 -0
  59. data/glfw-src/examples/pong3d_field.tga +0 -0
  60. data/glfw-src/examples/pong3d_instr.tga +0 -0
  61. data/glfw-src/examples/pong3d_menu.tga +0 -0
  62. data/glfw-src/examples/pong3d_title.tga +0 -0
  63. data/glfw-src/examples/pong3d_winner1.tga +0 -0
  64. data/glfw-src/examples/pong3d_winner2.tga +0 -0
  65. data/glfw-src/examples/splitview.c +506 -0
  66. data/glfw-src/examples/triangle.c +108 -0
  67. data/glfw-src/examples/wave.c +397 -0
  68. data/glfw-src/images/opengl.gif +0 -0
  69. data/glfw-src/images/osicert.gif +0 -0
  70. data/glfw-src/include/GL/glfw.h +486 -0
  71. data/glfw-src/lib/amigaos/Makefile.amigaos.gcc +128 -0
  72. data/glfw-src/lib/amigaos/Makefile.amigaos.vbcc +128 -0
  73. data/glfw-src/lib/amigaos/SDI_compiler.h +94 -0
  74. data/glfw-src/lib/amigaos/amigaos_enable.c +51 -0
  75. data/glfw-src/lib/amigaos/amigaos_fullscreen.c +319 -0
  76. data/glfw-src/lib/amigaos/amigaos_glext.c +61 -0
  77. data/glfw-src/lib/amigaos/amigaos_init.c +284 -0
  78. data/glfw-src/lib/amigaos/amigaos_joystick.c +359 -0
  79. data/glfw-src/lib/amigaos/amigaos_thread.c +494 -0
  80. data/glfw-src/lib/amigaos/amigaos_time.c +206 -0
  81. data/glfw-src/lib/amigaos/amigaos_window.c +830 -0
  82. data/glfw-src/lib/amigaos/platform.h +337 -0
  83. data/glfw-src/lib/dos/Makefile.dos.djgpp +146 -0
  84. data/glfw-src/lib/dos/dos_enable.c +51 -0
  85. data/glfw-src/lib/dos/dos_events.c +173 -0
  86. data/glfw-src/lib/dos/dos_fullscreen.c +101 -0
  87. data/glfw-src/lib/dos/dos_glext.c +59 -0
  88. data/glfw-src/lib/dos/dos_init.c +105 -0
  89. data/glfw-src/lib/dos/dos_irq.s +246 -0
  90. data/glfw-src/lib/dos/dos_joystick.c +94 -0
  91. data/glfw-src/lib/dos/dos_keyboard.c +694 -0
  92. data/glfw-src/lib/dos/dos_mouse.c +337 -0
  93. data/glfw-src/lib/dos/dos_thread.c +267 -0
  94. data/glfw-src/lib/dos/dos_time.c +309 -0
  95. data/glfw-src/lib/dos/dos_window.c +563 -0
  96. data/glfw-src/lib/dos/platform.h +341 -0
  97. data/glfw-src/lib/enable.c +295 -0
  98. data/glfw-src/lib/fullscreen.c +95 -0
  99. data/glfw-src/lib/glext.c +201 -0
  100. data/glfw-src/lib/image.c +629 -0
  101. data/glfw-src/lib/init.c +108 -0
  102. data/glfw-src/lib/input.c +280 -0
  103. data/glfw-src/lib/internal.h +210 -0
  104. data/glfw-src/lib/joystick.c +101 -0
  105. data/glfw-src/lib/macosx/Makefile.macosx.gcc +172 -0
  106. data/glfw-src/lib/macosx/Makefile.macosx.gcc.universal +166 -0
  107. data/glfw-src/lib/macosx/libglfw.pc.in +11 -0
  108. data/glfw-src/lib/macosx/macosx_enable.c +42 -0
  109. data/glfw-src/lib/macosx/macosx_fullscreen.c +126 -0
  110. data/glfw-src/lib/macosx/macosx_glext.c +52 -0
  111. data/glfw-src/lib/macosx/macosx_init.c +194 -0
  112. data/glfw-src/lib/macosx/macosx_joystick.c +50 -0
  113. data/glfw-src/lib/macosx/macosx_thread.c +414 -0
  114. data/glfw-src/lib/macosx/macosx_time.c +112 -0
  115. data/glfw-src/lib/macosx/macosx_window.c +1279 -0
  116. data/glfw-src/lib/macosx/platform.h +349 -0
  117. data/glfw-src/lib/stream.c +194 -0
  118. data/glfw-src/lib/tga.c +405 -0
  119. data/glfw-src/lib/thread.c +340 -0
  120. data/glfw-src/lib/time.c +83 -0
  121. data/glfw-src/lib/win32/Makefile.win32.bcc +265 -0
  122. data/glfw-src/lib/win32/Makefile.win32.cross-mgw +274 -0
  123. data/glfw-src/lib/win32/Makefile.win32.cygwin +279 -0
  124. data/glfw-src/lib/win32/Makefile.win32.lcc +246 -0
  125. data/glfw-src/lib/win32/Makefile.win32.mgw +243 -0
  126. data/glfw-src/lib/win32/Makefile.win32.msvc +242 -0
  127. data/glfw-src/lib/win32/Makefile.win32.ow +242 -0
  128. data/glfw-src/lib/win32/Makefile.win32.pellesc +242 -0
  129. data/glfw-src/lib/win32/glfwdll.def +67 -0
  130. data/glfw-src/lib/win32/glfwdll_mgw1.def +67 -0
  131. data/glfw-src/lib/win32/glfwdll_mgw2.def +67 -0
  132. data/glfw-src/lib/win32/glfwdll_pellesc.def +65 -0
  133. data/glfw-src/lib/win32/libglfw.pc.in +11 -0
  134. data/glfw-src/lib/win32/platform.h +474 -0
  135. data/glfw-src/lib/win32/win32_dllmain.c +60 -0
  136. data/glfw-src/lib/win32/win32_enable.c +155 -0
  137. data/glfw-src/lib/win32/win32_fullscreen.c +317 -0
  138. data/glfw-src/lib/win32/win32_glext.c +85 -0
  139. data/glfw-src/lib/win32/win32_init.c +356 -0
  140. data/glfw-src/lib/win32/win32_joystick.c +234 -0
  141. data/glfw-src/lib/win32/win32_thread.c +511 -0
  142. data/glfw-src/lib/win32/win32_time.c +146 -0
  143. data/glfw-src/lib/win32/win32_window.c +1714 -0
  144. data/glfw-src/lib/window.c +727 -0
  145. data/glfw-src/lib/x11/Makefile.x11.in +243 -0
  146. data/glfw-src/lib/x11/platform.h +415 -0
  147. data/glfw-src/lib/x11/x11_enable.c +51 -0
  148. data/glfw-src/lib/x11/x11_fullscreen.c +524 -0
  149. data/glfw-src/lib/x11/x11_glext.c +69 -0
  150. data/glfw-src/lib/x11/x11_init.c +275 -0
  151. data/glfw-src/lib/x11/x11_joystick.c +371 -0
  152. data/glfw-src/lib/x11/x11_keysym2unicode.c +902 -0
  153. data/glfw-src/lib/x11/x11_thread.c +507 -0
  154. data/glfw-src/lib/x11/x11_time.c +154 -0
  155. data/glfw-src/lib/x11/x11_window.c +1746 -0
  156. data/glfw-src/license.txt +21 -0
  157. data/glfw-src/readme.html +927 -0
  158. data/glfw-src/support/d/examples/Makefile +59 -0
  159. data/glfw-src/support/d/examples/boing.d +610 -0
  160. data/glfw-src/support/d/examples/gears.d +379 -0
  161. data/glfw-src/support/d/examples/keytest.d +272 -0
  162. data/glfw-src/support/d/examples/listmodes.d +48 -0
  163. data/glfw-src/support/d/examples/mipmaps.d +126 -0
  164. data/glfw-src/support/d/examples/mtbench.d +304 -0
  165. data/glfw-src/support/d/examples/mthello.d +54 -0
  166. data/glfw-src/support/d/examples/particles.d +1150 -0
  167. data/glfw-src/support/d/examples/pong3d.d +840 -0
  168. data/glfw-src/support/d/examples/splitview.d +486 -0
  169. data/glfw-src/support/d/examples/triangle.d +108 -0
  170. data/glfw-src/support/d/examples/wave.d +400 -0
  171. data/glfw-src/support/d/imports/gl.d +4539 -0
  172. data/glfw-src/support/d/imports/glfw.d +349 -0
  173. data/glfw-src/support/d/imports/glu.d +328 -0
  174. data/glfw-src/support/d/lib/glfwdll.def +64 -0
  175. data/glfw-src/support/d/lib/glu32.def +56 -0
  176. data/glfw-src/support/d/lib/makefile +12 -0
  177. data/glfw-src/support/d/lib/opengl32.def +372 -0
  178. data/glfw-src/support/d/readme.html +83 -0
  179. data/glfw-src/support/delphi/examples/Triangle.dpr +105 -0
  180. data/glfw-src/support/delphi/lib/glfw.pas +437 -0
  181. data/glfw-src/support/delphi/readme.html +97 -0
  182. data/glfw-src/support/lua/examples/gears.lua +383 -0
  183. data/glfw-src/support/lua/examples/test1.lua +68 -0
  184. data/glfw-src/support/lua/readme.html +128 -0
  185. data/glfw-src/support/lua/src/luaglfw.c +1179 -0
  186. data/glfw-src/support/lua/src/luaglfw.h +48 -0
  187. data/glfw-src/support/lua/src/runlua.c +82 -0
  188. data/glfw-src/support/masm/examples/fpc.mac +47 -0
  189. data/glfw-src/support/masm/examples/makeit.bat +66 -0
  190. data/glfw-src/support/masm/examples/triangle.asm +232 -0
  191. data/glfw-src/support/masm/include/glfw.inc +326 -0
  192. data/glfw-src/support/masm/include/glu32.inc +55 -0
  193. data/glfw-src/support/masm/include/opengl32.inc +372 -0
  194. data/glfw-src/support/masm/lib/glfwdll.lib +0 -0
  195. data/glfw-src/support/masm/readme.html +170 -0
  196. data/glfw-src/support/msvc80/GLFW.sln +26 -0
  197. data/glfw-src/support/msvc80/GLFW.vcproj +257 -0
  198. data/glfw-src/support/msvc80/GLFWDLL.vcproj +287 -0
  199. data/glfw-src/support/visualbasic/bindings/glfw.bas +320 -0
  200. data/glfw-src/support/visualbasic/bindings/glu32.bas +284 -0
  201. data/glfw-src/support/visualbasic/bindings/opengl32.bas +999 -0
  202. data/glfw-src/support/visualbasic/examples/Triangle.bas +101 -0
  203. data/glfw-src/support/visualbasic/readme.html +164 -0
  204. data/website/index.html +84 -0
  205. data/website/style.css +110 -0
  206. metadata +301 -0
@@ -0,0 +1,337 @@
1
+ //========================================================================
2
+ // GLFW - An OpenGL framework
3
+ // File: dos_mouse.c
4
+ // Platform: DOS
5
+ // API version: 2.6
6
+ // WWW: http://glfw.sourceforge.net
7
+ //------------------------------------------------------------------------
8
+ // Copyright (c) 2002-2006 Camilla Berglund
9
+ //
10
+ // This software is provided 'as-is', without any express or implied
11
+ // warranty. In no event will the authors be held liable for any damages
12
+ // arising from the use of this software.
13
+ //
14
+ // Permission is granted to anyone to use this software for any purpose,
15
+ // including commercial applications, and to alter it and redistribute it
16
+ // freely, subject to the following restrictions:
17
+ //
18
+ // 1. The origin of this software must not be misrepresented; you must not
19
+ // claim that you wrote the original software. If you use this software
20
+ // in a product, an acknowledgment in the product documentation would
21
+ // be appreciated but is not required.
22
+ //
23
+ // 2. Altered source versions must be plainly marked as such, and must not
24
+ // be misrepresented as being the original software.
25
+ //
26
+ // 3. This notice may not be removed or altered from any source
27
+ // distribution.
28
+ //
29
+ //========================================================================
30
+
31
+ #include "internal.h"
32
+
33
+ //========================================================================
34
+ // Most of the code in this source file is based on the mouse driver in
35
+ // Daniel Borca's GLUT implementation for DOS/MESA.
36
+ //========================================================================
37
+
38
+ //========================================================================
39
+ // Definitions
40
+ //========================================================================
41
+
42
+ #define _GLFW_MOUSE_STACK_SIZE 16384
43
+
44
+
45
+ // Assembler function prototypes
46
+ extern void _glfwMouseWrap( void );
47
+ extern int _glfwMouseWrap_end[];
48
+
49
+
50
+ //========================================================================
51
+ // Global variables
52
+ //========================================================================
53
+
54
+ static int _glfwMouseInstalled = 0;
55
+
56
+ static struct {
57
+ long Callback;
58
+ int Emulate3;
59
+ int OldX, OldY, OldB;
60
+ __dpmi_regs Regs;
61
+ } _glfwMouseDrv;
62
+
63
+
64
+
65
+ //************************************************************************
66
+ //**** Mouse Interrupt ***************************************************
67
+ //************************************************************************
68
+
69
+ //========================================================================
70
+ // _glfwMouseInt() - Mouse interrupt handler
71
+ //========================================================================
72
+
73
+ static void _glfwMouseInt( __dpmi_regs *r )
74
+ {
75
+ int newx, newy, dx, dy, dz, buttons;
76
+ _GLFWdosevent event;
77
+ struct mousemove_event *mousemove = &event.MouseMove;
78
+ struct mousewheel_event *mousewheel = &event.MouseWheel;
79
+ struct mousebutton_event *mousebutton = &event.MouseButton;
80
+
81
+ // Calculate mouse deltas
82
+ newx = (signed short)r->x.si;
83
+ newy = (signed short)r->x.di;
84
+ dx = newx - _glfwMouseDrv.OldX;
85
+ dy = newy - _glfwMouseDrv.OldY;
86
+ dz = (signed char)r->h.bh;
87
+
88
+ // Get mouse buttons status
89
+ buttons = r->h.bl;
90
+
91
+ // Emulate 3rd mouse button?
92
+ if( _glfwMouseDrv.Emulate3 )
93
+ {
94
+ if( (buttons & 3) == 3 )
95
+ {
96
+ buttons = 4;
97
+ }
98
+ }
99
+
100
+ // Mouse moved?
101
+ if( dx || dy )
102
+ {
103
+ mousemove->Type = _GLFW_DOS_MOUSE_MOVE_EVENT;
104
+ mousemove->DeltaX = dx;
105
+ mousemove->DeltaY = dy;
106
+ _glfwPostDOSEvent( &event );
107
+ }
108
+
109
+ // Mouse wheel moved?
110
+ if( dz )
111
+ {
112
+ mousewheel->Type = _GLFW_DOS_MOUSE_WHEEL_EVENT;
113
+ mousewheel->WheelDelta = dz;
114
+ _glfwPostDOSEvent( &event );
115
+ }
116
+
117
+ // Button state changed?
118
+ if( buttons != _glfwMouseDrv.OldB )
119
+ {
120
+ mousebutton->Type = _GLFW_DOS_MOUSE_BUTTON_EVENT;
121
+
122
+ // Left mouse button changed?
123
+ if( (_glfwMouseDrv.OldB & 1) && !(buttons & 1) )
124
+ {
125
+ mousebutton->Button = GLFW_MOUSE_BUTTON_LEFT;
126
+ mousebutton->Action = GLFW_RELEASE;
127
+ _glfwPostDOSEvent( &event );
128
+ }
129
+ else if( !(_glfwMouseDrv.OldB & 1) && (buttons & 1) )
130
+ {
131
+ mousebutton->Button = GLFW_MOUSE_BUTTON_LEFT;
132
+ mousebutton->Action = GLFW_PRESS;
133
+ _glfwPostDOSEvent( &event );
134
+ }
135
+
136
+ // Right mouse button changed?
137
+ if( (_glfwMouseDrv.OldB & 2) && !(buttons & 2) )
138
+ {
139
+ mousebutton->Button = GLFW_MOUSE_BUTTON_RIGHT;
140
+ mousebutton->Action = GLFW_RELEASE;
141
+ _glfwPostDOSEvent( &event );
142
+ }
143
+ else if( !(_glfwMouseDrv.OldB & 2) && (buttons & 2) )
144
+ {
145
+ mousebutton->Button = GLFW_MOUSE_BUTTON_RIGHT;
146
+ mousebutton->Action = GLFW_PRESS;
147
+ _glfwPostDOSEvent( &event );
148
+ }
149
+
150
+ // Middle mouse button changed?
151
+ if( (_glfwMouseDrv.OldB & 4) && !(buttons & 4) )
152
+ {
153
+ mousebutton->Button = GLFW_MOUSE_BUTTON_MIDDLE;
154
+ mousebutton->Action = GLFW_RELEASE;
155
+ _glfwPostDOSEvent( &event );
156
+ }
157
+ else if( !(_glfwMouseDrv.OldB & 4) && (buttons & 4) )
158
+ {
159
+ mousebutton->Button = GLFW_MOUSE_BUTTON_MIDDLE;
160
+ mousebutton->Action = GLFW_PRESS;
161
+ _glfwPostDOSEvent( &event );
162
+ }
163
+
164
+ }
165
+
166
+ // Remember old mouse state
167
+ _glfwMouseDrv.OldX = newx;
168
+ _glfwMouseDrv.OldY = newy;
169
+ _glfwMouseDrv.OldB = buttons;
170
+ } ENDOFUNC(_glfwMouseInt)
171
+
172
+
173
+
174
+ //************************************************************************
175
+ //**** GLFW internal functions ****
176
+ //************************************************************************
177
+
178
+ //========================================================================
179
+ // _glfwInitMouse() - Initialize mouse driver
180
+ //========================================================================
181
+
182
+ int _glfwInitMouse( void )
183
+ {
184
+ int buttons;
185
+
186
+ // Already installed?
187
+ if( _glfwMouseInstalled )
188
+ {
189
+ return 0;
190
+ }
191
+
192
+ // Reset mouse and get status
193
+ __asm("\n\
194
+ xorl %%eax, %%eax \n\
195
+ int $0x33 \n\
196
+ andl %%ebx, %%eax \n\
197
+ movl %%eax, %0 \n\
198
+ ":"=g" (buttons)::"%eax", "%ebx");
199
+ if( !buttons )
200
+ {
201
+ return 0;
202
+ }
203
+
204
+ // Lock data and functions
205
+ LOCKDATA( _glfwMouseDrv );
206
+ LOCKBUFF( _glfwMouseWrap_end, 8 );
207
+ LOCKFUNC( _glfwMouseInt );
208
+ LOCKFUNC( _glfwMouseWrap );
209
+
210
+ _glfwMouseWrap_end[1] = __djgpp_ds_alias;
211
+
212
+ // Grab a locked stack
213
+ _glfwMouseWrap_end[0] = (int)malloc( _GLFW_MOUSE_STACK_SIZE );
214
+ if( _glfwMouseWrap_end[0] == NULL )
215
+ {
216
+ return 0;
217
+ }
218
+ LOCKBUFF( _glfwMouseWrap_end[0], _GLFW_MOUSE_STACK_SIZE );
219
+
220
+ // Try to hook a call-back
221
+ __asm("\n\
222
+ pushl %%ds \n\
223
+ pushl %%es \n\
224
+ movw $0x0303, %%ax \n\
225
+ pushl %%ds \n\
226
+ pushl %%cs \n\
227
+ popl %%ds \n\
228
+ popl %%es \n\
229
+ int $0x31 \n\
230
+ popl %%es \n\
231
+ popl %%ds \n\
232
+ jc 0f \n\
233
+ shll $16, %%ecx \n\
234
+ movw %%dx, %%cx \n\
235
+ movl %%ecx, %0 \n\
236
+ 0: \n\
237
+ ":"=g"(_glfwMouseDrv.Callback)
238
+ :"S" (_glfwMouseWrap), "D"(&_glfwMouseDrv.Regs)
239
+ :"%eax", "%ecx", "%edx");
240
+ if( !_glfwMouseDrv.Callback )
241
+ {
242
+ free( (void *)_glfwMouseWrap_end[0] );
243
+ return 0;
244
+ }
245
+
246
+ // Adjust stack
247
+ _glfwMouseWrap_end[0] += _GLFW_MOUSE_STACK_SIZE;
248
+
249
+ // Install the handler
250
+ _glfwMouseDrv.Regs.x.ax = 0x000c;
251
+ _glfwMouseDrv.Regs.x.cx = 0x7f | 0x80;
252
+ _glfwMouseDrv.Regs.x.dx = _glfwMouseDrv.Callback & 0xffff;
253
+ _glfwMouseDrv.Regs.x.es = _glfwMouseDrv.Callback >> 16;
254
+ __dpmi_int( 0x33, &_glfwMouseDrv.Regs );
255
+
256
+ // Clear mickeys
257
+ __asm __volatile ("\n\
258
+ movw $0xb, %%ax; \n\
259
+ int $0x33 \n\
260
+ ":::"%eax", "%ecx", "%edx");
261
+
262
+ _glfwMouseDrv.OldX = 0;
263
+ _glfwMouseDrv.OldY = 0;
264
+ _glfwMouseDrv.OldB = 0;
265
+
266
+ // Emulate third mouse button?
267
+ _glfwMouseDrv.Emulate3 = buttons < 3;
268
+
269
+ return 1;
270
+ }
271
+
272
+
273
+ //========================================================================
274
+ // _glfwTerminateMouse() - Terminate mouse driver
275
+ //========================================================================
276
+
277
+ void _glfwTerminateMouse( void )
278
+ {
279
+ if( !_glfwMouseInstalled )
280
+ {
281
+ return;
282
+ }
283
+
284
+ __asm("\n\
285
+ movl %%edx, %%ecx \n\
286
+ shrl $16, %%ecx \n\
287
+ movw $0x0304, %%ax \n\
288
+ int $0x31 \n\
289
+ movw $0x000c, %%ax \n\
290
+ xorl %%ecx, %%ecx \n\
291
+ int $0x33 \n\
292
+ "::"d"(_glfwMouseDrv.Callback):"%eax", "%ecx");
293
+ _glfwMouseDrv.Callback = 0;
294
+
295
+ free( (void *)(_glfwMouseWrap_end[0] - _GLFW_MOUSE_STACK_SIZE) );
296
+
297
+ _glfwMouseInstalled = 0;
298
+ }
299
+
300
+
301
+
302
+ //========================================================================
303
+ // _glfwMouseWrap()
304
+ //========================================================================
305
+
306
+ // Hack alert: `_glfwMouseWrap_end' actually holds the address of stack in
307
+ // a safe data selector.
308
+
309
+ __asm("\n\
310
+ .text \n\
311
+ .p2align 5,,31 \n\
312
+ .global __glfwMouseWrap \n\
313
+ __glfwMouseWrap: \n\
314
+ cld \n\
315
+ lodsl \n\
316
+ movl %eax, %es:42(%edi) \n\
317
+ addw $4, %es:46(%edi) \n\
318
+ pushl %es \n\
319
+ movl %ss, %ebx \n\
320
+ movl %esp, %esi \n\
321
+ lss %cs:__glfwMouseWrap_end, %esp\n\
322
+ pushl %ss \n\
323
+ pushl %ss \n\
324
+ popl %es \n\
325
+ popl %ds \n\
326
+ movl ___djgpp_dos_sel, %fs \n\
327
+ pushl %fs \n\
328
+ popl %gs \n\
329
+ pushl %edi \n\
330
+ call __glfwMouseInt \n\
331
+ popl %edi \n\
332
+ movl %ebx, %ss \n\
333
+ movl %esi, %esp \n\
334
+ popl %es \n\
335
+ iret \n\
336
+ .global __glfwMouseWrap_end \n\
337
+ __glfwMouseWrap_end:.long 0, 0");
@@ -0,0 +1,267 @@
1
+ //========================================================================
2
+ // GLFW - An OpenGL framework
3
+ // File: dos_thread.c
4
+ // Platform: DOS
5
+ // API version: 2.6
6
+ // WWW: http://glfw.sourceforge.net
7
+ //------------------------------------------------------------------------
8
+ // Copyright (c) 2002-2006 Camilla Berglund
9
+ //
10
+ // This software is provided 'as-is', without any express or implied
11
+ // warranty. In no event will the authors be held liable for any damages
12
+ // arising from the use of this software.
13
+ //
14
+ // Permission is granted to anyone to use this software for any purpose,
15
+ // including commercial applications, and to alter it and redistribute it
16
+ // freely, subject to the following restrictions:
17
+ //
18
+ // 1. The origin of this software must not be misrepresented; you must not
19
+ // claim that you wrote the original software. If you use this software
20
+ // in a product, an acknowledgment in the product documentation would
21
+ // be appreciated but is not required.
22
+ //
23
+ // 2. Altered source versions must be plainly marked as such, and must not
24
+ // be misrepresented as being the original software.
25
+ //
26
+ // 3. This notice may not be removed or altered from any source
27
+ // distribution.
28
+ //
29
+ //========================================================================
30
+
31
+ #include "internal.h"
32
+
33
+
34
+
35
+ //************************************************************************
36
+ //**** GLFW internal functions ****
37
+ //************************************************************************
38
+
39
+ //========================================================================
40
+ // _glfwInitThreads() - Initialize GLFW thread package
41
+ //========================================================================
42
+
43
+ int _glfwInitThreads( void )
44
+ {
45
+ // TODO
46
+ _glfwThrd.First.Previous = NULL;
47
+ _glfwThrd.First.Next = NULL;
48
+ _glfwThrd.First.ID = 0;
49
+ _glfwThrd.NextID = 1;
50
+
51
+ return 1;
52
+ }
53
+
54
+
55
+ //========================================================================
56
+ // _glfwTerminateThreads() - Terminate GLFW thread package
57
+ //========================================================================
58
+
59
+ void _glfwTerminateThreads( void )
60
+ {
61
+ _GLFWthread *t, *t_next;
62
+
63
+ // Enter critical section
64
+ ENTER_THREAD_CRITICAL_SECTION
65
+
66
+ // Kill all threads (NOTE: THE USER SHOULD WAIT FOR ALL THREADS TO
67
+ // DIE, _BEFORE_ CALLING glfwTerminate()!!!)
68
+ t = _glfwThrd.First.Next;
69
+ while( t != NULL )
70
+ {
71
+ // Get pointer to next thread
72
+ t_next = t->Next;
73
+
74
+ // Simply murder the process, no mercy!
75
+ // TODO
76
+
77
+ // Free memory allocated for this thread
78
+ free( (void *) t );
79
+
80
+ // Select next thread in list
81
+ t = t_next;
82
+ }
83
+
84
+ // Leave critical section
85
+ LEAVE_THREAD_CRITICAL_SECTION
86
+ }
87
+
88
+
89
+
90
+ //************************************************************************
91
+ //**** Platform implementation functions ****
92
+ //************************************************************************
93
+
94
+ //========================================================================
95
+ // _glfwPlatformCreateThread() - Create a new thread
96
+ //========================================================================
97
+
98
+ GLFWthread _glfwPlatformCreateThread( GLFWthreadfun fun, void *arg )
99
+ {
100
+ // TODO
101
+ return -1;
102
+ }
103
+
104
+
105
+ //========================================================================
106
+ // _glfwPlatformDestroyThread() - Kill a thread. NOTE: THIS IS A VERY
107
+ // DANGEROUS OPERATION, AND SHOULD NOT BE USED EXCEPT IN EXTREME
108
+ // SITUATIONS!
109
+ //========================================================================
110
+
111
+ void _glfwPlatformDestroyThread( GLFWthread ID )
112
+ {
113
+ _GLFWthread *t, *t_wait;
114
+
115
+ // Enter critical section
116
+ ENTER_THREAD_CRITICAL_SECTION
117
+
118
+ // Get thread information pointer
119
+ t = _glfwGetThreadPointer( ID );
120
+ if( t == NULL )
121
+ {
122
+ LEAVE_THREAD_CRITICAL_SECTION
123
+ return;
124
+ }
125
+
126
+ // Simply murder the process, no mercy!
127
+ // TODO
128
+
129
+ // Remove thread from thread list
130
+ _glfwRemoveThread( t );
131
+
132
+ // Signal any waiting threads that the thread has died
133
+ // TODO
134
+
135
+ // Leave critical section
136
+ LEAVE_THREAD_CRITICAL_SECTION
137
+ }
138
+
139
+
140
+ //========================================================================
141
+ // _glfwPlatformWaitThread() - Wait for a thread to die
142
+ //========================================================================
143
+
144
+ int _glfwPlatformWaitThread( GLFWthread ID, int waitmode )
145
+ {
146
+ // TODO
147
+ return GL_FALSE;
148
+ }
149
+
150
+
151
+ //========================================================================
152
+ // _glfwPlatformGetThreadID() - Return the thread ID for the current
153
+ // thread
154
+ //========================================================================
155
+
156
+ GLFWthread _glfwPlatformGetThreadID( void )
157
+ {
158
+ // TODO
159
+ return 0;
160
+ }
161
+
162
+
163
+ //========================================================================
164
+ // _glfwPlatformCreateMutex() - Create a mutual exclusion object
165
+ //========================================================================
166
+
167
+ GLFWmutex _glfwPlatformCreateMutex( void )
168
+ {
169
+ // TODO
170
+ return NULL;
171
+ }
172
+
173
+
174
+ //========================================================================
175
+ // _glfwPlatformDestroyMutex() - Destroy a mutual exclusion object
176
+ //========================================================================
177
+
178
+ void _glfwPlatformDestroyMutex( GLFWmutex mutex )
179
+ {
180
+ // TODO
181
+ }
182
+
183
+
184
+ //========================================================================
185
+ // _glfwPlatformLockMutex() - Request access to a mutex
186
+ //========================================================================
187
+
188
+ void _glfwPlatformLockMutex( GLFWmutex mutex )
189
+ {
190
+ // TODO
191
+ }
192
+
193
+
194
+ //========================================================================
195
+ // _glfwPlatformUnlockMutex() - Release a mutex
196
+ //========================================================================
197
+
198
+ void _glfwPlatformUnlockMutex( GLFWmutex mutex )
199
+ {
200
+ // TODO
201
+ }
202
+
203
+
204
+ //========================================================================
205
+ // _glfwPlatformCreateCond() - Create a new condition variable object
206
+ //========================================================================
207
+
208
+ GLFWcond _glfwPlatformCreateCond( void )
209
+ {
210
+ // TODO
211
+ return NULL;
212
+ }
213
+
214
+
215
+ //========================================================================
216
+ // _glfwPlatformDestroyCond() - Destroy a condition variable object
217
+ //========================================================================
218
+
219
+ void _glfwPlatformDestroyCond( GLFWcond cond )
220
+ {
221
+ // TODO
222
+ }
223
+
224
+
225
+ //========================================================================
226
+ // _glfwPlatformWaitCond() - Wait for a condition to be raised
227
+ //========================================================================
228
+
229
+ void _glfwPlatformWaitCond( GLFWcond cond, GLFWmutex mutex,
230
+ double timeout )
231
+ {
232
+ // TODO
233
+ }
234
+
235
+
236
+ //========================================================================
237
+ // _glfwPlatformSignalCond() - Signal a condition to one waiting thread
238
+ //========================================================================
239
+
240
+ void _glfwPlatformSignalCond( GLFWcond cond )
241
+ {
242
+ // TODO
243
+ }
244
+
245
+
246
+ //========================================================================
247
+ // _glfwPlatformBroadcastCond() - Broadcast a condition to all waiting
248
+ // threads
249
+ //========================================================================
250
+
251
+ void _glfwPlatformBroadcastCond( GLFWcond cond )
252
+ {
253
+ // TODO
254
+ }
255
+
256
+
257
+ //========================================================================
258
+ // _glfwPlatformGetNumberOfProcessors() - Return the number of processors
259
+ // in the system.
260
+ //========================================================================
261
+
262
+ int _glfwPlatformGetNumberOfProcessors( void )
263
+ {
264
+ // Return number of processors online (DOS does not support multiple
265
+ // CPUs...)
266
+ return 1;
267
+ }