ruby-glfw 0.9

Sign up to get free protection for your applications and to get access to all the features.
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,83 @@
1
+ <html>
2
+
3
+ <head>
4
+ <title>GLFW Readme file for the D programming language</title>
5
+ </head>
6
+ <body>
7
+
8
+ <!-- TITLE -------------------------------------------------------------->
9
+ <center>
10
+ <font face="bookman old style,arial" size=+4><b>GLFW v2.5</b></font><br>
11
+ <font face="bookman old style,arial" size=+3>for D</font>
12
+ </center>
13
+
14
+ <!-- CONTENTS ----------------------------------------------------------->
15
+ <p>
16
+ <center>
17
+ <table border=0><tr><td>
18
+ <b>
19
+ <ol>
20
+ <li><a href="#sec1">Introduction</li></a>
21
+ <li><a href="#sec2">Using GLFW from D</li></a>
22
+ <li><a href="#sec3">The author</li></a>
23
+ </ol>
24
+ </b>
25
+ </td></tr></table>
26
+ </center>
27
+
28
+
29
+ <!----------------------------------------------------------------------->
30
+ <p><hr>
31
+ <!----------------------------------------------------------------------->
32
+
33
+ <a name="sec1">
34
+ <p><h2>1. Introduction</h2>
35
+
36
+ <p>This directory contains D bindings for the GLFW v2.5.x Windows DLL,
37
+ and D example programs. For further information on how to use GLFW you
38
+ should read the GLFW documentation.
39
+
40
+ <!----------------------------------------------------------------------->
41
+ <p><hr>
42
+ <!----------------------------------------------------------------------->
43
+
44
+ <a name="sec2">
45
+ <p><h2>2. Using GLFW from D</h2>
46
+
47
+ <p>First you have to install GLFW under your Digital Mars environment.
48
+
49
+ <p><ol>
50
+ <li>Build the OpenGL, GLU and GLFW import libraries in the support\d\lib
51
+ directory by running 'make'.</li>
52
+ <li>Copy the resulting .lib files to your dm\lib folder.</li>
53
+ <li>...</li>
54
+ </ol>
55
+
56
+ <p>More TODO...
57
+
58
+
59
+ <!----------------------------------------------------------------------->
60
+ <p><hr>
61
+ <!----------------------------------------------------------------------->
62
+
63
+ <a name="sec3">
64
+ <p><h2>3. The maintainer</h2>
65
+
66
+ <p>My name is Camilla Berglund,
67
+ <a href="mailto:elmindreda@users.sourceforge.net">elmindreda@users.sourceforge.net</a>.
68
+ Please visit our
69
+ <a href="http://sourceforge.net/projects/glfw/">support forums</a>
70
+ if you have any problems with GLFW or any questions concerning GLFW.
71
+
72
+ <p>The GLFW web site can be found here:
73
+ <a href="http://glfw.sourceforge.net/">http://glfw.sourceforge.net/</a>.
74
+ It contains the latest version of GLFW, news and other information that is
75
+ useful for OpenGL development.
76
+
77
+ <!----------------------------------------------------------------------->
78
+ <p><hr>
79
+ <!----------------------------------------------------------------------->
80
+
81
+ </body>
82
+ </html>
83
+
@@ -0,0 +1,105 @@
1
+ program Triangle;
2
+
3
+ //========================================================================
4
+ // This is a small test application for GLFW.
5
+ // The program opens a window (640x480), and renders a spinning colored
6
+ // triangle (it is controlled with both the GLFW timer and the mouse). It
7
+ // also calculates the rendering speed (FPS), which is displayed in the
8
+ // window title bar.
9
+ //
10
+ // Delphi conversion by Jarrod Davis (http://ww.jdsgames.com)
11
+ //========================================================================
12
+
13
+ uses
14
+ SysUtils, OpenGL, glfw;
15
+
16
+ var
17
+ width, height, running, frames, x, y: Integer;
18
+ t, t0, fps: Double;
19
+ titlestr: string;
20
+
21
+ begin
22
+ // Initialize GLFW
23
+ glfwInit;
24
+
25
+ // Open OpenGL window
26
+ if glfwOpenWindow( 640, 480, 0,0,0,0, 0,0, GLFW_WINDOW ) <> 1 then
27
+ begin
28
+ glfwTerminate;
29
+ Exit;
30
+ end;
31
+
32
+ // Enable sticky keys
33
+ glfwEnable( GLFW_STICKY_KEYS );
34
+
35
+ // Disable vertical sync (on cards that support it)
36
+ glfwSwapInterval( 0 );
37
+
38
+ // Main loop
39
+ running := 1;
40
+ frames := 0;
41
+ t0 := glfwGetTime;
42
+ while running <> 0 do
43
+ begin
44
+ // Get time and mouse position
45
+ t := glfwGetTime;
46
+ glfwGetMousePos(x, y );
47
+
48
+ // Calculate and display FPS (frames per second)
49
+ if ((t-t0) > 1.0) or (frames = 0) then
50
+ begin
51
+ fps := frames / (t-t0);
52
+ titlestr := Format('Spinning Triangle (%.1f FPS)', [fps]);
53
+ glfwSetWindowTitle( PChar(titlestr) );
54
+ t0 := t;
55
+ frames := 0;
56
+ end;
57
+ inc(frames);
58
+
59
+ // Get window size (may be different than the requested size)
60
+ glfwGetWindowSize( width, height );
61
+ if height < 1 then height := 1;
62
+
63
+ // Set viewport
64
+ glViewport( 0, 0, width, height );
65
+
66
+ // Clear color buffer
67
+ glClearColor( 0.0, 0.0, 0.0, 0.0 );
68
+ glClear( GL_COLOR_BUFFER_BIT );
69
+
70
+ // Select and setup the projection matrix
71
+ glMatrixMode( GL_PROJECTION );
72
+ glLoadIdentity;
73
+ gluPerspective( 65.0, width/height, 1.0, 100.0 );
74
+
75
+ // Select and setup the modelview matrix
76
+ glMatrixMode( GL_MODELVIEW );
77
+ glLoadIdentity;
78
+ gluLookAt( 0.0, 1.0, 0.0, // Eye-position
79
+ 0.0, 20.0, 0.0, // View-point
80
+ 0.0, 0.0, 1.0 ); // Up-vector
81
+
82
+ // Draw a rotating colorful triangle
83
+ glTranslatef( 0.0, 14.0, 0.0 );
84
+ glRotatef( 0.3*x + t*100.0, 0.0, 0.0, 1.0 );
85
+ glBegin( GL_TRIANGLES );
86
+ glColor3f( 1.0, 0.0, 0.0 );
87
+ glVertex3f( -5.0, 0.0, -4.0 );
88
+ glColor3f( 0.0, 1.0, 0.0 );
89
+ glVertex3f( 5.0, 0.0, -4.0 );
90
+ glColor3f( 0.0, 0.0, 1.0 );
91
+ glVertex3f( 0.0, 0.0, 6.0 );
92
+ glEnd;
93
+
94
+ // Swap buffers
95
+ glfwSwapBuffers;
96
+
97
+ // Check if the ESC key was pressed or the window was closed
98
+ running := (not glfwGetKey( GLFW_KEY_ESC )) and
99
+ glfwGetWindowParam( GLFW_OPENED );
100
+ end;
101
+
102
+ // Close OpenGL window and terminate GLFW
103
+ glfwTerminate;
104
+
105
+ end.
@@ -0,0 +1,437 @@
1
+ //========================================================================
2
+ // GLFW - An OpenGL framework
3
+ // File: glfw.pas
4
+ // Platform: Delphi/Windows
5
+ // API version: 2.5
6
+ // WWW: http://glfw.sourceforge.net
7
+ //------------------------------------------------------------------------
8
+ // Copyright (c) 2002-2005 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
+ unit glfw;
32
+
33
+ interface
34
+
35
+ const
36
+
37
+ //========================================================================
38
+ // GLFW version
39
+ //========================================================================
40
+ GLFW_VERSION_MAJOR = 2;
41
+ GLFW_VERSION_MINOR = 5;
42
+ GLFW_VERSION_REVISION = 0;
43
+
44
+ //========================================================================
45
+ // Input handling definitions
46
+ //========================================================================
47
+
48
+ // Key and button state/action definitions
49
+ GLFW_RELEASE = 0;
50
+ GLFW_PRESS = 1;
51
+
52
+ // Keyboard key definitions: 8-bit ISO-8859-1 (Latin 1) encoding is used
53
+ // for printable keys (such as A-Z, 0-9 etc), and values above 256
54
+ // represent special (non-printable) keys (e.g. F1, Page Up etc).
55
+ GLFW_KEY_UNKNOWN = -1;
56
+ GLFW_KEY_SPACE = 32;
57
+ GLFW_KEY_SPECIAL = 256;
58
+ GLFW_KEY_ESC = (GLFW_KEY_SPECIAL+1);
59
+ GLFW_KEY_F1 = (GLFW_KEY_SPECIAL+2);
60
+ GLFW_KEY_F2 = (GLFW_KEY_SPECIAL+3);
61
+ GLFW_KEY_F3 = (GLFW_KEY_SPECIAL+4);
62
+ GLFW_KEY_F4 = (GLFW_KEY_SPECIAL+5);
63
+ GLFW_KEY_F5 = (GLFW_KEY_SPECIAL+6);
64
+ GLFW_KEY_F6 = (GLFW_KEY_SPECIAL+7);
65
+ GLFW_KEY_F7 = (GLFW_KEY_SPECIAL+8);
66
+ GLFW_KEY_F8 = (GLFW_KEY_SPECIAL+9);
67
+ GLFW_KEY_F9 = (GLFW_KEY_SPECIAL+10);
68
+ GLFW_KEY_F10 = (GLFW_KEY_SPECIAL+11);
69
+ GLFW_KEY_F11 = (GLFW_KEY_SPECIAL+12);
70
+ GLFW_KEY_F12 = (GLFW_KEY_SPECIAL+13);
71
+ GLFW_KEY_F13 = (GLFW_KEY_SPECIAL+14);
72
+ GLFW_KEY_F14 = (GLFW_KEY_SPECIAL+15);
73
+ GLFW_KEY_F15 = (GLFW_KEY_SPECIAL+16);
74
+ GLFW_KEY_F16 = (GLFW_KEY_SPECIAL+17);
75
+ GLFW_KEY_F17 = (GLFW_KEY_SPECIAL+18);
76
+ GLFW_KEY_F18 = (GLFW_KEY_SPECIAL+19);
77
+ GLFW_KEY_F19 = (GLFW_KEY_SPECIAL+20);
78
+ GLFW_KEY_F20 = (GLFW_KEY_SPECIAL+21);
79
+ GLFW_KEY_F21 = (GLFW_KEY_SPECIAL+22);
80
+ GLFW_KEY_F22 = (GLFW_KEY_SPECIAL+23);
81
+ GLFW_KEY_F23 = (GLFW_KEY_SPECIAL+24);
82
+ GLFW_KEY_F24 = (GLFW_KEY_SPECIAL+25);
83
+ GLFW_KEY_F25 = (GLFW_KEY_SPECIAL+26);
84
+ GLFW_KEY_UP = (GLFW_KEY_SPECIAL+27);
85
+ GLFW_KEY_DOWN = (GLFW_KEY_SPECIAL+28);
86
+ GLFW_KEY_LEFT = (GLFW_KEY_SPECIAL+29);
87
+ GLFW_KEY_RIGHT = (GLFW_KEY_SPECIAL+30);
88
+ GLFW_KEY_LSHIFT = (GLFW_KEY_SPECIAL+31);
89
+ GLFW_KEY_RSHIFT = (GLFW_KEY_SPECIAL+32);
90
+ GLFW_KEY_LCTRL = (GLFW_KEY_SPECIAL+33);
91
+ GLFW_KEY_RCTRL = (GLFW_KEY_SPECIAL+34);
92
+ GLFW_KEY_LALT = (GLFW_KEY_SPECIAL+35);
93
+ GLFW_KEY_RALT = (GLFW_KEY_SPECIAL+36);
94
+ GLFW_KEY_TAB = (GLFW_KEY_SPECIAL+37);
95
+ GLFW_KEY_ENTER = (GLFW_KEY_SPECIAL+38);
96
+ GLFW_KEY_BACKSPACE = (GLFW_KEY_SPECIAL+39);
97
+ GLFW_KEY_INSERT = (GLFW_KEY_SPECIAL+40);
98
+ GLFW_KEY_DEL = (GLFW_KEY_SPECIAL+41);
99
+ GLFW_KEY_PAGEUP = (GLFW_KEY_SPECIAL+42);
100
+ GLFW_KEY_PAGEDOWN = (GLFW_KEY_SPECIAL+43);
101
+ GLFW_KEY_HOME = (GLFW_KEY_SPECIAL+44);
102
+ GLFW_KEY_END = (GLFW_KEY_SPECIAL+45);
103
+ GLFW_KEY_KP_0 = (GLFW_KEY_SPECIAL+46);
104
+ GLFW_KEY_KP_1 = (GLFW_KEY_SPECIAL+47);
105
+ GLFW_KEY_KP_2 = (GLFW_KEY_SPECIAL+48);
106
+ GLFW_KEY_KP_3 = (GLFW_KEY_SPECIAL+49);
107
+ GLFW_KEY_KP_4 = (GLFW_KEY_SPECIAL+50);
108
+ GLFW_KEY_KP_5 = (GLFW_KEY_SPECIAL+51);
109
+ GLFW_KEY_KP_6 = (GLFW_KEY_SPECIAL+52);
110
+ GLFW_KEY_KP_7 = (GLFW_KEY_SPECIAL+53);
111
+ GLFW_KEY_KP_8 = (GLFW_KEY_SPECIAL+54);
112
+ GLFW_KEY_KP_9 = (GLFW_KEY_SPECIAL+55);
113
+ GLFW_KEY_KP_DIVIDE = (GLFW_KEY_SPECIAL+56);
114
+ GLFW_KEY_KP_MULTIPLY = (GLFW_KEY_SPECIAL+57);
115
+ GLFW_KEY_KP_SUBTRACT = (GLFW_KEY_SPECIAL+58);
116
+ GLFW_KEY_KP_ADD = (GLFW_KEY_SPECIAL+59);
117
+ GLFW_KEY_KP_DECIMAL = (GLFW_KEY_SPECIAL+60);
118
+ GLFW_KEY_KP_EQUAL = (GLFW_KEY_SPECIAL+61);
119
+ GLFW_KEY_KP_ENTER = (GLFW_KEY_SPECIAL+62);
120
+ GLFW_KEY_LAST = GLFW_KEY_KP_ENTER;
121
+
122
+ // Mouse button definitions
123
+ GLFW_MOUSE_BUTTON_1 = 0;
124
+ GLFW_MOUSE_BUTTON_2 = 1;
125
+ GLFW_MOUSE_BUTTON_3 = 2;
126
+ GLFW_MOUSE_BUTTON_4 = 3;
127
+ GLFW_MOUSE_BUTTON_5 = 4;
128
+ GLFW_MOUSE_BUTTON_6 = 5;
129
+ GLFW_MOUSE_BUTTON_7 = 6;
130
+ GLFW_MOUSE_BUTTON_8 = 7;
131
+ GLFW_MOUSE_BUTTON_LAST = GLFW_MOUSE_BUTTON_8;
132
+
133
+ // Mouse button aliases
134
+ GLFW_MOUSE_BUTTON_LEFT = GLFW_MOUSE_BUTTON_1;
135
+ GLFW_MOUSE_BUTTON_RIGHT = GLFW_MOUSE_BUTTON_2;
136
+ GLFW_MOUSE_BUTTON_MIDDLE = GLFW_MOUSE_BUTTON_3;
137
+
138
+ // Joystick identifiers
139
+ GLFW_JOYSTICK_1 = 0;
140
+ GLFW_JOYSTICK_2 = 1;
141
+ GLFW_JOYSTICK_3 = 2;
142
+ GLFW_JOYSTICK_4 = 3;
143
+ GLFW_JOYSTICK_5 = 4;
144
+ GLFW_JOYSTICK_6 = 5;
145
+ GLFW_JOYSTICK_7 = 6;
146
+ GLFW_JOYSTICK_8 = 7;
147
+ GLFW_JOYSTICK_9 = 8;
148
+ GLFW_JOYSTICK_10 = 9;
149
+ GLFW_JOYSTICK_11 = 10;
150
+ GLFW_JOYSTICK_12 = 11;
151
+ GLFW_JOYSTICK_13 = 12;
152
+ GLFW_JOYSTICK_14 = 13;
153
+ GLFW_JOYSTICK_15 = 14;
154
+ GLFW_JOYSTICK_16 = 15;
155
+ GLFW_JOYSTICK_LAST = GLFW_JOYSTICK_16;
156
+
157
+
158
+ //========================================================================
159
+ // Other definitions
160
+ //========================================================================
161
+
162
+ // glfwOpenWindow modes
163
+ GLFW_WINDOW = $00010001;
164
+ GLFW_FULLSCREEN = $00010002;
165
+
166
+ // glfwGetWindowParam tokens
167
+ GLFW_OPENED = $00020001;
168
+ GLFW_ACTIVE = $00020002;
169
+ GLFW_ICONIFIED = $00020003;
170
+ GLFW_ACCELERATED = $00020004;
171
+ GLFW_RED_BITS = $00020005;
172
+ GLFW_GREEN_BITS = $00020006;
173
+ GLFW_BLUE_BITS = $00020007;
174
+ GLFW_ALPHA_BITS = $00020008;
175
+ GLFW_DEPTH_BITS = $00020009;
176
+ GLFW_STENCIL_BITS = $0002000A;
177
+
178
+ // The following constants are used for both glfwGetWindowParam
179
+ // and glfwOpenWindowHint
180
+ GLFW_REFRESH_RATE = $0002000B;
181
+ GLFW_ACCUM_RED_BITS = $0002000C;
182
+ GLFW_ACCUM_GREEN_BITS = $0002000D;
183
+ GLFW_ACCUM_BLUE_BITS = $0002000E;
184
+ GLFW_ACCUM_ALPHA_BITS = $0002000F;
185
+ GLFW_AUX_BUFFERS = $00020010;
186
+ GLFW_STEREO = $00020011;
187
+ GLFW_WINDOW_NO_RESIZE = $00020012;
188
+ GLFW_FSAA_SAMPLES = $00020013;
189
+
190
+ // glfwEnable/glfwDisable tokens
191
+ GLFW_MOUSE_CURSOR = $00030001;
192
+ GLFW_STICKY_KEYS = $00030002;
193
+ GLFW_STICKY_MOUSE_BUTTONS = $00030003;
194
+ GLFW_SYSTEM_KEYS = $00030004;
195
+ GLFW_KEY_REPEAT = $00030005;
196
+ GLFW_AUTO_POLL_EVENTS = $00030006;
197
+
198
+ // glfwWaitThread wait modes
199
+ GLFW_WAIT = $00040001;
200
+ GLFW_NOWAIT = $00040002;
201
+
202
+ // glfwGetJoystickParam tokens
203
+ GLFW_PRESENT = $00050001;
204
+ GLFW_AXES = $00050002;
205
+ GLFW_BUTTONS = $00050003;
206
+
207
+ // glfwReadImage/glfwLoadTexture2D flags
208
+ GLFW_NO_RESCALE_BIT = $00000001; // Only for glfwReadImage
209
+ GLFW_ORIGIN_UL_BIT = $00000002;
210
+ GLFW_BUILD_MIPMAPS_BIT = $00000004; // Only for glfwLoadTexture2D
211
+ GLFW_ALPHA_MAP_BIT = $00000008;
212
+
213
+ // Time spans longer than this (seconds) are considered to be infinity
214
+ GLFW_INFINITY = 100000.0;
215
+
216
+
217
+ //========================================================================
218
+ // Typedefs
219
+ //========================================================================
220
+
221
+ type
222
+
223
+ // The video mode structure used by glfwGetVideoModes()
224
+ GLFWvidmode = packed record
225
+ Width, Height : Integer;
226
+ RedBits, BlueBits, GreenBits: Integer;
227
+ end;
228
+ PGLFWvidmode = ^GLFWvidmode;
229
+
230
+ // Image/texture information
231
+ GLFWimage = packed record
232
+ Width, Height: Integer;
233
+ Format : Integer;
234
+ BytesPerPixel: Integer;
235
+ Data : PChar;
236
+ end;
237
+ PGLFWimage = ^GLFWimage;
238
+
239
+ // Thread ID
240
+ GLFWthread = Integer;
241
+
242
+ // Mutex object
243
+ GLFWmutex = Pointer;
244
+
245
+ // Condition variable object
246
+ GLFWcond = Pointer;
247
+
248
+ // Function pointer types
249
+ GLFWwindowsizefun = procedure(Width, Height: Integer); stdcall;
250
+ GLFWwindowclosefun = function: Integer; stdcall;
251
+ GLFWwindowrefreshfun = procedure; stdcall;
252
+ GLFWmousebuttonfun = procedure(Button, Action: Integer); stdcall;
253
+ GLFWmouseposfun = procedure(X, Y: Integer); stdcall;
254
+ GLFWmousewheelfun = procedure(Pos: Integer); stdcall;
255
+ GLFWkeyfun = procedure(Key, Action: Integer); stdcall;
256
+ GLFWcharfun = procedure(Character, Action: Integer); stdcall;
257
+ GLFWthreadfun = procedure(Arg: Pointer); stdcall;
258
+
259
+
260
+ //========================================================================
261
+ // Prototypes
262
+ //========================================================================
263
+
264
+ // GLFW initialization, termination and version querying
265
+ function glfwInit: Integer; stdcall;
266
+ procedure glfwTerminate; stdcall;
267
+ procedure glfwGetVersion(var major: Integer; var minor: Integer; var Rev: Integer); stdcall;
268
+
269
+ // Window handling
270
+ function glfwOpenWindow(width, height, redbits, greenbits, bluebits, alphabits, depthbits, stencilbits, mode: Integer): Integer; stdcall;
271
+ procedure glfwOpenWindowHint(target, hint: Integer); stdcall;
272
+ procedure glfwCloseWindow; stdcall;
273
+ procedure glfwSetWindowTitle(title: PChar); stdcall;
274
+ procedure glfwGetWindowSize(var width: Integer; var height: Integer); stdcall;
275
+ procedure glfwSetWindowSize(width, height: Integer); stdcall;
276
+ procedure glfwSetWindowPos(x, y: Integer); stdcall;
277
+ procedure glfwIconifyWindow; stdcall;
278
+ procedure glfwRestoreWindow; stdcall;
279
+ procedure glfwSwapBuffers; stdcall;
280
+ procedure glfwSwapInterval(interval: Integer); stdcall;
281
+ function glfwGetWindowParam(Param: Integer): Integer; stdcall;
282
+ procedure glfwSetWindowSizeCallback(cbfun: GLFWwindowsizefun); stdcall;
283
+ procedure glfwSetWindowCloseCallback(cbfun: GLFWwindowclosefun); stdcall;
284
+ procedure glfwSetWindowRefreshCallback(cbfun: GLFWwindowrefreshfun); stdcall;
285
+
286
+ // Video mode functions
287
+ function glfwGetVideoModes(list: PGLFWvidmode; maxcount: Integer): Integer; stdcall;
288
+ procedure glfwGetDesktopMode(mode: PGLFWvidmode); stdcall;
289
+
290
+ // Input handling
291
+ procedure glfwPollEvents; stdcall;
292
+ procedure glfwWaitEvents; stdcall;
293
+ function glfwGetKey(key: Integer): Integer; stdcall;
294
+ function glfwGetMouseButton(button: Integer): Integer; stdcall;
295
+ procedure glfwGetMousePos(var xpos: Integer; var ypos: Integer); stdcall;
296
+ procedure glfwSetMousePos(xpos, ypos: Integer); stdcall;
297
+ function glfwGetMouseWheel: Integer; stdcall;
298
+ procedure glfwSetMouseWheel(pos: Integer); stdcall;
299
+ procedure glfwSetKeyCallback( cbfun: GLFWkeyfun); stdcall;
300
+ procedure glfwSetCharCallback( cbfun: GLFWcharfun); stdcall;
301
+ procedure glfwSetMouseButtonCallback( cbfun: GLFWmousebuttonfun); stdcall;
302
+ procedure glfwSetMousePosCallback( cbfun: GLFWmouseposfun); stdcall;
303
+ procedure glfwSetMouseWheelCallback( cbfun: GLFWmousewheelfun); stdcall;
304
+
305
+ // Joystick input
306
+ function glfwGetJoystickParam(joy, param: Integer): Integer; stdcall;
307
+ function glfwGetJoystickPos(joy: Integer; var pos: Single; numaxes: Integer): Integer; stdcall;
308
+ function glfwGetJoystickButtons(joy: Integer; buttons: PChar; numbuttons: Integer): Integer; stdcall;
309
+
310
+ // Time
311
+ function glfwGetTime: Double; stdcall;
312
+ procedure glfwSetTime(time: Double); stdcall;
313
+ procedure glfwSleep(time: Double); stdcall;
314
+
315
+ // Extension support
316
+ function glfwExtensionSupported(extension: PChar): Integer; stdcall;
317
+ function glfwGetProcAddress(procname: PChar): Pointer; stdcall;
318
+ procedure glfwGetGLVersion(var major: Integer; var minor: Integer; var Rev: Integer); stdcall;
319
+
320
+ // Threading support
321
+ function glfwCreateThread(fun: GLFWthreadfun; arg: Pointer): GLFWthread; stdcall;
322
+ procedure glfwDestroyThread(Id: GLFWthread); stdcall;
323
+ function glfwWaitThread(Id: GLFWthread; waitmode: Integer): Integer; stdcall;
324
+ function glfwGetThreadID: GLFWthread; stdcall;
325
+ function glfwCreateMutex: GLFWmutex; stdcall;
326
+ procedure glfwDestroyMutex( mutex: GLFWmutex); stdcall;
327
+ procedure glfwLockMutex(mutex: GLFWmutex); stdcall;
328
+ procedure glfwUnlockMutex(mutex: GLFWmutex); stdcall;
329
+ function glfwCreateCond: GLFWcond; stdcall;
330
+ procedure glfwDestroyCond(cond: GLFWcond); stdcall;
331
+ procedure glfwWaitCond(cond: GLFWcond; mutex: GLFWmutex; timeout: Double); stdcall;
332
+ procedure glfwSignalCond(cond: GLFWcond); stdcall;
333
+ procedure glfwBroadcastCond(cond: GLFWcond); stdcall;
334
+ function glfwGetNumberOfProcessors: Integer; stdcall;
335
+
336
+ // Enable/disable functions
337
+ procedure glfwEnable(token: Integer); stdcall;
338
+ procedure glfwDisable(token: Integer); stdcall;
339
+
340
+ // Image/texture I/O support
341
+ function glfwReadImage(name: PChar; image: PGLFWimage; flags: Integer): Integer; stdcall;
342
+ function glfwReadMemoryImage(data: PChar; size: LongInt; img: PGLFWimage; flags: Integer): Integer; stdcall;
343
+ procedure glfwFreeImage(img: PGLFWimage);
344
+ function glfwLoadTexture2D(name: PChar; flags: Integer): Integer; stdcall;
345
+ function glfwLoadMemoryTexture2D(data: PChar; size: LongInt; flags: Integer): Integer; stdcall;
346
+ function glfwLoadTextureImage2D(img: PGLFWimage; flags: Integer): Integer; stdcall;
347
+
348
+ implementation
349
+
350
+ const
351
+ DLLNAME = 'glfw.dll';
352
+
353
+ // GLFW initialization, termination and version querying
354
+ function glfwInit; external DLLNAME;
355
+ procedure glfwTerminate; external DLLNAME;
356
+ procedure glfwGetVersion; external DLLNAME;
357
+
358
+ // Window handling
359
+ function glfwOpenWindow; external DLLNAME;
360
+ procedure glfwOpenWindowHint; external DLLNAME;
361
+ procedure glfwCloseWindow; external DLLNAME;
362
+ procedure glfwSetWindowTitle; external DLLNAME;
363
+ procedure glfwGetWindowSize; external DLLNAME;
364
+ procedure glfwSetWindowSize; external DLLNAME;
365
+ procedure glfwSetWindowPos; external DLLNAME;
366
+ procedure glfwIconifyWindow; external DLLNAME;
367
+ procedure glfwRestoreWindow; external DLLNAME;
368
+ procedure glfwSwapBuffers; external DLLNAME;
369
+ procedure glfwSwapInterval; external DLLNAME;
370
+ function glfwGetWindowParam; external DLLNAME;
371
+ procedure glfwSetWindowSizeCallback; external DLLNAME;
372
+ procedure glfwSetWindowCloseCallback; external DLLNAME;
373
+ procedure glfwSetWindowRefreshCallback; external DLLNAME;
374
+
375
+ // Video mode functions
376
+ function glfwGetVideoModes; external DLLNAME;
377
+ procedure glfwGetDesktopMode; external DLLNAME;
378
+
379
+ // Input handling
380
+ procedure glfwPollEvents; external DLLNAME;
381
+ procedure glfwWaitEvents; external DLLNAME;
382
+ function glfwGetKey; external DLLNAME;
383
+ function glfwGetMouseButton; external DLLNAME;
384
+ procedure glfwGetMousePos; external DLLNAME;
385
+ procedure glfwSetMousePos; external DLLNAME;
386
+ function glfwGetMouseWheel; external DLLNAME;
387
+ procedure glfwSetMouseWheel; external DLLNAME;
388
+ procedure glfwSetKeyCallback; external DLLNAME;
389
+ procedure glfwSetCharCallback; external DLLNAME;
390
+ procedure glfwSetMouseButtonCallback; external DLLNAME;
391
+ procedure glfwSetMousePosCallback; external DLLNAME;
392
+ procedure glfwSetMouseWheelCallback; external DLLNAME;
393
+
394
+ // Joystick input
395
+ function glfwGetJoystickParam; external DLLNAME;
396
+ function glfwGetJoystickPos; external DLLNAME;
397
+ function glfwGetJoystickButtons; external DLLNAME;
398
+
399
+ // Time
400
+ function glfwGetTime: Double; external DLLNAME;
401
+ procedure glfwSetTime; external DLLNAME;
402
+ procedure glfwSleep; external DLLNAME;
403
+
404
+ // Extension support
405
+ function glfwExtensionSupported; external DLLNAME;
406
+ function glfwGetProcAddress; external DLLNAME;
407
+ procedure glfwGetGLVersion; external DLLNAME;
408
+
409
+ // Threading support
410
+ function glfwCreateThread; external DLLNAME;
411
+ procedure glfwDestroyThread; external DLLNAME;
412
+ function glfwWaitThread; external DLLNAME;
413
+ function glfwGetThreadID; external DLLNAME;
414
+ function glfwCreateMutex; external DLLNAME;
415
+ procedure glfwDestroyMutex; external DLLNAME;
416
+ procedure glfwLockMutex; external DLLNAME;
417
+ procedure glfwUnlockMutex; external DLLNAME;
418
+ function glfwCreateCond; external DLLNAME;
419
+ procedure glfwDestroyCond; external DLLNAME;
420
+ procedure glfwWaitCond; external DLLNAME;
421
+ procedure glfwSignalCond; external DLLNAME;
422
+ procedure glfwBroadcastCond; external DLLNAME;
423
+ function glfwGetNumberOfProcessors; external DLLNAME;
424
+
425
+ // Enable/disable functions
426
+ procedure glfwEnable; external DLLNAME;
427
+ procedure glfwDisable; external DLLNAME;
428
+
429
+ // Image/texture I/O support
430
+ function glfwReadImage; external DLLNAME;
431
+ function glfwReadMemoryImage; external DLLNAME;
432
+ procedure glfwFreeImage; external DLLNAME;
433
+ function glfwLoadTexture2D; external DLLNAME;
434
+ function glfwLoadMemoryTexture2D; external DLLNAME;
435
+ function glfwLoadTextureImage2D; external DLLNAME;
436
+
437
+ end.