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,243 @@
1
+
2
+ ##########################################################################
3
+ # Installation prefix (default to /usr/local)
4
+ ##########################################################################
5
+ PREFIX ?= /usr/local
6
+
7
+
8
+ ##########################################################################
9
+ # Default: Build GLFW static library
10
+ ##########################################################################
11
+ default: libglfw.a libglfw.so
12
+
13
+
14
+ ##########################################################################
15
+ # Library builder settings
16
+ ##########################################################################
17
+ AR = ar
18
+ LD = ld
19
+ SED = sed
20
+ INSTALL = install
21
+ ARFLAGS = -rcs
22
+
23
+
24
+ ##########################################################################
25
+ # Install GLFW static library
26
+ ##########################################################################
27
+ install: libglfw.a libglfw.pc
28
+ $(INSTALL) -d $(PREFIX)/lib
29
+ $(INSTALL) -c -m 644 libglfw.a $(PREFIX)/lib/libglfw.a
30
+ $(INSTALL) -d $(PREFIX)/include/GL
31
+ $(INSTALL) -c -m 644 ../../include/GL/glfw.h $(PREFIX)/include/GL/glfw.h
32
+ $(INSTALL) -d $(PREFIX)/lib/pkgconfig
33
+ $(INSTALL) -c -m 644 libglfw.pc $(PREFIX)/lib/pkgconfig/libglfw.pc
34
+
35
+
36
+ ##########################################################################
37
+ # Object files which are part of the GLFW library
38
+ ##########################################################################
39
+ STATIC_OBJS = \
40
+ enable.o \
41
+ fullscreen.o \
42
+ glext.o \
43
+ image.o \
44
+ init.o \
45
+ input.o \
46
+ joystick.o \
47
+ stream.o \
48
+ tga.o \
49
+ thread.o \
50
+ time.o \
51
+ window.o \
52
+ x11_enable.o \
53
+ x11_fullscreen.o \
54
+ x11_glext.o \
55
+ x11_init.o \
56
+ x11_joystick.o \
57
+ x11_keysym2unicode.o \
58
+ x11_thread.o \
59
+ x11_time.o \
60
+ x11_window.o
61
+
62
+
63
+ ##########################################################################
64
+ # Object files which are part of the GLFW library
65
+ ##########################################################################
66
+ SHARED_OBJS = \
67
+ so_enable.o \
68
+ so_fullscreen.o \
69
+ so_glext.o \
70
+ so_image.o \
71
+ so_init.o \
72
+ so_input.o \
73
+ so_joystick.o \
74
+ so_stream.o \
75
+ so_tga.o \
76
+ so_thread.o \
77
+ so_time.o \
78
+ so_window.o \
79
+ so_x11_enable.o \
80
+ so_x11_fullscreen.o \
81
+ so_x11_glext.o \
82
+ so_x11_init.o \
83
+ so_x11_joystick.o \
84
+ so_x11_keysym2unicode.o \
85
+ so_x11_thread.o \
86
+ so_x11_time.o \
87
+ so_x11_window.o
88
+
89
+
90
+ ##########################################################################
91
+ # Rule for building libglfw.pc
92
+ ##########################################################################
93
+ libglfw.pc: libglfw.pc.in
94
+ $(SED) -e 's,\@PREFIX\@,$(PREFIX),' libglfw.pc.in > libglfw.pc
95
+
96
+
97
+ ##########################################################################
98
+ # Rule for building static library
99
+ ##########################################################################
100
+ libglfw.a: $(STATIC_OBJS)
101
+ $(AR) $(ARFLAGS) $@ $(STATIC_OBJS)
102
+
103
+
104
+ ##########################################################################
105
+ # Rule for building shared library
106
+ ##########################################################################
107
+ libglfw.so: $(SHARED_OBJS)
108
+ $(CC) $(LDFLAGS) -o $@ $(SHARED_OBJS) $(LFLAGS) $(LIBS)
109
+
110
+
111
+ ##########################################################################
112
+ # Rules for building static library object files
113
+ ##########################################################################
114
+ enable.o: ../enable.c ../internal.h platform.h
115
+ $(CC) $(CFLAGS) -o $@ ../enable.c
116
+
117
+ fullscreen.o: ../fullscreen.c ../internal.h platform.h
118
+ $(CC) $(CFLAGS) -o $@ ../fullscreen.c
119
+
120
+ glext.o: ../glext.c ../internal.h platform.h
121
+ $(CC) $(CFLAGS) -o $@ ../glext.c
122
+
123
+ image.o: ../image.c ../internal.h platform.h
124
+ $(CC) $(CFLAGS_SPEED) -o $@ ../image.c
125
+
126
+ init.o: ../init.c ../internal.h platform.h
127
+ $(CC) $(CFLAGS) -o $@ ../init.c
128
+
129
+ input.o: ../input.c ../internal.h platform.h
130
+ $(CC) $(CFLAGS) -o $@ ../input.c
131
+
132
+ joystick.o: ../joystick.c ../internal.h platform.h
133
+ $(CC) $(CFLAGS) -o $@ ../joystick.c
134
+
135
+ stream.o: ../stream.c ../internal.h platform.h
136
+ $(CC) $(CFLAGS) -o $@ ../stream.c
137
+
138
+ tga.o: ../tga.c ../internal.h platform.h
139
+ $(CC) $(CFLAGS_SPEED) -o $@ ../tga.c
140
+
141
+ thread.o: ../thread.c ../internal.h platform.h
142
+ $(CC) $(CFLAGS) -o $@ ../thread.c
143
+
144
+ time.o: ../time.c ../internal.h platform.h
145
+ $(CC) $(CFLAGS) -o $@ ../time.c
146
+
147
+ window.o: ../window.c ../internal.h platform.h
148
+ $(CC) $(CFLAGS) -o $@ ../window.c
149
+
150
+ x11_enable.o: x11_enable.c ../internal.h platform.h
151
+ $(CC) $(CFLAGS) -o $@ x11_enable.c
152
+
153
+ x11_fullscreen.o: x11_fullscreen.c ../internal.h platform.h
154
+ $(CC) $(CFLAGS) -o $@ x11_fullscreen.c
155
+
156
+ x11_glext.o: x11_glext.c ../internal.h platform.h
157
+ $(CC) $(CFLAGS) -o $@ x11_glext.c
158
+
159
+ x11_init.o: x11_init.c ../internal.h platform.h
160
+ $(CC) $(CFLAGS) -o $@ x11_init.c
161
+
162
+ x11_joystick.o: x11_joystick.c ../internal.h platform.h
163
+ $(CC) $(CFLAGS) -o $@ x11_joystick.c
164
+
165
+ x11_thread.o: x11_thread.c ../internal.h platform.h
166
+ $(CC) $(CFLAGS) -o $@ x11_thread.c
167
+
168
+ x11_time.o: x11_time.c ../internal.h platform.h
169
+ $(CC) $(CFLAGS) -o $@ x11_time.c
170
+
171
+ x11_window.o: x11_window.c ../internal.h platform.h
172
+ $(CC) $(CFLAGS) -o $@ x11_window.c
173
+
174
+ x11_keysym2unicode.o: x11_keysym2unicode.c ../internal.h platform.h
175
+ $(CC) $(CFLAGS) -o $@ x11_keysym2unicode.c
176
+
177
+
178
+ ##########################################################################
179
+ # Rules for building shared library object files
180
+ ##########################################################################
181
+ so_enable.o: ../enable.c ../internal.h platform.h
182
+ $(CC) -fPIC $(CFLAGS) -o $@ ../enable.c
183
+
184
+ so_fullscreen.o: ../fullscreen.c ../internal.h platform.h
185
+ $(CC) -fPIC $(CFLAGS) -o $@ ../fullscreen.c
186
+
187
+ so_glext.o: ../glext.c ../internal.h platform.h
188
+ $(CC) -fPIC $(CFLAGS) -o $@ ../glext.c
189
+
190
+ so_image.o: ../image.c ../internal.h platform.h
191
+ $(CC) -fPIC $(CFLAGS_SPEED) -o $@ ../image.c
192
+
193
+ so_init.o: ../init.c ../internal.h platform.h
194
+ $(CC) -fPIC $(CFLAGS) -o $@ ../init.c
195
+
196
+ so_input.o: ../input.c ../internal.h platform.h
197
+ $(CC) -fPIC $(CFLAGS) -o $@ ../input.c
198
+
199
+ so_joystick.o: ../joystick.c ../internal.h platform.h
200
+ $(CC) -fPIC $(CFLAGS) -o $@ ../joystick.c
201
+
202
+ so_stream.o: ../stream.c ../internal.h platform.h
203
+ $(CC) -fPIC $(CFLAGS) -o $@ ../stream.c
204
+
205
+ so_tga.o: ../tga.c ../internal.h platform.h
206
+ $(CC) -fPIC $(CFLAGS_SPEED) -o $@ ../tga.c
207
+
208
+ so_thread.o: ../thread.c ../internal.h platform.h
209
+ $(CC) -fPIC $(CFLAGS) -o $@ ../thread.c
210
+
211
+ so_time.o: ../time.c ../internal.h platform.h
212
+ $(CC) -fPIC $(CFLAGS) -o $@ ../time.c
213
+
214
+ so_window.o: ../window.c ../internal.h platform.h
215
+ $(CC) -fPIC $(CFLAGS) -o $@ ../window.c
216
+
217
+ so_x11_enable.o: x11_enable.c ../internal.h platform.h
218
+ $(CC) -fPIC $(CFLAGS) -o $@ x11_enable.c
219
+
220
+ so_x11_fullscreen.o: x11_fullscreen.c ../internal.h platform.h
221
+ $(CC) -fPIC $(CFLAGS) -o $@ x11_fullscreen.c
222
+
223
+ so_x11_glext.o: x11_glext.c ../internal.h platform.h
224
+ $(CC) -fPIC $(CFLAGS) -o $@ x11_glext.c
225
+
226
+ so_x11_init.o: x11_init.c ../internal.h platform.h
227
+ $(CC) -fPIC $(CFLAGS) -o $@ x11_init.c
228
+
229
+ so_x11_joystick.o: x11_joystick.c ../internal.h platform.h
230
+ $(CC) -fPIC $(CFLAGS) -o $@ x11_joystick.c
231
+
232
+ so_x11_thread.o: x11_thread.c ../internal.h platform.h
233
+ $(CC) -fPIC $(CFLAGS) -o $@ x11_thread.c
234
+
235
+ so_x11_time.o: x11_time.c ../internal.h platform.h
236
+ $(CC) -fPIC $(CFLAGS) -o $@ x11_time.c
237
+
238
+ so_x11_window.o: x11_window.c ../internal.h platform.h
239
+ $(CC) -fPIC $(CFLAGS) -o $@ x11_window.c
240
+
241
+ so_x11_keysym2unicode.o: x11_keysym2unicode.c ../internal.h platform.h
242
+ $(CC) -fPIC $(CFLAGS) -o $@ x11_keysym2unicode.c
243
+
@@ -0,0 +1,415 @@
1
+ //========================================================================
2
+ // GLFW - An OpenGL framework
3
+ // File: platform.h
4
+ // Platform: X11 (Unix)
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
+ #ifndef _platform_h_
32
+ #define _platform_h_
33
+
34
+
35
+ // This is the X11 version of GLFW
36
+ #define _GLFW_X11
37
+
38
+
39
+ // Include files
40
+ #include <sys/time.h>
41
+ #include <unistd.h>
42
+ #include <signal.h>
43
+ #include <X11/Xlib.h>
44
+ #include <X11/keysym.h>
45
+ #include <X11/Xatom.h>
46
+ #include <GL/glx.h>
47
+ #include "../../include/GL/glfw.h"
48
+
49
+ // Do we have pthread support?
50
+ #ifdef _GLFW_HAS_PTHREAD
51
+ #include <pthread.h>
52
+ #include <sched.h>
53
+ #endif
54
+
55
+ // With XFree86, we can use the XF86VidMode extension
56
+ #if defined( _GLFW_HAS_XF86VIDMODE )
57
+ #include <X11/extensions/xf86vmode.h>
58
+ #endif
59
+
60
+ #if defined( _GLFW_HAS_XRANDR )
61
+ #include <X11/extensions/Xrandr.h>
62
+ #endif
63
+
64
+ // Do we have support for dlopen/dlsym?
65
+ #if defined( _GLFW_HAS_DLOPEN )
66
+ #include <dlfcn.h>
67
+ #endif
68
+
69
+ // We support two different ways for getting the number of processors in
70
+ // the system: sysconf (POSIX) and sysctl (BSD?)
71
+ #if defined( _GLFW_HAS_SYSCONF )
72
+
73
+ // Use a single constant for querying number of online processors using
74
+ // the sysconf function (e.g. SGI defines _SC_NPROC_ONLN instead of
75
+ // _SC_NPROCESSORS_ONLN)
76
+ #ifndef _SC_NPROCESSORS_ONLN
77
+ #ifdef _SC_NPROC_ONLN
78
+ #define _SC_NPROCESSORS_ONLN _SC_NPROC_ONLN
79
+ #else
80
+ #error POSIX constant _SC_NPROCESSORS_ONLN not defined!
81
+ #endif
82
+ #endif
83
+
84
+ // Macro for querying the number of processors
85
+ #define _glfw_numprocessors(n) n=(int)sysconf(_SC_NPROCESSORS_ONLN)
86
+
87
+ #elif defined( _GLFW_HAS_SYSCTL )
88
+
89
+ #include <sys/types.h>
90
+ #include <sys/sysctl.h>
91
+
92
+ // Macro for querying the number of processors
93
+ #define _glfw_numprocessors(n) { \
94
+ int mib[2], ncpu; \
95
+ size_t len = 1; \
96
+ mib[0] = CTL_HW; \
97
+ mib[1] = HW_NCPU; \
98
+ n = 1; \
99
+ if( sysctl( mib, 2, &ncpu, &len, NULL, 0 ) != -1 ) \
100
+ { \
101
+ if( len > 0 ) \
102
+ { \
103
+ n = ncpu; \
104
+ } \
105
+ } \
106
+ }
107
+
108
+ #else
109
+
110
+ // If neither sysconf nor sysctl is supported, assume single processor
111
+ // system
112
+ #define _glfw_numprocessors(n) n=1
113
+
114
+ #endif
115
+
116
+ void (*glXGetProcAddress(const GLubyte *procName))();
117
+ void (*glXGetProcAddressARB(const GLubyte *procName))();
118
+ void (*glXGetProcAddressEXT(const GLubyte *procName))();
119
+
120
+ // We support four different ways for getting addresses for GL/GLX
121
+ // extension functions: glXGetProcAddress, glXGetProcAddressARB,
122
+ // glXGetProcAddressEXT, and dlsym
123
+ #if defined( _GLFW_HAS_GLXGETPROCADDRESSARB )
124
+ #define _glfw_glXGetProcAddress(x) glXGetProcAddressARB(x)
125
+ #elif defined( _GLFW_HAS_GLXGETPROCADDRESS )
126
+ #define _glfw_glXGetProcAddress(x) glXGetProcAddress(x)
127
+ #elif defined( _GLFW_HAS_GLXGETPROCADDRESSEXT )
128
+ #define _glfw_glXGetProcAddress(x) glXGetProcAddressEXT(x)
129
+ #elif defined( _GLFW_HAS_DLOPEN )
130
+ #define _glfw_glXGetProcAddress(x) dlsym(_glfwLibs.libGL,x)
131
+ #define _GLFW_DLOPEN_LIBGL
132
+ #else
133
+ #define _glfw_glXGetProcAddress(x) NULL
134
+ #endif
135
+
136
+ // glXSwapIntervalSGI typedef (X11 buffer-swap interval control)
137
+ typedef int ( * GLXSWAPINTERVALSGI_T) (int interval);
138
+
139
+
140
+ //========================================================================
141
+ // Global variables (GLFW internals)
142
+ //========================================================================
143
+
144
+ //------------------------------------------------------------------------
145
+ // Window structure
146
+ //------------------------------------------------------------------------
147
+ typedef struct _GLFWwin_struct _GLFWwin;
148
+
149
+ struct _GLFWwin_struct {
150
+
151
+ // ========= PLATFORM INDEPENDENT MANDATORY PART =========================
152
+
153
+ // User callback functions
154
+ GLFWwindowsizefun WindowSizeCallback;
155
+ GLFWwindowclosefun WindowCloseCallback;
156
+ GLFWwindowrefreshfun WindowRefreshCallback;
157
+ GLFWmousebuttonfun MouseButtonCallback;
158
+ GLFWmouseposfun MousePosCallback;
159
+ GLFWmousewheelfun MouseWheelCallback;
160
+ GLFWkeyfun KeyCallback;
161
+ GLFWcharfun CharCallback;
162
+
163
+ // User selected window settings
164
+ int Fullscreen; // Fullscreen flag
165
+ int MouseLock; // Mouse-lock flag
166
+ int AutoPollEvents; // Auto polling flag
167
+ int SysKeysDisabled; // System keys disabled flag
168
+ int WindowNoResize; // Resize- and maximize gadgets disabled flag
169
+
170
+ // Window status & parameters
171
+ int Opened; // Flag telling if window is opened or not
172
+ int Active; // Application active flag
173
+ int Iconified; // Window iconified flag
174
+ int Width, Height; // Window width and heigth
175
+ int Accelerated; // GL_TRUE if window is HW accelerated
176
+ int RedBits;
177
+ int GreenBits;
178
+ int BlueBits;
179
+ int AlphaBits;
180
+ int DepthBits;
181
+ int StencilBits;
182
+ int AccumRedBits;
183
+ int AccumGreenBits;
184
+ int AccumBlueBits;
185
+ int AccumAlphaBits;
186
+ int AuxBuffers;
187
+ int Stereo;
188
+ int RefreshRate; // Vertical monitor refresh rate
189
+ int Samples;
190
+
191
+ // Extensions & OpenGL version
192
+ int Has_GL_SGIS_generate_mipmap;
193
+ int Has_GL_ARB_texture_non_power_of_two;
194
+ int GLVerMajor,GLVerMinor;
195
+
196
+
197
+ // ========= PLATFORM SPECIFIC PART ======================================
198
+
199
+ // Platform specific window resources
200
+ Window Win; // Window
201
+ int Scrn; // Screen ID
202
+ XVisualInfo *VI; // Visual
203
+ GLXContext CX; // OpenGL rendering context
204
+ Atom WMDeleteWindow; // For WM close detection
205
+ Atom WMPing; // For WM ping response
206
+ XSizeHints *Hints; // WM size hints
207
+
208
+ // Platform specific extensions
209
+ GLXSWAPINTERVALSGI_T SwapInterval;
210
+
211
+ // Various platform specific internal variables
212
+ int OverrideRedirect; // True if window is OverrideRedirect
213
+ int KeyboardGrabbed; // True if keyboard is currently grabbed
214
+ int PointerGrabbed; // True if pointer is currently grabbed
215
+ int PointerHidden; // True if pointer is currently hidden
216
+ int MapNotifyCount; // Used for during processing
217
+ int FocusInCount; // Used for during processing
218
+
219
+ // Screensaver data
220
+ struct {
221
+ int Changed;
222
+ int Timeout;
223
+ int Interval;
224
+ int Blanking;
225
+ int Exposure;
226
+ } Saver;
227
+
228
+ // Fullscreen data
229
+ struct {
230
+ int ModeChanged;
231
+ #if defined( _GLFW_HAS_XF86VIDMODE )
232
+ XF86VidModeModeInfo OldMode;
233
+ #endif
234
+ #if defined( _GLFW_HAS_XRANDR )
235
+ SizeID OldSizeID;
236
+ int OldWidth;
237
+ int OldHeight;
238
+ Rotation OldRotation;
239
+ #endif
240
+ } FS;
241
+ };
242
+
243
+ GLFWGLOBAL _GLFWwin _glfwWin;
244
+
245
+
246
+ //------------------------------------------------------------------------
247
+ // User input status (most of this should go in _GLFWwin)
248
+ //------------------------------------------------------------------------
249
+ GLFWGLOBAL struct {
250
+
251
+ // ========= PLATFORM INDEPENDENT MANDATORY PART =========================
252
+
253
+ // Mouse status
254
+ int MousePosX, MousePosY;
255
+ int WheelPos;
256
+ char MouseButton[ GLFW_MOUSE_BUTTON_LAST+1 ];
257
+
258
+ // Keyboard status
259
+ char Key[ GLFW_KEY_LAST+1 ];
260
+ int LastChar;
261
+
262
+ // User selected settings
263
+ int StickyKeys;
264
+ int StickyMouseButtons;
265
+ int KeyRepeat;
266
+
267
+
268
+ // ========= PLATFORM SPECIFIC PART ======================================
269
+
270
+ // Platform specific internal variables
271
+ int MouseMoved, CursorPosX, CursorPosY;
272
+
273
+ } _glfwInput;
274
+
275
+
276
+ //------------------------------------------------------------------------
277
+ // Library global data
278
+ //------------------------------------------------------------------------
279
+ GLFWGLOBAL struct {
280
+
281
+ // ========= PLATFORM SPECIFIC PART ======================================
282
+
283
+ Display *Dpy;
284
+ int NumScreens;
285
+ int DefaultScreen;
286
+
287
+ struct {
288
+ int Available;
289
+ int EventBase;
290
+ int ErrorBase;
291
+ } XF86VidMode;
292
+
293
+ struct {
294
+ int Available;
295
+ int EventBase;
296
+ int ErrorBase;
297
+ } XRandR;
298
+
299
+ // Timer data
300
+ struct {
301
+ double Resolution;
302
+ long long t0;
303
+ } Timer;
304
+
305
+ #if defined(_GLFW_DLOPEN_LIBGL)
306
+ struct {
307
+ void *libGL; // dlopen handle for libGL.so
308
+ } Libs;
309
+ #endif
310
+ } _glfwLibrary;
311
+
312
+
313
+ //------------------------------------------------------------------------
314
+ // Thread record (one for each thread)
315
+ //------------------------------------------------------------------------
316
+ typedef struct _GLFWthread_struct _GLFWthread;
317
+
318
+ struct _GLFWthread_struct {
319
+
320
+ // ========= PLATFORM INDEPENDENT MANDATORY PART =========================
321
+
322
+ // Pointer to previous and next threads in linked list
323
+ _GLFWthread *Previous, *Next;
324
+
325
+ // GLFW user side thread information
326
+ GLFWthread ID;
327
+ GLFWthreadfun Function;
328
+
329
+ // ========= PLATFORM SPECIFIC PART ======================================
330
+
331
+ // System side thread information
332
+ #ifdef _GLFW_HAS_PTHREAD
333
+ pthread_t PosixID;
334
+ #endif
335
+
336
+ };
337
+
338
+
339
+ //------------------------------------------------------------------------
340
+ // General thread information
341
+ //------------------------------------------------------------------------
342
+ GLFWGLOBAL struct {
343
+
344
+ // ========= PLATFORM INDEPENDENT MANDATORY PART =========================
345
+
346
+ // Next thread ID to use (increments for every created thread)
347
+ GLFWthread NextID;
348
+
349
+ // First thread in linked list (always the main thread)
350
+ _GLFWthread First;
351
+
352
+ // ========= PLATFORM SPECIFIC PART ======================================
353
+
354
+ // Critical section lock
355
+ #ifdef _GLFW_HAS_PTHREAD
356
+ pthread_mutex_t CriticalSection;
357
+ #endif
358
+
359
+ } _glfwThrd;
360
+
361
+
362
+ //------------------------------------------------------------------------
363
+ // Joystick information & state
364
+ //------------------------------------------------------------------------
365
+ GLFWGLOBAL struct {
366
+ int Present;
367
+ int fd;
368
+ int NumAxes;
369
+ int NumButtons;
370
+ float *Axis;
371
+ unsigned char *Button;
372
+ } _glfwJoy[ GLFW_JOYSTICK_LAST + 1 ];
373
+
374
+
375
+ //========================================================================
376
+ // Macros for encapsulating critical code sections (i.e. making parts
377
+ // of GLFW thread safe)
378
+ //========================================================================
379
+
380
+ // Thread list management
381
+ #ifdef _GLFW_HAS_PTHREAD
382
+ #define ENTER_THREAD_CRITICAL_SECTION \
383
+ pthread_mutex_lock( &_glfwThrd.CriticalSection );
384
+ #define LEAVE_THREAD_CRITICAL_SECTION \
385
+ pthread_mutex_unlock( &_glfwThrd.CriticalSection );
386
+ #else
387
+ #define ENTER_THREAD_CRITICAL_SECTION
388
+ #define LEAVE_THREAD_CRITICAL_SECTION
389
+ #endif
390
+
391
+
392
+ //========================================================================
393
+ // Prototypes for platform specific internal functions
394
+ //========================================================================
395
+
396
+ // Time
397
+ void _glfwInitTimer( void );
398
+
399
+ // Fullscreen support
400
+ int _glfwGetClosestVideoMode( int screen, int *width, int *height, int *rate );
401
+ void _glfwSetVideoModeMODE( int screen, int mode, int rate );
402
+ void _glfwSetVideoMode( int screen, int *width, int *height, int *rate );
403
+
404
+ // Cursor handling
405
+ Cursor _glfwCreateNULLCursor( Display *display, Window root );
406
+
407
+ // Joystick input
408
+ void _glfwInitJoysticks( void );
409
+ void _glfwTerminateJoysticks( void );
410
+
411
+ // Unicode support
412
+ long _glfwKeySym2Unicode( KeySym keysym );
413
+
414
+
415
+ #endif // _platform_h_