Debian Codegraph @

dokidoki-support/luaglfw.c

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
1 //========================================================================cxx . . $ `<file>/dokidoki-support/luaglfw.c`/
2 // GLFW - An OpenGL framework
3 // File: luaglfw.c
4 // Platform: Lua 5.0
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 #include <lauxlib.h>
•32 #include <GLFW/glfw3.h>
33 #include <errno.h>
34 #include <time.h>
35 #include "luaglfw.h"cxx . . $ `<file>/dokidoki-support/luaglfw.h`/
36
•37 static GLFWwindowcxx . . $ GLFWwindow#* windowcxx . . $ window.;
38
39 //************************************************************************
40 //**** Internal type definitions ****
41 //************************************************************************
42
43 struct lua_constantcxx . . $ lua_constant#
44 {
45 char *strcxx . . $ lua_constant#str.;
46 int valuecxx . . $ lua_constant#value.;
47 };
48
49
50 //************************************************************************
51 //**** Handy functions ****
52 //************************************************************************
53
54 // Check the number of arguments on the Lua stack
55 static int badArgscxx . . $ badArgs(6b3c0da94eb57ee2).( lua_Statecxx . . $ lua_State# *L, int n, char const *name )
56 {
57 if( lua_gettopcxx . . $ lua_gettop(e4b172c3fcff213).(L) != n )
58 {
59 lua_settopcxx . . $ lua_settop(9637dd485cf22a1).( L, 0 );
60 lua_pushstringcxx . . $ lua_pushstring(2c01a949aef328b).( L, "Bad arguments passed to function: " );
61 lua_pushstringcxx . . $ lua_pushstring(2c01a949aef328b).( L, name );
62 lua_concatcxx . . $ lua_concat(9637dd485cf22a1).( L, 2 );
63 lua_errorcxx . . $ lua_error(e4b172c3fcff213).( L );
64 return 1;
65 }
66 return 0;
67 }
68
69 // Get a numeric value from a Lua table
70 static void getNumbercxx . . $ getNumber(917ec818e38c6cca).( lua_Statecxx . . $ lua_State# *L, int index, char *key, lua_Numbercxx . . $ lua_Number# *num )
71 {
72 lua_pushstringcxx . . $ lua_pushstring(2c01a949aef328b).( L, key );
73 if( index < 0 ) index --;
74 lua_rawgetcxx . . $ lua_rawget(9637dd485cf22a1).( L, index );
75 if( !lua_isnilcxx . . $ `<external>/15848857005865937740/lua.h:267:9`!( L, -1 ) )
76 {
77 *num = lua_tonumbercxx . . $ lua_tonumber(128e298513b4e6b3).( L, -1 );
78 }
79 lua_removecxx . . $ lua_remove(9637dd485cf22a1).( L, -1 );
80 }
81
82 // Add constants to the table on top of the stack
83 static void addConstantscxx . . $ addConstants(985243bf365338c7).( lua_Statecxx . . $ lua_State# *L, struct lua_constantcxx . . $ lua_constant# *cn )
84 {
85 while( cn->strcxx . . $ lua_constant#str. )
86 {
87 lua_pushstringcxx . . $ lua_pushstring(2c01a949aef328b).( L, cn->strcxx . . $ lua_constant#str. );
88 lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).( L, cn->valuecxx . . $ lua_constant#value. );
89 lua_rawsetcxx . . $ lua_rawset(9637dd485cf22a1).( L, -3 );
90 ++ cn;
91 }
92 }
93
94 // Report error for unsupported functions
95 static void unsupportedFunctioncxx . . $ unsupportedFunction(2c01a949aef328b).( lua_Statecxx . . $ lua_State# *L, char const *name )
96 {
97 lua_settopcxx . . $ lua_settop(9637dd485cf22a1).( L, 0 );
98 lua_pushstringcxx . . $ lua_pushstring(2c01a949aef328b).( L, "Unsupported function: " );
99 lua_pushstringcxx . . $ lua_pushstring(2c01a949aef328b).( L, name );
100 lua_concatcxx . . $ lua_concat(9637dd485cf22a1).( L, 2 );
101 lua_errorcxx . . $ lua_error(e4b172c3fcff213).( L );
102 }
103
104 static void pushVideoModecxx . . $ pushVideoMode(a9eedbf34f06489a).( lua_Statecxx . . $ lua_State# *L, const GLFWvidmodecxx . . $ GLFWvidmode# *mode)
105 {
106 lua_newtablecxx . . $ `<external>/15848857005865937740/lua.h:256:9`!( L );
107 lua_pushstringcxx . . $ lua_pushstring(2c01a949aef328b).( L, "Width" );
•108 lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).( L, mode->widthcxx . . $ GLFWvidmode#width. );
109 lua_rawsetcxx . . $ lua_rawset(9637dd485cf22a1).( L, -3 );
110 lua_pushstringcxx . . $ lua_pushstring(2c01a949aef328b).( L, "Height" );
•111 lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).( L, mode->heightcxx . . $ GLFWvidmode#height. );
112 lua_rawsetcxx . . $ lua_rawset(9637dd485cf22a1).( L, -3 );
113 lua_pushstringcxx . . $ lua_pushstring(2c01a949aef328b).( L, "RedBits" );
•114 lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).( L, mode->redBitscxx . . $ GLFWvidmode#redBits. );
115 lua_rawsetcxx . . $ lua_rawset(9637dd485cf22a1).( L, -3 );
116 lua_pushstringcxx . . $ lua_pushstring(2c01a949aef328b).( L, "GreenBits" );
•117 lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).( L, mode->greenBitscxx . . $ GLFWvidmode#greenBits. );
118 lua_rawsetcxx . . $ lua_rawset(9637dd485cf22a1).( L, -3 );
119 lua_pushstringcxx . . $ lua_pushstring(2c01a949aef328b).( L, "BlueBits" );
•120 lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).( L, mode->blueBitscxx . . $ GLFWvidmode#blueBits. );
121 lua_rawsetcxx . . $ lua_rawset(9637dd485cf22a1).( L, -3 );
122 }
123
124
125 //************************************************************************
126 //*** Callback wrapper functions ****
127 //************************************************************************
128
129 static lua_Statecxx . . $ lua_State# * callback_lua_statecxx . . $ callback_lua_state. = (lua_Statecxx . . $ lua_State# *) 0;
130
131 static const char * windowsize_namecxx . . $ windowsize_name.;
132 static const char * windowclose_namecxx . . $ windowclose_name.;
133 static const char * windowrefresh_namecxx . . $ windowrefresh_name.;
134 static const char * mousebutton_namecxx . . $ mousebutton_name.;
135 static const char * mousepos_namecxx . . $ mousepos_name.;
136 static const char * key_namecxx . . $ key_name.;
137 static const char * char_namecxx . . $ char_name.;
138
139
•140 void luaglfw_windowsizefuncxx . . $ luaglfw_windowsizefun(ff237864df00ddf3).( GLFWwindowcxx . . $ GLFWwindow#* window_dummy, int w, int h )
141 {
142 lua_Statecxx . . $ lua_State# *L = callback_lua_statecxx . . $ callback_lua_state.;
143 if( L == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`! ) return;
144
145 lua_getglobalcxx . . $ `<external>/15848857005865937740/lua.h:277:9`!( L, windowsize_name );
146 if( lua_isfunctioncxx . . $ `<external>/15848857005865937740/lua.h:264:9`!( L, -1 ) )
147 {
148 lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).( L, (lua_Numbercxx . . $ lua_Number#)w );
149 lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).( L, (lua_Numbercxx . . $ lua_Number#)h );
150 lua_pcallcxx . . $ lua_pcall(4c68878629ad9751).( L, 2, 0, 0 );
151 }
152 }
153
•154 void luaglfw_windowclosefuncxx . . $ luaglfw_windowclosefun(a152d69848139f).( GLFWwindowcxx . . $ GLFWwindow#* window_dummy )
155 {
156 lua_Statecxx . . $ lua_State# *L = callback_lua_statecxx . . $ callback_lua_state.;
157 int do_close = 1;
158
•159 if( L != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`! )
160 {
•161 lua_getglobalcxx . . $ `<external>/15848857005865937740/lua.h:277:9`!( L, windowclose_name );
162 if( lua_isfunctioncxx . . $ `<external>/15848857005865937740/lua.h:264:9`!( L, -1 ) )
163 {
164 lua_pcallcxx . . $ lua_pcall(4c68878629ad9751).( L, 0, 1, 0 );
165 do_close = (int) lua_tonumbercxx . . $ lua_tonumber(128e298513b4e6b3).( L, -1 );
166 lua_popcxx . . $ `<external>/15848857005865937740/lua.h:254:9`!( L, 1 );
167 }
168 }
•169
170 glfwSetWindowShouldClosecxx . . $ glfwSetWindowShouldClose(e60342ab10517bce).(windowcxx . . $ window., do_close);
171 }
172
•173 void luaglfw_windowrefreshfuncxx . . $ luaglfw_windowrefreshfun(a152d69848139f).( GLFWwindowcxx . . $ GLFWwindow#* window_dummy )
174 {
175 lua_Statecxx . . $ lua_State# *L = callback_lua_statecxx . . $ callback_lua_state.;
176 if( L == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`! ) return;
177
178 lua_getglobalcxx . . $ `<external>/15848857005865937740/lua.h:277:9`!( L, windowrefresh_name );
179 if( lua_isfunctioncxx . . $ `<external>/15848857005865937740/lua.h:264:9`!( L, -1 ) )
180 {
181 lua_pcallcxx . . $ lua_pcall(4c68878629ad9751).( L, 0, 0, 0 );
182 }
183 }
184
•185 void luaglfw_mousebuttonfuncxx . . $ luaglfw_mousebuttonfun(cec33db5635a2af3).( GLFWwindowcxx . . $ GLFWwindow#* window_dummy, int button, int action, int mods )
186 {
187 lua_Statecxx . . $ lua_State# *L = callback_lua_statecxx . . $ callback_lua_state.;
188 if( L == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`! ) return;
189
190 lua_getglobalcxx . . $ `<external>/15848857005865937740/lua.h:277:9`!( L, mousebutton_name );
191 if( lua_isfunctioncxx . . $ `<external>/15848857005865937740/lua.h:264:9`!( L, -1 ) )
192 {
193 lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).( L, (lua_Numbercxx . . $ lua_Number#)button );
194 lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).( L, (lua_Numbercxx . . $ lua_Number#)action );
195 lua_pcallcxx . . $ lua_pcall(4c68878629ad9751).( L, 2, 0, 0 );
196 }
197 }
198
•199 void luaglfw_mouseposfuncxx . . $ luaglfw_mouseposfun(e4ec71064916c7e6).( GLFWwindowcxx . . $ GLFWwindow#* window_dummy, double x, double y )
200 {
201 lua_Statecxx . . $ lua_State# *L = callback_lua_statecxx . . $ callback_lua_state.;
202 if( L == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`! ) return;
203
204 lua_getglobalcxx . . $ `<external>/15848857005865937740/lua.h:277:9`!( L, mousepos_name );
205 if( lua_isfunctioncxx . . $ `<external>/15848857005865937740/lua.h:264:9`!( L, -1 ) )
206 {
•207 lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).( L, (lua_Numbercxx . . $ lua_Number#)(int)x );
208 lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).( L, (lua_Numbercxx . . $ lua_Number#)(int)y );
209 lua_pcallcxx . . $ lua_pcall(4c68878629ad9751).( L, 2, 0, 0 );
210 }
211 }
212
•213 void luaglfw_keyfuncxx . . $ luaglfw_keyfun(3a546c0a3aac5723).( GLFWwindowcxx . . $ GLFWwindow#* window_dummy, int key, int scancode, int action, int mods )
214 {
215 lua_Statecxx . . $ lua_State# *L = callback_lua_statecxx . . $ callback_lua_state.;
216 if( L == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`! ) return;
217
•218 // Filter out GLFW_REPEAT actions
219 if (action == GLFW_REPEATcxx . . $ `<external>/4379973052512005783/glfw3.h:345:9`!) return;
220
221 lua_getglobalcxx . . $ `<external>/15848857005865937740/lua.h:277:9`!( L, key_name );
222 if( lua_isfunctioncxx . . $ `<external>/15848857005865937740/lua.h:264:9`!( L, -1 ) )
223 {
224 lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).( L, (lua_Numbercxx . . $ lua_Number#)key );
225 lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).( L, (lua_Numbercxx . . $ lua_Number#)action );
226 lua_pcallcxx . . $ lua_pcall(4c68878629ad9751).( L, 2, 0, 0 );
227 }
228 }
229
•230 void luaglfw_charfuncxx . . $ luaglfw_charfun(fba07ce4bf7ff1c0).( GLFWwindowcxx . . $ GLFWwindow#* window_dummy, unsigned int key )
231 {
232 lua_Statecxx . . $ lua_State# *L = callback_lua_statecxx . . $ callback_lua_state.;
233 if( L == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`! ) return;
234
235 lua_getglobalcxx . . $ `<external>/15848857005865937740/lua.h:277:9`!( L, char_name );
236 if( lua_isfunctioncxx . . $ `<external>/15848857005865937740/lua.h:264:9`!( L, -1 ) )
237 {
238 lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).( L, (lua_Numbercxx . . $ lua_Number#)key );
•239 lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).( L, (lua_Numbercxx . . $ lua_Number#)GLFW_PRESScxx . . $ `<external>/4379973052512005783/glfw3.h:338:9`! );
240 lua_pcallcxx . . $ lua_pcall(4c68878629ad9751).( L, 2, 0, 0 );
241 }
242 }
243
244
245
246 //************************************************************************
247 //**** GLFW proxy functions ****
248 //************************************************************************
249
250
251 //========================================================================
252 // Init/termination & version info
253 //========================================================================
254
255 static int glfw_Initcxx . . $ glfw_Init(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
256 {
257 int res;
258 lua_settopcxx . . $ lua_settop(9637dd485cf22a1).( L, 0 );
259 res = glfwInitcxx . . $ glfwInit(b126dc7c1de90089).();
260 lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).( L, (lua_Numbercxx . . $ lua_Number#)res );
261 return 1;
262 }
263
264 static int glfw_Terminatecxx . . $ glfw_Terminate(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
265 {
266 glfwTerminatecxx . . $ glfwTerminate(49f6e7a06ebc5aa8).();
•267 windowcxx . . $ window. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
268 return 0;
269 }
270
271 static int glfw_GetVersioncxx . . $ glfw_GetVersion(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
272 {
273 int major, minor, rev;
274 glfwGetVersioncxx . . $ glfwGetVersion(9bece3db80ddac65).( &major, &minor, &rev );
275 lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).( L, major );
276 lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).( L, minor );
277 lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).( L, rev );
278 return 3;
279 }
280
281
282 //========================================================================
283 // Window handling
284 //========================================================================
285
•286 #define GLFW2_WINDOWcxx . . $ `dokidoki-support/luaglfw.c:286:9`! 0x00010001
287 #define GLFW2_FULLSCREENcxx . . $ `dokidoki-support/luaglfw.c:287:9`! 0x00010002
288
289 static int glfw_OpenWindowcxx . . $ glfw_OpenWindow(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
290 {
291 lua_Numbercxx . . $ lua_Number# w, h, r, g, b, a, depth, stencil, mode;
•292 int res;
293
294 // Check arguments
295 if( badArgscxx . . $ badArgs(6b3c0da94eb57ee2).( L, 9, "OpenWindow" ) ) return 0;
296
•297 // Disallow if a window is already open
298 if (windowcxx . . $ window. != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) return 0;
299
300 // Get all arguments to glfwOpenWindow
301 w = lua_tonumbercxx . . $ lua_tonumber(128e298513b4e6b3).( L, 1 );
302 h = lua_tonumbercxx . . $ lua_tonumber(128e298513b4e6b3).( L, 2 );
303 r = lua_tonumbercxx . . $ lua_tonumber(128e298513b4e6b3).( L, 3 );
304 g = lua_tonumbercxx . . $ lua_tonumber(128e298513b4e6b3).( L, 4 );
305 b = lua_tonumbercxx . . $ lua_tonumber(128e298513b4e6b3).( L, 5 );
306 a = lua_tonumbercxx . . $ lua_tonumber(128e298513b4e6b3).( L, 6 );
307 depth = lua_tonumbercxx . . $ lua_tonumber(128e298513b4e6b3).( L, 7 );
308 stencil = lua_tonumbercxx . . $ lua_tonumber(128e298513b4e6b3).( L, 8 );
309 mode = lua_tonumbercxx . . $ lua_tonumber(128e298513b4e6b3).( L, 9 );
310
•311 // Call glfwCreateWindow
312 lua_settopcxx . . $ lua_settop(9637dd485cf22a1).( L,0 );
•313 glfwWindowHintcxx . . $ glfwWindowHint(3e454b8ccf442868).(GLFW_RED_BITScxx . . $ `<external>/4379973052512005783/glfw3.h:948:9`!, (int)r);
314 glfwWindowHintcxx . . $ glfwWindowHint(3e454b8ccf442868).(GLFW_GREEN_BITScxx . . $ `<external>/4379973052512005783/glfw3.h:953:9`!, (int)g);
315 glfwWindowHintcxx . . $ glfwWindowHint(3e454b8ccf442868).(GLFW_BLUE_BITScxx . . $ `<external>/4379973052512005783/glfw3.h:958:9`!, (int)b);
316 glfwWindowHintcxx . . $ glfwWindowHint(3e454b8ccf442868).(GLFW_ALPHA_BITScxx . . $ `<external>/4379973052512005783/glfw3.h:963:9`!, (int)a);
317 glfwWindowHintcxx . . $ glfwWindowHint(3e454b8ccf442868).(GLFW_DEPTH_BITScxx . . $ `<external>/4379973052512005783/glfw3.h:968:9`!, (int)depth);
318 glfwWindowHintcxx . . $ glfwWindowHint(3e454b8ccf442868).(GLFW_STENCIL_BITScxx . . $ `<external>/4379973052512005783/glfw3.h:973:9`!, (int)stencil);
319
320 GLFWmonitorcxx . . $ GLFWmonitor#* monitor = (mode == GLFW2_FULLSCREENcxx . . $ `dokidoki-support/luaglfw.c:287:9`!) ? glfwGetPrimaryMonitorcxx . . $ glfwGetPrimaryMonitor(e3ad70871832f09f).() : NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
321 windowcxx . . $ window. = glfwCreateWindowcxx . . $ glfwCreateWindow(6697668a8325e482).((int) w, (int)h, "Pax Britannica", monitor, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!);
322 res = (windowcxx . . $ window. == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) ? GL_FALSEcxx . . $ `<external>/11565930711847777359/gl.h:139:9`! : GL_TRUEcxx . . $ `<external>/11565930711847777359/gl.h:140:9`!;
323
324 if (windowcxx . . $ window. != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!)
325 glfwMakeContextCurrentcxx . . $ glfwMakeContextCurrent(a152d69848139f).(windowcxx . . $ window.);
326
327 // Return result
328 lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).( L, (lua_Numbercxx . . $ lua_Number#)res );
329 return 1;
330 }
331
332 static int glfw_OpenWindowHintcxx . . $ glfw_OpenWindowHint(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
333 {
334 lua_Numbercxx . . $ lua_Number# target, hint;
335 if( badArgscxx . . $ badArgs(6b3c0da94eb57ee2).( L, 2, "OpenWindowHint" ) ) return 0;
336 target = lua_tonumbercxx . . $ lua_tonumber(128e298513b4e6b3).( L, 1 );
337 hint = lua_tonumbercxx . . $ lua_tonumber(128e298513b4e6b3).( L, 2 );
338 lua_settopcxx . . $ lua_settop(9637dd485cf22a1).( L, 0 );
•339 glfwWindowHintcxx . . $ glfwWindowHint(3e454b8ccf442868).( (int)target, (int)hint );
340 return 0;
341 }
342
343 static int glfw_CloseWindowcxx . . $ glfw_CloseWindow(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
344 {
•345 if (windowcxx . . $ window. != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!)
346 {
347 glfwDestroyWindowcxx . . $ glfwDestroyWindow(a152d69848139f).(windowcxx . . $ window.);
348 windowcxx . . $ window. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
349 }
350
351 return 0;
352 }
353
354 static int glfw_SetWindowTitlecxx . . $ glfw_SetWindowTitle(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
355 {
356 const char *str;
357 if( badArgscxx . . $ badArgs(6b3c0da94eb57ee2).( L, 1, "SetWindowTitle" ) ) return 0;
•358
359 // Disallow if a window is not open
360 if (windowcxx . . $ window. == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) return 0;
361
362 str = lua_tostringcxx . . $ `<external>/15848857005865937740/lua.h:279:9`!( L, 1 );
363 lua_removecxx . . $ lua_remove(9637dd485cf22a1).( L, 1 );
•364 glfwSetWindowTitlecxx . . $ glfwSetWindowTitle(51288dd650f53003).(windowcxx . . $ window., str);
365 return 0;
366 }
367
368 static int glfw_SetWindowSizecxx . . $ glfw_SetWindowSize(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
369 {
370 lua_Numbercxx . . $ lua_Number# w, h;
371 if( badArgscxx . . $ badArgs(6b3c0da94eb57ee2).( L, 2, "SetWindowSize" ) ) return 0;
•372
373 // Disallow if a window is not open
374 if (windowcxx . . $ window. == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) return 0;
375
376 w = lua_tonumbercxx . . $ lua_tonumber(128e298513b4e6b3).( L, 1 );
377 h = lua_tonumbercxx . . $ lua_tonumber(128e298513b4e6b3).( L, 2 );
378 lua_settopcxx . . $ lua_settop(9637dd485cf22a1).( L, 0 );
•379 glfwSetWindowSizecxx . . $ glfwSetWindowSize(ff237864df00ddf3).(windowcxx . . $ window., (int)w, (int)h);
380 return 0;
381 }
382
383 static int glfw_GetWindowSizecxx . . $ glfw_GetWindowSize(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
384 {
385 int w, h;
•386
387 // Disallow if a window is not open
388 if (windowcxx . . $ window. == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) return 0;
389
390 glfwGetWindowSizecxx . . $ glfwGetWindowSize(2eee6ff90b701f40).(windowcxx . . $ window., &w, &h);
391 lua_settopcxx . . $ lua_settop(9637dd485cf22a1).( L, 0 );
392 lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).( L, (lua_Numbercxx . . $ lua_Number#)w );
393 lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).( L, (lua_Numbercxx . . $ lua_Number#)h );
394 return 2;
395 }
396
397 static int glfw_SetWindowPoscxx . . $ glfw_SetWindowPos(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
398 {
399 lua_Numbercxx . . $ lua_Number# x, y;
400 if( badArgscxx . . $ badArgs(6b3c0da94eb57ee2).( L, 2, "SetWindowPos" ) ) return 0;
•401
402 // Disallow if a window is not open
403 if (windowcxx . . $ window. == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) return 0;
404
405 x = lua_tonumbercxx . . $ lua_tonumber(128e298513b4e6b3).( L, 1 );
406 y = lua_tonumbercxx . . $ lua_tonumber(128e298513b4e6b3).( L, 2 );
407 lua_settopcxx . . $ lua_settop(9637dd485cf22a1).( L, 0 );
•408 glfwSetWindowPoscxx . . $ glfwSetWindowPos(ff237864df00ddf3).(windowcxx . . $ window., (int)x, (int)y);
409 return 0;
410 }
411
412 static int glfw_IconifyWindowcxx . . $ glfw_IconifyWindow(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
413 {
•414 // Disallow if a window is not open
415 if (windowcxx . . $ window. == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) return 0;
416
417 glfwIconifyWindowcxx . . $ glfwIconifyWindow(a152d69848139f).(windowcxx . . $ window.);
418 return 0;
419 }
420
421 static int glfw_RestoreWindowcxx . . $ glfw_RestoreWindow(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
422 {
•423 // Disallow if a window is not open
424 if (windowcxx . . $ window. == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) return 0;
425
426 glfwRestoreWindowcxx . . $ glfwRestoreWindow(a152d69848139f).(windowcxx . . $ window.);
427 return 0;
428 }
429
•430 #define GLFW2_OPENEDcxx . . $ `dokidoki-support/luaglfw.c:430:9`! 0x00020001
431 #define GLFW2_ACCELERATEDcxx . . $ `dokidoki-support/luaglfw.c:431:9`! 0x00020004
432
433 static int glfw_GetWindowParamcxx . . $ glfw_GetWindowParam(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
434 {
435 lua_Numbercxx . . $ lua_Number# n;
436 if( badArgscxx . . $ badArgs(6b3c0da94eb57ee2).( L, 1, "GetWindowParam" ) ) return 0;
•437
438 // Disallow if a window is not open
439 if (windowcxx . . $ window. == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) return 0;
440
441 n = lua_tonumbercxx . . $ lua_tonumber(128e298513b4e6b3).( L, 1 );
442 lua_settopcxx . . $ lua_settop(9637dd485cf22a1).( L, 0 );
•443
444 // Handle special cases
445 switch ((int) n)
446 {
447 case GLFW2_OPENEDcxx . . $ `dokidoki-support/luaglfw.c:430:9`!:
448 n = !glfwWindowShouldClosecxx . . $ glfwWindowShouldClose(847cf08a1abed278).(windowcxx . . $ window.);
449 break;
450 case GLFW2_ACCELERATEDcxx . . $ `dokidoki-support/luaglfw.c:431:9`!:
451 n = GL_TRUEcxx . . $ `<external>/11565930711847777359/gl.h:140:9`!;
452 break;
453 default:
454 n = glfwGetWindowAttribcxx . . $ glfwGetWindowAttrib(ca4dcd9126b1601e).(windowcxx . . $ window., (int)n);
455 break;
456 }
457
458 lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).( L, n );
459 return 1;
460 }
461
462
463
464 //========================================================================
465 // Buffer swapping
466 //========================================================================
467
468 static int glfw_SwapBufferscxx . . $ glfw_SwapBuffers(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
469 {
•470 // Disallow if a window is not open
471 if (windowcxx . . $ window. == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) return 0;
472
473 glfwSwapBufferscxx . . $ glfwSwapBuffers(a152d69848139f).(windowcxx . . $ window.);
474 glfwPollEventscxx . . $ glfwPollEvents(49f6e7a06ebc5aa8).();
475 return 0;
476 }
477
478 static int glfw_SwapIntervalcxx . . $ glfw_SwapInterval(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
479 {
480 lua_Numbercxx . . $ lua_Number# interval;
481 if( badArgscxx . . $ badArgs(6b3c0da94eb57ee2).( L, 1, "SwapInterval" ) ) return 0;
482 interval = lua_tonumbercxx . . $ lua_tonumber(128e298513b4e6b3).( L, 1 );
483 lua_removecxx . . $ lua_remove(9637dd485cf22a1).( L, 1 );
484 glfwSwapIntervalcxx . . $ glfwSwapInterval(d4f767463ce0a6b3).( (int)interval );
485 return 0;
486 }
487
488
489 //========================================================================
490 // Video modes
491 //========================================================================
492
493 static int glfw_GetVideoModescxx . . $ glfw_GetVideoModes(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
494 {
495 int modecount, i;
•496 const GLFWvidmodecxx . . $ GLFWvidmode#* modes = glfwGetVideoModescxx . . $ glfwGetVideoModes(9b590c1c53ae0f1e).(glfwGetPrimaryMonitorcxx . . $ glfwGetPrimaryMonitor(e3ad70871832f09f).(), &modecount);
497
498 lua_newtablecxx . . $ `<external>/15848857005865937740/lua.h:256:9`!( L );
499 for( i = 0; i < modecount; i++ )
500 {
501 pushVideoModecxx . . $ pushVideoMode(a9eedbf34f06489a).( L, &modes[i] );
502 lua_rawseticxx . . $ lua_rawseti(2c6648a7e86590d).( L, -2, i + 1 );
503 }
504
505 return 1;
506 }
507
508 static int glfw_GetDesktopModecxx . . $ glfw_GetDesktopMode(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
509 {
•510 pushVideoModecxx . . $ pushVideoMode(a9eedbf34f06489a).( L, glfwGetVideoModecxx . . $ glfwGetVideoMode(2137532c3b5ca2c5).(glfwGetPrimaryMonitorcxx . . $ glfwGetPrimaryMonitor(e3ad70871832f09f).()) );
511
512 return 1;
513 }
514
515
516 //========================================================================
517 // Event polling/waiting
518 //========================================================================
519
520 static int glfw_PollEventscxx . . $ glfw_PollEvents(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
521 {
522 glfwPollEventscxx . . $ glfwPollEvents(49f6e7a06ebc5aa8).();
523 return 0;
524 }
525
526 static int glfw_WaitEventscxx . . $ glfw_WaitEvents(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
527 {
528 glfwWaitEventscxx . . $ glfwWaitEvents(49f6e7a06ebc5aa8).();
529 return 0;
530 }
531
532
533 //========================================================================
534 // Key and mouse input
535 //========================================================================
536
537 static int glfw_GetKeycxx . . $ glfw_GetKey(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
538 {
539 int n = 0;
540
541 if( badArgscxx . . $ badArgs(6b3c0da94eb57ee2).( L, 1, "GetKey" ) ) return 0;
542
•543 // Disallow if a window is not open
544 if (windowcxx . . $ window. == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) return 0;
545
546 switch( lua_typecxx . . $ lua_type(95e3aa3a3b4bb934).( L, 1 ) )
547 {
548 case LUA_TSTRINGcxx . . $ `<external>/15848857005865937740/lua.h:78:9`!:
549 n = (lua_tostringcxx . . $ `<external>/15848857005865937740/lua.h:279:9`!(L,1)[0]);
550 break;
551
552 case LUA_TNUMBERcxx . . $ `<external>/15848857005865937740/lua.h:77:9`!:
553 n = lua_tonumbercxx . . $ lua_tonumber(128e298513b4e6b3).(L,1);
554 break;
555 }
556
557 lua_settopcxx . . $ lua_settop(9637dd485cf22a1).( L, 0 );
•558 n = glfwGetKeycxx . . $ glfwGetKey(ca4dcd9126b1601e).(windowcxx . . $ window., n);
559 lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).( L, n );
560 return 1;
561 }
562
563 static int glfw_GetMouseButtoncxx . . $ glfw_GetMouseButton(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
564 {
565 lua_Numbercxx . . $ lua_Number# n;
566 if( badArgscxx . . $ badArgs(6b3c0da94eb57ee2).( L, 1, "GetMouseButton" ) ) return 0;
•567
568 // Disallow if a window is not open
569 if (windowcxx . . $ window. == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) return 0;
570
571 n = lua_tonumbercxx . . $ lua_tonumber(128e298513b4e6b3).( L, 1 );
572 lua_settopcxx . . $ lua_settop(9637dd485cf22a1).( L, 0 );
•573 lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).( L, glfwGetMouseButtoncxx . . $ glfwGetMouseButton(ca4dcd9126b1601e).(windowcxx . . $ window., (int)n) );
574 return 1;
575 }
576
577 static int glfw_GetMousePoscxx . . $ glfw_GetMousePos(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
578 {
•579 double x, y;
580
581 // Disallow if a window is not open
582 if (windowcxx . . $ window. == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) return 0;
583
584 glfwGetCursorPoscxx . . $ glfwGetCursorPos(184b047df2fafbc7).(windowcxx . . $ window., &x, &y);
585 lua_settopcxx . . $ lua_settop(9637dd485cf22a1).( L, 0 );
586 lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).( L, (lua_Numbercxx . . $ lua_Number#)x );
587 lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).( L, (lua_Numbercxx . . $ lua_Number#)y );
588 return 2;
589 }
590
591 static int glfw_SetMousePoscxx . . $ glfw_SetMousePos(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
592 {
593 lua_Numbercxx . . $ lua_Number# x, y;
594 if( badArgscxx . . $ badArgs(6b3c0da94eb57ee2).( L, 2, "SetMousePos" ) ) return 0;
•595
596 // Disallow if a window is not open
597 if (windowcxx . . $ window. == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) return 0;
598
599 x = lua_tonumbercxx . . $ lua_tonumber(128e298513b4e6b3).( L, 1 );
600 y = lua_tonumbercxx . . $ lua_tonumber(128e298513b4e6b3).( L, 2 );
601 lua_settopcxx . . $ lua_settop(9637dd485cf22a1).( L, 0 );
•602 glfwSetCursorPoscxx . . $ glfwSetCursorPos(e4ec71064916c7e6).(windowcxx . . $ window., (double)x, (double)y);
603 return 0;
604 }
605
606 static int glfw_GetMouseWheelcxx . . $ glfw_GetMouseWheel(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
607 {
•608 unsupportedFunctioncxx . . $ unsupportedFunction(2c01a949aef328b).(L, "GetMouseWheel");
609 return 0;
610 }
611
612 static int glfw_SetMouseWheelcxx . . $ glfw_SetMouseWheel(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
613 {
•614 unsupportedFunctioncxx . . $ unsupportedFunction(2c01a949aef328b).(L, "SetMouseWheel");
615 return 0;
616 }
617
618
619 //========================================================================
620 // Joystick input
621 //========================================================================
622
•623 #define GLFW2_PRESENTcxx . . $ `dokidoki-support/luaglfw.c:623:9`! 0x00050001
624 #define GLFW2_AXEScxx . . $ `dokidoki-support/luaglfw.c:624:9`! 0x00050002
625 #define GLFW2_BUTTONScxx . . $ `dokidoki-support/luaglfw.c:625:9`! 0x00050003
626
627 static int glfw_GetJoystickParamcxx . . $ glfw_GetJoystickParam(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
628 {
629 lua_Numbercxx . . $ lua_Number# joy, param;
630 int res;
631 if( badArgscxx . . $ badArgs(6b3c0da94eb57ee2).( L, 2, "GetJoystickParam" ) ) return 0;
632 joy = lua_tonumbercxx . . $ lua_tonumber(128e298513b4e6b3).( L, 1 );
633 param = lua_tonumbercxx . . $ lua_tonumber(128e298513b4e6b3).( L, 2 );
634 lua_settopcxx . . $ lua_settop(9637dd485cf22a1).( L, 0 );
•635
636 switch((int) param)
637 {
638 case GLFW2_PRESENTcxx . . $ `dokidoki-support/luaglfw.c:623:9`!:
639 res = glfwJoystickPresentcxx . . $ glfwJoystickPresent(7864480464b09eea).(joy);
640 break;
641 case GLFW2_AXEScxx . . $ `dokidoki-support/luaglfw.c:624:9`!:
642 glfwGetJoystickAxescxx . . $ glfwGetJoystickAxes(77de141b8596d258).(joy, &res);
643 break;
644 case GLFW2_BUTTONScxx . . $ `dokidoki-support/luaglfw.c:625:9`!:
645 glfwGetJoystickButtonscxx . . $ glfwGetJoystickButtons(8710b0eb3dc45d41).(joy, &res);
646 break;
647 default:
648 res = 0;
649 }
650
651 lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).( L, (lua_Numbercxx . . $ lua_Number#)res );
652 return 1;
653 }
654
655 static int glfw_GetJoystickPoscxx . . $ glfw_GetJoystickPos(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
656 {
657 int joy, numaxes, res, i;
658
659 // Get arguments
660 if( badArgscxx . . $ badArgs(6b3c0da94eb57ee2).( L, 2, "GetJoystickPos" ) ) return 0;
661 joy = (int)lua_tonumbercxx . . $ lua_tonumber(128e298513b4e6b3).( L, 1 );
662 numaxes = (int)lua_tonumbercxx . . $ lua_tonumber(128e298513b4e6b3).( L, 2 );
663 lua_settopcxx . . $ lua_settop(9637dd485cf22a1).( L, 0 );
664 if( numaxes < 1 ) return 0;
665
666 // Call GLFW funciton
•667 const float* pos = glfwGetJoystickAxescxx . . $ glfwGetJoystickAxes(77de141b8596d258).(joy, &res);
668 if (res > numaxes) res = numaxes;
669
670 // Create result array
671 lua_newtablecxx . . $ `<external>/15848857005865937740/lua.h:256:9`!( L );
672 for( i = 0; i < res; ++ i )
673 {
674 lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).( L, (lua_Numbercxx . . $ lua_Number#)(i+1) );
675 lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).( L, pos[ i ] );
676 lua_rawsetcxx . . $ lua_rawset(9637dd485cf22a1).( L, -3 );
677 }
678
679 return 1;
680 }
681
682 static int glfw_GetJoystickButtonscxx . . $ glfw_GetJoystickButtons(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
683 {
684 int joy, numbuttons, res, i;
685
686 // Get arguments
687 if( badArgscxx . . $ badArgs(6b3c0da94eb57ee2).( L, 2, "GetJoystickButtons" ) ) return 0;
688 joy = (int)lua_tonumbercxx . . $ lua_tonumber(128e298513b4e6b3).( L, 1 );
689 numbuttons = (int)lua_tonumbercxx . . $ lua_tonumber(128e298513b4e6b3).( L, 2 );
690 lua_settopcxx . . $ lua_settop(9637dd485cf22a1).( L, 0 );
691 if( numbuttons < 1 ) return 0;
692
693 // Call GLFW funciton
•694 const unsigned char* buttons = glfwGetJoystickButtonscxx . . $ glfwGetJoystickButtons(8710b0eb3dc45d41).(joy, &res);
695 if (res > numbuttons) res = numbuttons;
696
697 // Create result array
698 lua_newtablecxx . . $ `<external>/15848857005865937740/lua.h:256:9`!( L );
699 for( i = 0; i < res; ++ i )
700 {
701 lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).( L, (lua_Numbercxx . . $ lua_Number#)(i+1) );
702 lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).( L, (lua_Numbercxx . . $ lua_Number#)buttons[ i ] );
703 lua_rawsetcxx . . $ lua_rawset(9637dd485cf22a1).( L, -3 );
704 }
705
706 return 1;
707 }
708
709
710 //========================================================================
711 // Timing
712 //========================================================================
713
714 static int glfw_GetTimecxx . . $ glfw_GetTime(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
715 {
716 lua_Numbercxx . . $ lua_Number# t;
717 t = glfwGetTimecxx . . $ glfwGetTime(31fa7155c10fdd13).();
718 lua_settopcxx . . $ lua_settop(9637dd485cf22a1).( L, 0 );
719 lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).( L, t );
720 return 1;
721 }
722
723 static int glfw_SetTimecxx . . $ glfw_SetTime(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
724 {
725 lua_Numbercxx . . $ lua_Number# t;
726 if ( badArgscxx . . $ badArgs(6b3c0da94eb57ee2).( L, 1, "SetTime" ) ) return 0;
727 t = lua_tonumbercxx . . $ lua_tonumber(128e298513b4e6b3).( L, 1 );
728 lua_settopcxx . . $ lua_settop(9637dd485cf22a1).( L, 0 );
729 glfwSetTimecxx . . $ glfwSetTime(ba8836b59fb42830).( (double)t );
730 return 0;
731 }
732
•733 #define ONE_BILLIONcxx . . $ `dokidoki-support/luaglfw.c:733:9`! 1000000000
734
735 static int glfw_Sleepcxx . . $ glfw_Sleep(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
736 {
•737 // This function is no longer implemented by glfw, but is required for
738 // pax-britannica, so replace it with a nanosleep implementation.
739 double t;
740 if ( badArgscxx . . $ badArgs(6b3c0da94eb57ee2).( L, 1, "Sleep" ) ) return 0;
•741 t = (double) lua_tonumbercxx . . $ lua_tonumber(128e298513b4e6b3).( L, 1 );
742 lua_settopcxx . . $ lua_settop(9637dd485cf22a1).( L, 0 );
•743
744 // Cap negative sleep durations
745 if (t < 0) t = 0;
746
747 // Perform the sleep
748 struct timespeccxx . . $ timespec# req;
749 req.tv_seccxx . . $ timespec#tv_sec. = (time_tcxx . . $ time_t#) t;
750 req.tv_nseccxx . . $ timespec#tv_nsec. = (long) ((t - (time_tcxx . . $ time_t#) t) * ONE_BILLIONcxx . . $ `dokidoki-support/luaglfw.c:733:9`!);
751
752 if (req.tv_nseccxx . . $ timespec#tv_nsec. >= ONE_BILLIONcxx . . $ `dokidoki-support/luaglfw.c:733:9`!)
753 {
754 req.tv_seccxx . . $ timespec#tv_sec.++;
755 req.tv_nseccxx . . $ timespec#tv_nsec. = 0;
756 }
757 else if (req.tv_nseccxx . . $ timespec#tv_nsec. < 0)
758 {
759 req.tv_nseccxx . . $ timespec#tv_nsec. = 0;
760 }
761
762 while (nanosleepcxx . . $ nanosleep(645c6fc2576d4126).(&req, &req) == -1 && errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! == EINTRcxx . . $ `<external>/8987895939074593727/errno-base.h:8:9`!)
763 ;
764
765 return 0;
766 }
767
768
769 //========================================================================
770 // Threading support (not possible in Lua)
771 //========================================================================
772
773 static int glfw_CreateThreadcxx . . $ glfw_CreateThread(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
774 {
775 unsupportedFunctioncxx . . $ unsupportedFunction(2c01a949aef328b).( L, "CreateThread" );
776 return 0;
777 }
778
779 static int glfw_DestroyThreadcxx . . $ glfw_DestroyThread(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
780 {
781 unsupportedFunctioncxx . . $ unsupportedFunction(2c01a949aef328b).( L, "DestroyThread" );
782 return 0;
783 }
784
785 static int glfw_WaitThreadcxx . . $ glfw_WaitThread(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
786 {
787 unsupportedFunctioncxx . . $ unsupportedFunction(2c01a949aef328b).( L, "WaitThread" );
788 return 0;
789 }
790
791 static int glfw_GetThreadIDcxx . . $ glfw_GetThreadID(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
792 {
793 unsupportedFunctioncxx . . $ unsupportedFunction(2c01a949aef328b).( L, "GetThreadID" );
794 return 0;
795 }
796
797 static int glfw_CreateMutexcxx . . $ glfw_CreateMutex(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
798 {
799 unsupportedFunctioncxx . . $ unsupportedFunction(2c01a949aef328b).( L, "CreateMutex" );
800 return 0;
801 }
802
803 static int glfw_DestroyMutexcxx . . $ glfw_DestroyMutex(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
804 {
805 unsupportedFunctioncxx . . $ unsupportedFunction(2c01a949aef328b).( L, "DestroyMutex" );
806 return 0;
807 }
808
809 static int glfw_LockMutexcxx . . $ glfw_LockMutex(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
810 {
811 unsupportedFunctioncxx . . $ unsupportedFunction(2c01a949aef328b).( L, "LockMutex" );
812 return 0;
813 }
814
815 static int glfw_UnlockMutexcxx . . $ glfw_UnlockMutex(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
816 {
817 unsupportedFunctioncxx . . $ unsupportedFunction(2c01a949aef328b).( L, "UnlockMutex" );
818 return 0;
819 }
820
821 static int glfw_CreateCondcxx . . $ glfw_CreateCond(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
822 {
823 unsupportedFunctioncxx . . $ unsupportedFunction(2c01a949aef328b).( L, "CreateCond" );
824 return 0;
825 }
826
827 static int glfw_DestroyCondcxx . . $ glfw_DestroyCond(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
828 {
829 unsupportedFunctioncxx . . $ unsupportedFunction(2c01a949aef328b).( L, "DestroyCond" );
830 return 0;
831 }
832
833 static int glfw_WaitCondcxx . . $ glfw_WaitCond(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
834 {
835 unsupportedFunctioncxx . . $ unsupportedFunction(2c01a949aef328b).( L, "WaitCond" );
836 return 0;
837 }
838
839 static int glfw_SignalCondcxx . . $ glfw_SignalCond(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
840 {
841 unsupportedFunctioncxx . . $ unsupportedFunction(2c01a949aef328b).( L, "SignalCond" );
842 return 0;
843 }
844
845 static int glfw_BroadcastCondcxx . . $ glfw_BroadcastCond(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
846 {
847 unsupportedFunctioncxx . . $ unsupportedFunction(2c01a949aef328b).( L, "BroadcastCond" );
848 return 0;
849 }
850
851 static int glfw_GetNumberOfProcessorscxx . . $ glfw_GetNumberOfProcessors(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
852 {
•853 unsupportedFunctioncxx . . $ unsupportedFunction(2c01a949aef328b).( L, "GetNumberOfProcessors" );
854 return 0;
855 }
856
857
858 //========================================================================
859 // Extension handling
860 //========================================================================
861
862 static int glfw_GetGLVersioncxx . . $ glfw_GetGLVersion(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
863 {
•864 // GLFW3 requires an open window now, so most uses of this will fail anyway
865 unsupportedFunctioncxx . . $ unsupportedFunction(2c01a949aef328b).( L, "GetGLVersion" );
866 return 0;
867 }
868
869 static int glfw_ExtensionSupportedcxx . . $ glfw_ExtensionSupported(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
870 {
871 const char *str;
872 int res;
873 if( badArgscxx . . $ badArgs(6b3c0da94eb57ee2).( L, 1, "ExtensionSupported" ) ) return 0;
874 str = lua_tostringcxx . . $ `<external>/15848857005865937740/lua.h:279:9`!( L, 1 );
875 lua_settopcxx . . $ lua_settop(9637dd485cf22a1).( L, 0 );
876 res = glfwExtensionSupportedcxx . . $ glfwExtensionSupported(5c4306d8553b3696).( str );
877 lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).( L, (lua_Numbercxx . . $ lua_Number#)res );
878 return 1;
879 }
880
881
882 //========================================================================
883 // Enable/Disable
884 //========================================================================
885
886 static int glfw_Enablecxx . . $ glfw_Enable(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
887 {
•888 unsupportedFunctioncxx . . $ unsupportedFunction(2c01a949aef328b).( L, "Enable" );
889 return 0;
890 }
891
892 static int glfw_Disablecxx . . $ glfw_Disable(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
893 {
•894 unsupportedFunctioncxx . . $ unsupportedFunction(2c01a949aef328b).( L, "Disable" );
895 return 0;
896 }
897
898
899 //========================================================================
900 // Image/texture I/O support
901 //========================================================================
902
903 static int glfw_ReadImagecxx . . $ glfw_ReadImage(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
904 {
905 unsupportedFunctioncxx . . $ unsupportedFunction(2c01a949aef328b).( L, "ReadImage" );
906 return 0;
907 }
908
909 static int glfw_FreeImagecxx . . $ glfw_FreeImage(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
910 {
911 unsupportedFunctioncxx . . $ unsupportedFunction(2c01a949aef328b).( L, "FreeImage" );
912 return 0;
913 }
914
915 static int glfw_LoadTexture2Dcxx . . $ glfw_LoadTexture2D(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
916 {
•917 unsupportedFunctioncxx . . $ unsupportedFunction(2c01a949aef328b).( L, "LoadTexture2D" );
918 return 0;
919 }
920
921
922 //========================================================================
923 // Callback function management
924 //========================================================================
925
926 static int glfw_SetWindowSizeCallbackcxx . . $ glfw_SetWindowSizeCallback(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
927 {
•928 // Disallow if a window is not open
929 if (windowcxx . . $ window. == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) return 0;
930
931 GLFWwindowsizefuncxx . . $ GLFWwindowsizefun# fun = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
932 if( lua_isstringcxx . . $ lua_isstring(95e3aa3a3b4bb934).( L, 1 ) )
933 {
934 windowsize_namecxx . . $ windowsize_name. = lua_tostringcxx . . $ `<external>/15848857005865937740/lua.h:279:9`!( L, 1 );
935 fun = luaglfw_windowsizefuncxx . . $ luaglfw_windowsizefun(ff237864df00ddf3).;
936 }
•937 glfwSetWindowSizeCallbackcxx . . $ glfwSetWindowSizeCallback(6173971a63777b0a).( windowcxx . . $ window., fun );
938 return 0;
939 }
940
941 static int glfw_SetWindowCloseCallbackcxx . . $ glfw_SetWindowCloseCallback(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
942 {
•943 // Disallow if a window is not open
944 if (windowcxx . . $ window. == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) return 0;
945
946 GLFWwindowclosefuncxx . . $ GLFWwindowclosefun# fun = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
947 if( lua_isstringcxx . . $ lua_isstring(95e3aa3a3b4bb934).( L, 1 ) )
948 {
949 windowclose_namecxx . . $ windowclose_name. = lua_tostringcxx . . $ `<external>/15848857005865937740/lua.h:279:9`!( L, 1 );
950 fun = luaglfw_windowclosefuncxx . . $ luaglfw_windowclosefun(a152d69848139f).;
951 }
•952 glfwSetWindowCloseCallbackcxx . . $ glfwSetWindowCloseCallback(3e2aaed4637cbfd3).( windowcxx . . $ window., fun );
953 return 0;
954 }
955
956 static int glfw_SetWindowRefreshCallbackcxx . . $ glfw_SetWindowRefreshCallback(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
957 {
•958 // Disallow if a window is not open
959 if (windowcxx . . $ window. == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) return 0;
960
961 GLFWwindowrefreshfuncxx . . $ GLFWwindowrefreshfun# fun = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
962 if( lua_isstringcxx . . $ lua_isstring(95e3aa3a3b4bb934).( L, 1 ) )
963 {
964 windowrefresh_namecxx . . $ windowrefresh_name. = lua_tostringcxx . . $ `<external>/15848857005865937740/lua.h:279:9`!( L, 1 );
965 fun = luaglfw_windowrefreshfuncxx . . $ luaglfw_windowrefreshfun(a152d69848139f).;
966 }
•967 glfwSetWindowRefreshCallbackcxx . . $ glfwSetWindowRefreshCallback(3e2aaed4637cbfd3).( windowcxx . . $ window., fun );
968 return 0;
969 }
970
971 static int glfw_SetMouseButtonCallbackcxx . . $ glfw_SetMouseButtonCallback(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
972 {
•973 // Disallow if a window is not open
974 if (windowcxx . . $ window. == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) return 0;
975
976 GLFWmousebuttonfuncxx . . $ GLFWmousebuttonfun# fun = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
977 if( lua_isstringcxx . . $ lua_isstring(95e3aa3a3b4bb934).( L, 1 ) )
978 {
979 mousebutton_namecxx . . $ mousebutton_name. = lua_tostringcxx . . $ `<external>/15848857005865937740/lua.h:279:9`!( L, 1 );
980 fun = luaglfw_mousebuttonfuncxx . . $ luaglfw_mousebuttonfun(cec33db5635a2af3).;
981 }
•982 glfwSetMouseButtonCallbackcxx . . $ glfwSetMouseButtonCallback(f6f64ccb85aadf45).( windowcxx . . $ window., fun );
983 return 0;
984 }
985
986 static int glfw_SetMousePosCallbackcxx . . $ glfw_SetMousePosCallback(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
987 {
•988 // Disallow if a window is not open
989 if (windowcxx . . $ window. == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) return 0;
990
991 GLFWcursorposfuncxx . . $ GLFWcursorposfun# fun = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
992 if( lua_isstringcxx . . $ lua_isstring(95e3aa3a3b4bb934).( L, 1 ) )
993 {
994 mousepos_namecxx . . $ mousepos_name. = lua_tostringcxx . . $ `<external>/15848857005865937740/lua.h:279:9`!( L, 1 );
995 fun = luaglfw_mouseposfuncxx . . $ luaglfw_mouseposfun(e4ec71064916c7e6).;
996 }
•997 glfwSetCursorPosCallbackcxx . . $ glfwSetCursorPosCallback(39a2ae7646b93f30).( windowcxx . . $ window., fun );
998 return 0;
999 }
1000
1001 static int glfw_SetMouseWheelCallbackcxx . . $ glfw_SetMouseWheelCallback(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
1002 {
•1003 unsupportedFunctioncxx . . $ unsupportedFunction(2c01a949aef328b).( L, "SetMouseWheelCallback" );
1004 return 0;
1005 }
1006
1007 static int glfw_SetKeyCallbackcxx . . $ glfw_SetKeyCallback(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
1008 {
•1009 // Disallow if a window is not open
1010 if (windowcxx . . $ window. == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) return 0;
1011
1012 GLFWkeyfuncxx . . $ GLFWkeyfun# fun = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
1013 if( lua_isstringcxx . . $ lua_isstring(95e3aa3a3b4bb934).( L, 1 ) )
1014 {
1015 key_namecxx . . $ key_name. = lua_tostringcxx . . $ `<external>/15848857005865937740/lua.h:279:9`!( L, 1 );
1016 fun = luaglfw_keyfuncxx . . $ luaglfw_keyfun(3a546c0a3aac5723).;
1017 }
•1018 glfwSetKeyCallbackcxx . . $ glfwSetKeyCallback(abd1d9b503b49211).( windowcxx . . $ window., fun );
1019 return 0;
1020 }
1021
1022 static int glfw_SetCharCallbackcxx . . $ glfw_SetCharCallback(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
1023 {
•1024 // Disallow if a window is not open
1025 if (windowcxx . . $ window. == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) return 0;
1026
1027 GLFWcharfuncxx . . $ GLFWcharfun# fun = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
1028 if( lua_isstringcxx . . $ lua_isstring(95e3aa3a3b4bb934).( L, 1 ) )
1029 {
1030 char_namecxx . . $ char_name. = lua_tostringcxx . . $ `<external>/15848857005865937740/lua.h:279:9`!( L, 1 );
1031 fun = luaglfw_charfuncxx . . $ luaglfw_charfun(fba07ce4bf7ff1c0).;
1032 }
•1033 glfwSetCharCallbackcxx . . $ glfwSetCharCallback(e1db7dbb1173147f).( windowcxx . . $ window., fun );
1034 return 0;
1035 }
1036
1037
1038
1039 //************************************************************************
1040 //**** LUA Library Registration ****
1041 //************************************************************************
1042
1043 // GLFW constants are stored in the global Lua table "glfw"
1044 static struct lua_constantcxx . . $ lua_constant# glfw_constantscxx . . $ glfw_constants.[] =
1045 {
1046 // GL constants (GL_TRUE/GL_FALSE)
1047 { "TRUE", GL_TRUEcxx . . $ `<external>/11565930711847777359/gl.h:140:9`! },
1048 { "FALSE", GL_FALSEcxx . . $ `<external>/11565930711847777359/gl.h:139:9`! },
1049
1050 // GLFW version
1051 { "VERSION_MAJOR", GLFW_VERSION_MAJORcxx . . $ `<external>/4379973052512005783/glfw3.h:287:9`! },
1052 { "VERSION_MINOR", GLFW_VERSION_MINORcxx . . $ `<external>/4379973052512005783/glfw3.h:294:9`! },
1053 { "VERSION_REVISION", GLFW_VERSION_REVISIONcxx . . $ `<external>/4379973052512005783/glfw3.h:301:9`! },
1054
1055 // Key and button state/action definitions
1056 { "PRESS", GLFW_PRESScxx . . $ `<external>/4379973052512005783/glfw3.h:338:9`! },
1057 { "RELEASE", GLFW_RELEASEcxx . . $ `<external>/4379973052512005783/glfw3.h:331:9`! },
1058
1059 // Keyboard key definitions
1060 { "KEY_SPACE", GLFW_KEY_SPACEcxx . . $ `<external>/4379973052512005783/glfw3.h:396:9`! },
•1061 { "KEY_ESC", GLFW_KEY_ESCAPEcxx . . $ `<external>/4379973052512005783/glfw3.h:448:9`! },
1062 { "KEY_F1", GLFW_KEY_F1cxx . . $ `<external>/4379973052512005783/glfw3.h:467:9`! },
1063 { "KEY_F2", GLFW_KEY_F2cxx . . $ `<external>/4379973052512005783/glfw3.h:468:9`! },
1064 { "KEY_F3", GLFW_KEY_F3cxx . . $ `<external>/4379973052512005783/glfw3.h:469:9`! },
1065 { "KEY_F4", GLFW_KEY_F4cxx . . $ `<external>/4379973052512005783/glfw3.h:470:9`! },
1066 { "KEY_F5", GLFW_KEY_F5cxx . . $ `<external>/4379973052512005783/glfw3.h:471:9`! },
1067 { "KEY_F6", GLFW_KEY_F6cxx . . $ `<external>/4379973052512005783/glfw3.h:472:9`! },
1068 { "KEY_F7", GLFW_KEY_F7cxx . . $ `<external>/4379973052512005783/glfw3.h:473:9`! },
1069 { "KEY_F8", GLFW_KEY_F8cxx . . $ `<external>/4379973052512005783/glfw3.h:474:9`! },
1070 { "KEY_F9", GLFW_KEY_F9cxx . . $ `<external>/4379973052512005783/glfw3.h:475:9`! },
1071 { "KEY_F10", GLFW_KEY_F10cxx . . $ `<external>/4379973052512005783/glfw3.h:476:9`! },
1072 { "KEY_F11", GLFW_KEY_F11cxx . . $ `<external>/4379973052512005783/glfw3.h:477:9`! },
1073 { "KEY_F12", GLFW_KEY_F12cxx . . $ `<external>/4379973052512005783/glfw3.h:478:9`! },
1074 { "KEY_F13", GLFW_KEY_F13cxx . . $ `<external>/4379973052512005783/glfw3.h:479:9`! },
1075 { "KEY_F14", GLFW_KEY_F14cxx . . $ `<external>/4379973052512005783/glfw3.h:480:9`! },
1076 { "KEY_F15", GLFW_KEY_F15cxx . . $ `<external>/4379973052512005783/glfw3.h:481:9`! },
1077 { "KEY_F16", GLFW_KEY_F16cxx . . $ `<external>/4379973052512005783/glfw3.h:482:9`! },
1078 { "KEY_F17", GLFW_KEY_F17cxx . . $ `<external>/4379973052512005783/glfw3.h:483:9`! },
1079 { "KEY_F18", GLFW_KEY_F18cxx . . $ `<external>/4379973052512005783/glfw3.h:484:9`! },
1080 { "KEY_F19", GLFW_KEY_F19cxx . . $ `<external>/4379973052512005783/glfw3.h:485:9`! },
1081 { "KEY_F20", GLFW_KEY_F20cxx . . $ `<external>/4379973052512005783/glfw3.h:486:9`! },
1082 { "KEY_F21", GLFW_KEY_F21cxx . . $ `<external>/4379973052512005783/glfw3.h:487:9`! },
1083 { "KEY_F22", GLFW_KEY_F22cxx . . $ `<external>/4379973052512005783/glfw3.h:488:9`! },
1084 { "KEY_F23", GLFW_KEY_F23cxx . . $ `<external>/4379973052512005783/glfw3.h:489:9`! },
1085 { "KEY_F24", GLFW_KEY_F24cxx . . $ `<external>/4379973052512005783/glfw3.h:490:9`! },
1086 { "KEY_F25", GLFW_KEY_F25cxx . . $ `<external>/4379973052512005783/glfw3.h:491:9`! },
1087 { "KEY_UP", GLFW_KEY_UPcxx . . $ `<external>/4379973052512005783/glfw3.h:457:9`! },
1088 { "KEY_DOWN", GLFW_KEY_DOWNcxx . . $ `<external>/4379973052512005783/glfw3.h:456:9`! },
1089 { "KEY_LEFT", GLFW_KEY_LEFTcxx . . $ `<external>/4379973052512005783/glfw3.h:455:9`! },
1090 { "KEY_RIGHT", GLFW_KEY_RIGHTcxx . . $ `<external>/4379973052512005783/glfw3.h:454:9`! },
•1091 { "KEY_LSHIFT", GLFW_KEY_LEFT_SHIFTcxx . . $ `<external>/4379973052512005783/glfw3.h:509:9`! },
1092 { "KEY_RSHIFT", GLFW_KEY_RIGHT_SHIFTcxx . . $ `<external>/4379973052512005783/glfw3.h:513:9`! },
1093 { "KEY_LCTRL", GLFW_KEY_LEFT_CONTROLcxx . . $ `<external>/4379973052512005783/glfw3.h:510:9`! },
1094 { "KEY_RCTRL", GLFW_KEY_RIGHT_CONTROLcxx . . $ `<external>/4379973052512005783/glfw3.h:514:9`! },
1095 { "KEY_LALT", GLFW_KEY_LEFT_ALTcxx . . $ `<external>/4379973052512005783/glfw3.h:511:9`! },
1096 { "KEY_RALT", GLFW_KEY_RIGHT_ALTcxx . . $ `<external>/4379973052512005783/glfw3.h:515:9`! },
1097 { "KEY_TAB", GLFW_KEY_TABcxx . . $ `<external>/4379973052512005783/glfw3.h:450:9`! },
1098 { "KEY_ENTER", GLFW_KEY_ENTERcxx . . $ `<external>/4379973052512005783/glfw3.h:449:9`! },
1099 { "KEY_BACKSPACE", GLFW_KEY_BACKSPACEcxx . . $ `<external>/4379973052512005783/glfw3.h:451:9`! },
1100 { "KEY_INSERT", GLFW_KEY_INSERTcxx . . $ `<external>/4379973052512005783/glfw3.h:452:9`! },
•1101 { "KEY_DEL", GLFW_KEY_DELETEcxx . . $ `<external>/4379973052512005783/glfw3.h:453:9`! },
1102 { "KEY_PAGEUP", GLFW_KEY_PAGE_UPcxx . . $ `<external>/4379973052512005783/glfw3.h:458:9`! },
1103 { "KEY_PAGEDOWN", GLFW_KEY_PAGE_DOWNcxx . . $ `<external>/4379973052512005783/glfw3.h:459:9`! },
1104 { "KEY_HOME", GLFW_KEY_HOMEcxx . . $ `<external>/4379973052512005783/glfw3.h:460:9`! },
1105 { "KEY_END", GLFW_KEY_ENDcxx . . $ `<external>/4379973052512005783/glfw3.h:461:9`! },
1106 { "KEY_KP_0", GLFW_KEY_KP_0cxx . . $ `<external>/4379973052512005783/glfw3.h:492:9`! },
1107 { "KEY_KP_1", GLFW_KEY_KP_1cxx . . $ `<external>/4379973052512005783/glfw3.h:493:9`! },
1108 { "KEY_KP_2", GLFW_KEY_KP_2cxx . . $ `<external>/4379973052512005783/glfw3.h:494:9`! },
1109 { "KEY_KP_3", GLFW_KEY_KP_3cxx . . $ `<external>/4379973052512005783/glfw3.h:495:9`! },
1110 { "KEY_KP_4", GLFW_KEY_KP_4cxx . . $ `<external>/4379973052512005783/glfw3.h:496:9`! },
1111 { "KEY_KP_5", GLFW_KEY_KP_5cxx . . $ `<external>/4379973052512005783/glfw3.h:497:9`! },
1112 { "KEY_KP_6", GLFW_KEY_KP_6cxx . . $ `<external>/4379973052512005783/glfw3.h:498:9`! },
1113 { "KEY_KP_7", GLFW_KEY_KP_7cxx . . $ `<external>/4379973052512005783/glfw3.h:499:9`! },
1114 { "KEY_KP_8", GLFW_KEY_KP_8cxx . . $ `<external>/4379973052512005783/glfw3.h:500:9`! },
1115 { "KEY_KP_9", GLFW_KEY_KP_9cxx . . $ `<external>/4379973052512005783/glfw3.h:501:9`! },
1116 { "KEY_KP_DIVIDE", GLFW_KEY_KP_DIVIDEcxx . . $ `<external>/4379973052512005783/glfw3.h:503:9`! },
1117 { "KEY_KP_MULTIPLY", GLFW_KEY_KP_MULTIPLYcxx . . $ `<external>/4379973052512005783/glfw3.h:504:9`! },
1118 { "KEY_KP_SUBTRACT", GLFW_KEY_KP_SUBTRACTcxx . . $ `<external>/4379973052512005783/glfw3.h:505:9`! },
1119 { "KEY_KP_ADD", GLFW_KEY_KP_ADDcxx . . $ `<external>/4379973052512005783/glfw3.h:506:9`! },
1120 { "KEY_KP_DECIMAL", GLFW_KEY_KP_DECIMALcxx . . $ `<external>/4379973052512005783/glfw3.h:502:9`! },
1121 { "KEY_KP_EQUAL", GLFW_KEY_KP_EQUALcxx . . $ `<external>/4379973052512005783/glfw3.h:508:9`! },
1122 { "KEY_KP_ENTER", GLFW_KEY_KP_ENTERcxx . . $ `<external>/4379973052512005783/glfw3.h:507:9`! },
1123 { "KEY_LAST", GLFW_KEY_LASTcxx . . $ `<external>/4379973052512005783/glfw3.h:519:9`! },
1124
1125 // Mouse button definitions
1126 { "MOUSE_BUTTON_1", GLFW_MOUSE_BUTTON_1cxx . . $ `<external>/4379973052512005783/glfw3.h:573:9`! },
1127 { "MOUSE_BUTTON_2", GLFW_MOUSE_BUTTON_2cxx . . $ `<external>/4379973052512005783/glfw3.h:574:9`! },
1128 { "MOUSE_BUTTON_3", GLFW_MOUSE_BUTTON_3cxx . . $ `<external>/4379973052512005783/glfw3.h:575:9`! },
1129 { "MOUSE_BUTTON_4", GLFW_MOUSE_BUTTON_4cxx . . $ `<external>/4379973052512005783/glfw3.h:576:9`! },
1130 { "MOUSE_BUTTON_5", GLFW_MOUSE_BUTTON_5cxx . . $ `<external>/4379973052512005783/glfw3.h:577:9`! },
1131 { "MOUSE_BUTTON_6", GLFW_MOUSE_BUTTON_6cxx . . $ `<external>/4379973052512005783/glfw3.h:578:9`! },
1132 { "MOUSE_BUTTON_7", GLFW_MOUSE_BUTTON_7cxx . . $ `<external>/4379973052512005783/glfw3.h:579:9`! },
1133 { "MOUSE_BUTTON_8", GLFW_MOUSE_BUTTON_8cxx . . $ `<external>/4379973052512005783/glfw3.h:580:9`! },
1134 { "MOUSE_BUTTON_LAST", GLFW_MOUSE_BUTTON_LASTcxx . . $ `<external>/4379973052512005783/glfw3.h:581:9`! },
1135
1136 // Mouse button aliases
1137 { "MOUSE_BUTTON_LEFT", GLFW_MOUSE_BUTTON_LEFTcxx . . $ `<external>/4379973052512005783/glfw3.h:582:9`! },
1138 { "MOUSE_BUTTON_RIGHT", GLFW_MOUSE_BUTTON_RIGHTcxx . . $ `<external>/4379973052512005783/glfw3.h:583:9`! },
1139 { "MOUSE_BUTTON_MIDDLE", GLFW_MOUSE_BUTTON_MIDDLEcxx . . $ `<external>/4379973052512005783/glfw3.h:584:9`! },
1140
1141 // Joystick identifiers
1142 { "JOYSTICK_1", GLFW_JOYSTICK_1cxx . . $ `<external>/4379973052512005783/glfw3.h:594:9`! },
1143 { "JOYSTICK_2", GLFW_JOYSTICK_2cxx . . $ `<external>/4379973052512005783/glfw3.h:595:9`! },
1144 { "JOYSTICK_3", GLFW_JOYSTICK_3cxx . . $ `<external>/4379973052512005783/glfw3.h:596:9`! },
1145 { "JOYSTICK_4", GLFW_JOYSTICK_4cxx . . $ `<external>/4379973052512005783/glfw3.h:597:9`! },
1146 { "JOYSTICK_5", GLFW_JOYSTICK_5cxx . . $ `<external>/4379973052512005783/glfw3.h:598:9`! },
1147 { "JOYSTICK_6", GLFW_JOYSTICK_6cxx . . $ `<external>/4379973052512005783/glfw3.h:599:9`! },
1148 { "JOYSTICK_7", GLFW_JOYSTICK_7cxx . . $ `<external>/4379973052512005783/glfw3.h:600:9`! },
1149 { "JOYSTICK_8", GLFW_JOYSTICK_8cxx . . $ `<external>/4379973052512005783/glfw3.h:601:9`! },
1150 { "JOYSTICK_9", GLFW_JOYSTICK_9cxx . . $ `<external>/4379973052512005783/glfw3.h:602:9`! },
1151 { "JOYSTICK_10", GLFW_JOYSTICK_10cxx . . $ `<external>/4379973052512005783/glfw3.h:603:9`! },
1152 { "JOYSTICK_11", GLFW_JOYSTICK_11cxx . . $ `<external>/4379973052512005783/glfw3.h:604:9`! },
1153 { "JOYSTICK_12", GLFW_JOYSTICK_12cxx . . $ `<external>/4379973052512005783/glfw3.h:605:9`! },
1154 { "JOYSTICK_13", GLFW_JOYSTICK_13cxx . . $ `<external>/4379973052512005783/glfw3.h:606:9`! },
1155 { "JOYSTICK_14", GLFW_JOYSTICK_14cxx . . $ `<external>/4379973052512005783/glfw3.h:607:9`! },
1156 { "JOYSTICK_15", GLFW_JOYSTICK_15cxx . . $ `<external>/4379973052512005783/glfw3.h:608:9`! },
1157 { "JOYSTICK_16", GLFW_JOYSTICK_16cxx . . $ `<external>/4379973052512005783/glfw3.h:609:9`! },
1158 { "JOYSTICK_LAST", GLFW_JOYSTICK_LASTcxx . . $ `<external>/4379973052512005783/glfw3.h:610:9`! },
1159
1160 // glfwOpenWindow modes
•1161 { "WINDOW", GLFW2_WINDOWcxx . . $ `dokidoki-support/luaglfw.c:286:9`! },
1162 { "FULLSCREEN", GLFW2_FULLSCREENcxx . . $ `dokidoki-support/luaglfw.c:287:9`! },
1163
1164 // glfwGetWindowParam tokens
•1165 { "OPENED", GLFW2_OPENEDcxx . . $ `dokidoki-support/luaglfw.c:430:9`! },
1166 { "ACTIVE", GLFW_FOCUSEDcxx . . $ `<external>/4379973052512005783/glfw3.h:859:9`! },
1167 { "ICONIFIED", GLFW_ICONIFIEDcxx . . $ `<external>/4379973052512005783/glfw3.h:864:9`! },
•1168 { "ACCELERATED", GLFW2_ACCELERATEDcxx . . $ `dokidoki-support/luaglfw.c:431:9`! },
1169 { "RED_BITS", GLFW_RED_BITScxx . . $ `<external>/4379973052512005783/glfw3.h:948:9`! },
1170 { "GREEN_BITS", GLFW_GREEN_BITScxx . . $ `<external>/4379973052512005783/glfw3.h:953:9`! },
1171 { "BLUE_BITS", GLFW_BLUE_BITScxx . . $ `<external>/4379973052512005783/glfw3.h:958:9`! },
1172 { "ALPHA_BITS", GLFW_ALPHA_BITScxx . . $ `<external>/4379973052512005783/glfw3.h:963:9`! },
1173 { "DEPTH_BITS", GLFW_DEPTH_BITScxx . . $ `<external>/4379973052512005783/glfw3.h:968:9`! },
1174 { "STENCIL_BITS", GLFW_STENCIL_BITScxx . . $ `<external>/4379973052512005783/glfw3.h:973:9`! },
1175
1176 // Constants for glfwGetWindowParam and glfwOpenWindowHint
1177 { "REFRESH_RATE", GLFW_REFRESH_RATEcxx . . $ `<external>/4379973052512005783/glfw3.h:1018:9`! },
1178 { "ACCUM_RED_BITS", GLFW_ACCUM_RED_BITScxx . . $ `<external>/4379973052512005783/glfw3.h:978:9`! },
1179 { "ACCUM_GREEN_BITS", GLFW_ACCUM_GREEN_BITScxx . . $ `<external>/4379973052512005783/glfw3.h:983:9`! },
1180 { "ACCUM_BLUE_BITS", GLFW_ACCUM_BLUE_BITScxx . . $ `<external>/4379973052512005783/glfw3.h:988:9`! },
1181 { "ACCUM_ALPHA_BITS", GLFW_ACCUM_ALPHA_BITScxx . . $ `<external>/4379973052512005783/glfw3.h:993:9`! },
1182 { "AUX_BUFFERS", GLFW_AUX_BUFFERScxx . . $ `<external>/4379973052512005783/glfw3.h:998:9`! },
1183 { "STEREO", GLFW_STEREOcxx . . $ `<external>/4379973052512005783/glfw3.h:1003:9`! },
1184
1185 // glfwGetJoystickParam tokens
•1186 { "PRESENT", GLFW2_PRESENTcxx . . $ `dokidoki-support/luaglfw.c:623:9`! },
1187 { "AXES", GLFW2_AXEScxx . . $ `dokidoki-support/luaglfw.c:624:9`! },
1188 { "BUTTONS", GLFW2_BUTTONScxx . . $ `dokidoki-support/luaglfw.c:625:9`! },
1189
1190 { NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, 0 }
1191 };
1192
1193
1194 // Library functions to register
1195 static const luaL_regcxx . . $ `<external>/18095755238171912061/lauxlib.h:170:9`! glfwlibcxx . . $ glfwlib.[] = {
1196 { "Init", glfw_Initcxx . . $ glfw_Init(e4b172c3fcff213). },
1197 { "Terminate", glfw_Terminatecxx . . $ glfw_Terminate(e4b172c3fcff213). },
1198 { "GetVersion", glfw_GetVersioncxx . . $ glfw_GetVersion(e4b172c3fcff213). },
1199 { "OpenWindow", glfw_OpenWindowcxx . . $ glfw_OpenWindow(e4b172c3fcff213). },
1200 { "OpenWindowHint", glfw_OpenWindowHintcxx . . $ glfw_OpenWindowHint(e4b172c3fcff213). },
1201 { "CloseWindow", glfw_CloseWindowcxx . . $ glfw_CloseWindow(e4b172c3fcff213). },
1202 { "SetWindowTitle", glfw_SetWindowTitlecxx . . $ glfw_SetWindowTitle(e4b172c3fcff213). },
1203 { "SetWindowSize", glfw_SetWindowSizecxx . . $ glfw_SetWindowSize(e4b172c3fcff213). },
1204 { "GetWindowSize", glfw_GetWindowSizecxx . . $ glfw_GetWindowSize(e4b172c3fcff213). },
1205 { "SetWindowPos", glfw_SetWindowPoscxx . . $ glfw_SetWindowPos(e4b172c3fcff213). },
1206 { "IconifyWindow", glfw_IconifyWindowcxx . . $ glfw_IconifyWindow(e4b172c3fcff213). },
1207 { "RestoreWindow", glfw_RestoreWindowcxx . . $ glfw_RestoreWindow(e4b172c3fcff213). },
1208 { "GetWindowParam", glfw_GetWindowParamcxx . . $ glfw_GetWindowParam(e4b172c3fcff213). },
1209 { "SwapBuffers", glfw_SwapBufferscxx . . $ glfw_SwapBuffers(e4b172c3fcff213). },
1210 { "SwapInterval", glfw_SwapIntervalcxx . . $ glfw_SwapInterval(e4b172c3fcff213). },
1211 { "GetVideoModes", glfw_GetVideoModescxx . . $ glfw_GetVideoModes(e4b172c3fcff213). },
1212 { "GetDesktopMode", glfw_GetDesktopModecxx . . $ glfw_GetDesktopMode(e4b172c3fcff213). },
1213 { "PollEvents", glfw_PollEventscxx . . $ glfw_PollEvents(e4b172c3fcff213). },
1214 { "WaitEvents", glfw_WaitEventscxx . . $ glfw_WaitEvents(e4b172c3fcff213). },
1215 { "GetKey", glfw_GetKeycxx . . $ glfw_GetKey(e4b172c3fcff213). },
1216 { "GetMouseButton", glfw_GetMouseButtoncxx . . $ glfw_GetMouseButton(e4b172c3fcff213). },
1217 { "GetMousePos", glfw_GetMousePoscxx . . $ glfw_GetMousePos(e4b172c3fcff213). },
1218 { "SetMousePos", glfw_SetMousePoscxx . . $ glfw_SetMousePos(e4b172c3fcff213). },
1219 { "GetMouseWheel", glfw_GetMouseWheelcxx . . $ glfw_GetMouseWheel(e4b172c3fcff213). },
1220 { "SetMouseWheel", glfw_SetMouseWheelcxx . . $ glfw_SetMouseWheel(e4b172c3fcff213). },
1221 { "GetJoystickParam", glfw_GetJoystickParamcxx . . $ glfw_GetJoystickParam(e4b172c3fcff213). },
1222 { "GetJoystickPos", glfw_GetJoystickPoscxx . . $ glfw_GetJoystickPos(e4b172c3fcff213). },
1223 { "GetJoystickButtons", glfw_GetJoystickButtonscxx . . $ glfw_GetJoystickButtons(e4b172c3fcff213). },
1224 { "GetTime", glfw_GetTimecxx . . $ glfw_GetTime(e4b172c3fcff213). },
1225 { "SetTime", glfw_SetTimecxx . . $ glfw_SetTime(e4b172c3fcff213). },
1226 { "Sleep", glfw_Sleepcxx . . $ glfw_Sleep(e4b172c3fcff213). },
1227 { "GetGLVersion", glfw_GetGLVersioncxx . . $ glfw_GetGLVersion(e4b172c3fcff213). },
1228 { "ExtensionSupported", glfw_ExtensionSupportedcxx . . $ glfw_ExtensionSupported(e4b172c3fcff213). },
1229 { "CreateThread", glfw_CreateThreadcxx . . $ glfw_CreateThread(e4b172c3fcff213). },
1230 { "DestroyThread", glfw_DestroyThreadcxx . . $ glfw_DestroyThread(e4b172c3fcff213). },
1231 { "WaitThread", glfw_WaitThreadcxx . . $ glfw_WaitThread(e4b172c3fcff213). },
1232 { "GetThreadID", glfw_GetThreadIDcxx . . $ glfw_GetThreadID(e4b172c3fcff213). },
1233 { "CreateMutex", glfw_CreateMutexcxx . . $ glfw_CreateMutex(e4b172c3fcff213). },
1234 { "DestroyMutex", glfw_DestroyMutexcxx . . $ glfw_DestroyMutex(e4b172c3fcff213). },
1235 { "LockMutex", glfw_LockMutexcxx . . $ glfw_LockMutex(e4b172c3fcff213). },
1236 { "UnlockMutex", glfw_UnlockMutexcxx . . $ glfw_UnlockMutex(e4b172c3fcff213). },
1237 { "CreateCond", glfw_CreateCondcxx . . $ glfw_CreateCond(e4b172c3fcff213). },
1238 { "DestroyCond", glfw_DestroyCondcxx . . $ glfw_DestroyCond(e4b172c3fcff213). },
1239 { "WaitCond", glfw_WaitCondcxx . . $ glfw_WaitCond(e4b172c3fcff213). },
1240 { "SignalCond", glfw_SignalCondcxx . . $ glfw_SignalCond(e4b172c3fcff213). },
1241 { "BroadcastCond", glfw_BroadcastCondcxx . . $ glfw_BroadcastCond(e4b172c3fcff213). },
1242 { "GetNumberOfProcessors", glfw_GetNumberOfProcessorscxx . . $ glfw_GetNumberOfProcessors(e4b172c3fcff213). },
1243 { "Enable", glfw_Enablecxx . . $ glfw_Enable(e4b172c3fcff213). },
1244 { "Disable", glfw_Disablecxx . . $ glfw_Disable(e4b172c3fcff213). },
1245 { "ReadImage", glfw_ReadImagecxx . . $ glfw_ReadImage(e4b172c3fcff213). },
1246 { "FreeImage", glfw_FreeImagecxx . . $ glfw_FreeImage(e4b172c3fcff213). },
1247 { "LoadTexture2D", glfw_LoadTexture2Dcxx . . $ glfw_LoadTexture2D(e4b172c3fcff213). },
1248 { "SetWindowSizeCallback", glfw_SetWindowSizeCallbackcxx . . $ glfw_SetWindowSizeCallback(e4b172c3fcff213). },
1249 { "SetWindowCloseCallback", glfw_SetWindowCloseCallbackcxx . . $ glfw_SetWindowCloseCallback(e4b172c3fcff213). },
1250 { "SetWindowRefreshCallback", glfw_SetWindowRefreshCallbackcxx . . $ glfw_SetWindowRefreshCallback(e4b172c3fcff213). },
1251 { "SetMouseButtonCallback", glfw_SetMouseButtonCallbackcxx . . $ glfw_SetMouseButtonCallback(e4b172c3fcff213). },
1252 { "SetMousePosCallback", glfw_SetMousePosCallbackcxx . . $ glfw_SetMousePosCallback(e4b172c3fcff213). },
1253 { "SetMouseWheelCallback", glfw_SetMouseWheelCallbackcxx . . $ glfw_SetMouseWheelCallback(e4b172c3fcff213). },
1254 { "SetKeyCallback", glfw_SetKeyCallbackcxx . . $ glfw_SetKeyCallback(e4b172c3fcff213). },
1255 { "SetCharCallback", glfw_SetCharCallbackcxx . . $ glfw_SetCharCallback(e4b172c3fcff213). },
1256 { NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`! }
1257 };
1258
1259
1260
1261 int luaopen_glfwcxx . . $ luaopen_glfw(e4b172c3fcff213).( lua_Statecxx . . $ lua_State# *L )
1262 {
1263 // Store GLFW functions in "glfw" table
1264 luaL_openlibcxx . . $ luaL_openlib(bd96f0990c536604).( L, "glfw", glfwlibcxx . . $ glfwlib., 0 );
1265
1266 // Store GLFW constants in "glfw" table
1267 lua_pushstringcxx . . $ lua_pushstring(2c01a949aef328b).( L, "glfw" );
1268 lua_gettablecxx . . $ lua_gettable(9637dd485cf22a1).( L, LUA_GLOBALSINDEXcxx . . $ `<external>/15848857005865937740/lua.h:38:9`! );
1269 addConstantscxx . . $ addConstants(985243bf365338c7).( L, glfw_constantscxx . . $ glfw_constants. );
1270 lua_settopcxx . . $ lua_settop(9637dd485cf22a1).( L, 0 );
1271
1272 // Remember Lua state for callback functions
1273 callback_lua_statecxx . . $ callback_lua_state. = L;
1274
1275 return 0;
1276 }