ruby-glfw 0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +1 -0
- data/README.API +73 -0
- data/Rakefile +120 -0
- data/examples/boing.rb +519 -0
- data/examples/gears.rb +327 -0
- data/examples/keytest.rb +117 -0
- data/examples/listmodes.rb +20 -0
- data/examples/mipmaps.rb +104 -0
- data/examples/mipmaps.tga +0 -0
- data/examples/particles.rb +837 -0
- data/examples/pong3d.rb +741 -0
- data/examples/pong3d_field.tga +0 -0
- data/examples/pong3d_instr.tga +0 -0
- data/examples/pong3d_menu.tga +0 -0
- data/examples/pong3d_title.tga +0 -0
- data/examples/pong3d_winner1.tga +0 -0
- data/examples/pong3d_winner2.tga +0 -0
- data/examples/splitview.rb +432 -0
- data/examples/triangle.rb +89 -0
- data/examples/wave.rb +294 -0
- data/ext/glfw/glfw.c +1094 -0
- data/ext/glfw/mkrf_conf.rb +70 -0
- data/glfw-src/Makefile +220 -0
- data/glfw-src/compile.ami +61 -0
- data/glfw-src/compile.bat +217 -0
- data/glfw-src/compile.sh +607 -0
- data/glfw-src/docs/Makefile +57 -0
- data/glfw-src/docs/Reference.pdf +0 -0
- data/glfw-src/docs/UsersGuide.pdf +0 -0
- data/glfw-src/docs/cleanup.bat +22 -0
- data/glfw-src/docs/glfwdoc.sty +80 -0
- data/glfw-src/docs/glfwrm.tex +3034 -0
- data/glfw-src/docs/glfwug.tex +2024 -0
- data/glfw-src/docs/readme.txt +80 -0
- data/glfw-src/examples/Makefile.amigaos.gcc +70 -0
- data/glfw-src/examples/Makefile.amigaos.vbcc +70 -0
- data/glfw-src/examples/Makefile.dos.djgpp +71 -0
- data/glfw-src/examples/Makefile.macosx.gcc +96 -0
- data/glfw-src/examples/Makefile.win32.bcc +75 -0
- data/glfw-src/examples/Makefile.win32.cross-mgw +79 -0
- data/glfw-src/examples/Makefile.win32.cygwin +79 -0
- data/glfw-src/examples/Makefile.win32.lcc +74 -0
- data/glfw-src/examples/Makefile.win32.mgw +75 -0
- data/glfw-src/examples/Makefile.win32.msvc +74 -0
- data/glfw-src/examples/Makefile.win32.ow +74 -0
- data/glfw-src/examples/Makefile.win32.pellesc +74 -0
- data/glfw-src/examples/Makefile.x11.in +54 -0
- data/glfw-src/examples/boing.c +606 -0
- data/glfw-src/examples/bundle.sh +46 -0
- data/glfw-src/examples/gears.c +382 -0
- data/glfw-src/examples/keytest.c +264 -0
- data/glfw-src/examples/listmodes.c +48 -0
- data/glfw-src/examples/mipmaps.c +126 -0
- data/glfw-src/examples/mipmaps.tga +0 -0
- data/glfw-src/examples/mtbench.c +301 -0
- data/glfw-src/examples/mthello.c +48 -0
- data/glfw-src/examples/particles.c +1148 -0
- data/glfw-src/examples/pong3d.c +839 -0
- data/glfw-src/examples/pong3d_field.tga +0 -0
- data/glfw-src/examples/pong3d_instr.tga +0 -0
- data/glfw-src/examples/pong3d_menu.tga +0 -0
- data/glfw-src/examples/pong3d_title.tga +0 -0
- data/glfw-src/examples/pong3d_winner1.tga +0 -0
- data/glfw-src/examples/pong3d_winner2.tga +0 -0
- data/glfw-src/examples/splitview.c +506 -0
- data/glfw-src/examples/triangle.c +108 -0
- data/glfw-src/examples/wave.c +397 -0
- data/glfw-src/images/opengl.gif +0 -0
- data/glfw-src/images/osicert.gif +0 -0
- data/glfw-src/include/GL/glfw.h +486 -0
- data/glfw-src/lib/amigaos/Makefile.amigaos.gcc +128 -0
- data/glfw-src/lib/amigaos/Makefile.amigaos.vbcc +128 -0
- data/glfw-src/lib/amigaos/SDI_compiler.h +94 -0
- data/glfw-src/lib/amigaos/amigaos_enable.c +51 -0
- data/glfw-src/lib/amigaos/amigaos_fullscreen.c +319 -0
- data/glfw-src/lib/amigaos/amigaos_glext.c +61 -0
- data/glfw-src/lib/amigaos/amigaos_init.c +284 -0
- data/glfw-src/lib/amigaos/amigaos_joystick.c +359 -0
- data/glfw-src/lib/amigaos/amigaos_thread.c +494 -0
- data/glfw-src/lib/amigaos/amigaos_time.c +206 -0
- data/glfw-src/lib/amigaos/amigaos_window.c +830 -0
- data/glfw-src/lib/amigaos/platform.h +337 -0
- data/glfw-src/lib/dos/Makefile.dos.djgpp +146 -0
- data/glfw-src/lib/dos/dos_enable.c +51 -0
- data/glfw-src/lib/dos/dos_events.c +173 -0
- data/glfw-src/lib/dos/dos_fullscreen.c +101 -0
- data/glfw-src/lib/dos/dos_glext.c +59 -0
- data/glfw-src/lib/dos/dos_init.c +105 -0
- data/glfw-src/lib/dos/dos_irq.s +246 -0
- data/glfw-src/lib/dos/dos_joystick.c +94 -0
- data/glfw-src/lib/dos/dos_keyboard.c +694 -0
- data/glfw-src/lib/dos/dos_mouse.c +337 -0
- data/glfw-src/lib/dos/dos_thread.c +267 -0
- data/glfw-src/lib/dos/dos_time.c +309 -0
- data/glfw-src/lib/dos/dos_window.c +563 -0
- data/glfw-src/lib/dos/platform.h +341 -0
- data/glfw-src/lib/enable.c +295 -0
- data/glfw-src/lib/fullscreen.c +95 -0
- data/glfw-src/lib/glext.c +201 -0
- data/glfw-src/lib/image.c +629 -0
- data/glfw-src/lib/init.c +108 -0
- data/glfw-src/lib/input.c +280 -0
- data/glfw-src/lib/internal.h +210 -0
- data/glfw-src/lib/joystick.c +101 -0
- data/glfw-src/lib/macosx/Makefile.macosx.gcc +172 -0
- data/glfw-src/lib/macosx/Makefile.macosx.gcc.universal +166 -0
- data/glfw-src/lib/macosx/libglfw.pc.in +11 -0
- data/glfw-src/lib/macosx/macosx_enable.c +42 -0
- data/glfw-src/lib/macosx/macosx_fullscreen.c +126 -0
- data/glfw-src/lib/macosx/macosx_glext.c +52 -0
- data/glfw-src/lib/macosx/macosx_init.c +194 -0
- data/glfw-src/lib/macosx/macosx_joystick.c +50 -0
- data/glfw-src/lib/macosx/macosx_thread.c +414 -0
- data/glfw-src/lib/macosx/macosx_time.c +112 -0
- data/glfw-src/lib/macosx/macosx_window.c +1279 -0
- data/glfw-src/lib/macosx/platform.h +349 -0
- data/glfw-src/lib/stream.c +194 -0
- data/glfw-src/lib/tga.c +405 -0
- data/glfw-src/lib/thread.c +340 -0
- data/glfw-src/lib/time.c +83 -0
- data/glfw-src/lib/win32/Makefile.win32.bcc +265 -0
- data/glfw-src/lib/win32/Makefile.win32.cross-mgw +274 -0
- data/glfw-src/lib/win32/Makefile.win32.cygwin +279 -0
- data/glfw-src/lib/win32/Makefile.win32.lcc +246 -0
- data/glfw-src/lib/win32/Makefile.win32.mgw +243 -0
- data/glfw-src/lib/win32/Makefile.win32.msvc +242 -0
- data/glfw-src/lib/win32/Makefile.win32.ow +242 -0
- data/glfw-src/lib/win32/Makefile.win32.pellesc +242 -0
- data/glfw-src/lib/win32/glfwdll.def +67 -0
- data/glfw-src/lib/win32/glfwdll_mgw1.def +67 -0
- data/glfw-src/lib/win32/glfwdll_mgw2.def +67 -0
- data/glfw-src/lib/win32/glfwdll_pellesc.def +65 -0
- data/glfw-src/lib/win32/libglfw.pc.in +11 -0
- data/glfw-src/lib/win32/platform.h +474 -0
- data/glfw-src/lib/win32/win32_dllmain.c +60 -0
- data/glfw-src/lib/win32/win32_enable.c +155 -0
- data/glfw-src/lib/win32/win32_fullscreen.c +317 -0
- data/glfw-src/lib/win32/win32_glext.c +85 -0
- data/glfw-src/lib/win32/win32_init.c +356 -0
- data/glfw-src/lib/win32/win32_joystick.c +234 -0
- data/glfw-src/lib/win32/win32_thread.c +511 -0
- data/glfw-src/lib/win32/win32_time.c +146 -0
- data/glfw-src/lib/win32/win32_window.c +1714 -0
- data/glfw-src/lib/window.c +727 -0
- data/glfw-src/lib/x11/Makefile.x11.in +243 -0
- data/glfw-src/lib/x11/platform.h +415 -0
- data/glfw-src/lib/x11/x11_enable.c +51 -0
- data/glfw-src/lib/x11/x11_fullscreen.c +524 -0
- data/glfw-src/lib/x11/x11_glext.c +69 -0
- data/glfw-src/lib/x11/x11_init.c +275 -0
- data/glfw-src/lib/x11/x11_joystick.c +371 -0
- data/glfw-src/lib/x11/x11_keysym2unicode.c +902 -0
- data/glfw-src/lib/x11/x11_thread.c +507 -0
- data/glfw-src/lib/x11/x11_time.c +154 -0
- data/glfw-src/lib/x11/x11_window.c +1746 -0
- data/glfw-src/license.txt +21 -0
- data/glfw-src/readme.html +927 -0
- data/glfw-src/support/d/examples/Makefile +59 -0
- data/glfw-src/support/d/examples/boing.d +610 -0
- data/glfw-src/support/d/examples/gears.d +379 -0
- data/glfw-src/support/d/examples/keytest.d +272 -0
- data/glfw-src/support/d/examples/listmodes.d +48 -0
- data/glfw-src/support/d/examples/mipmaps.d +126 -0
- data/glfw-src/support/d/examples/mtbench.d +304 -0
- data/glfw-src/support/d/examples/mthello.d +54 -0
- data/glfw-src/support/d/examples/particles.d +1150 -0
- data/glfw-src/support/d/examples/pong3d.d +840 -0
- data/glfw-src/support/d/examples/splitview.d +486 -0
- data/glfw-src/support/d/examples/triangle.d +108 -0
- data/glfw-src/support/d/examples/wave.d +400 -0
- data/glfw-src/support/d/imports/gl.d +4539 -0
- data/glfw-src/support/d/imports/glfw.d +349 -0
- data/glfw-src/support/d/imports/glu.d +328 -0
- data/glfw-src/support/d/lib/glfwdll.def +64 -0
- data/glfw-src/support/d/lib/glu32.def +56 -0
- data/glfw-src/support/d/lib/makefile +12 -0
- data/glfw-src/support/d/lib/opengl32.def +372 -0
- data/glfw-src/support/d/readme.html +83 -0
- data/glfw-src/support/delphi/examples/Triangle.dpr +105 -0
- data/glfw-src/support/delphi/lib/glfw.pas +437 -0
- data/glfw-src/support/delphi/readme.html +97 -0
- data/glfw-src/support/lua/examples/gears.lua +383 -0
- data/glfw-src/support/lua/examples/test1.lua +68 -0
- data/glfw-src/support/lua/readme.html +128 -0
- data/glfw-src/support/lua/src/luaglfw.c +1179 -0
- data/glfw-src/support/lua/src/luaglfw.h +48 -0
- data/glfw-src/support/lua/src/runlua.c +82 -0
- data/glfw-src/support/masm/examples/fpc.mac +47 -0
- data/glfw-src/support/masm/examples/makeit.bat +66 -0
- data/glfw-src/support/masm/examples/triangle.asm +232 -0
- data/glfw-src/support/masm/include/glfw.inc +326 -0
- data/glfw-src/support/masm/include/glu32.inc +55 -0
- data/glfw-src/support/masm/include/opengl32.inc +372 -0
- data/glfw-src/support/masm/lib/glfwdll.lib +0 -0
- data/glfw-src/support/masm/readme.html +170 -0
- data/glfw-src/support/msvc80/GLFW.sln +26 -0
- data/glfw-src/support/msvc80/GLFW.vcproj +257 -0
- data/glfw-src/support/msvc80/GLFWDLL.vcproj +287 -0
- data/glfw-src/support/visualbasic/bindings/glfw.bas +320 -0
- data/glfw-src/support/visualbasic/bindings/glu32.bas +284 -0
- data/glfw-src/support/visualbasic/bindings/opengl32.bas +999 -0
- data/glfw-src/support/visualbasic/examples/Triangle.bas +101 -0
- data/glfw-src/support/visualbasic/readme.html +164 -0
- data/website/index.html +84 -0
- data/website/style.css +110 -0
- metadata +301 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
//========================================================================
|
|
2
|
+
// GLFW - An OpenGL framework
|
|
3
|
+
// File: win32_glext.c
|
|
4
|
+
// Platform: Windows
|
|
5
|
+
// API version: 2.6
|
|
6
|
+
// WWW: http://glfw.sourceforge.net
|
|
7
|
+
//------------------------------------------------------------------------
|
|
8
|
+
// Copyright (c) 2002-2006 Camilla Berglund
|
|
9
|
+
//
|
|
10
|
+
// This software is provided 'as-is', without any express or implied
|
|
11
|
+
// warranty. In no event will the authors be held liable for any damages
|
|
12
|
+
// arising from the use of this software.
|
|
13
|
+
//
|
|
14
|
+
// Permission is granted to anyone to use this software for any purpose,
|
|
15
|
+
// including commercial applications, and to alter it and redistribute it
|
|
16
|
+
// freely, subject to the following restrictions:
|
|
17
|
+
//
|
|
18
|
+
// 1. The origin of this software must not be misrepresented; you must not
|
|
19
|
+
// claim that you wrote the original software. If you use this software
|
|
20
|
+
// in a product, an acknowledgment in the product documentation would
|
|
21
|
+
// be appreciated but is not required.
|
|
22
|
+
//
|
|
23
|
+
// 2. Altered source versions must be plainly marked as such, and must not
|
|
24
|
+
// be misrepresented as being the original software.
|
|
25
|
+
//
|
|
26
|
+
// 3. This notice may not be removed or altered from any source
|
|
27
|
+
// distribution.
|
|
28
|
+
//
|
|
29
|
+
//========================================================================
|
|
30
|
+
|
|
31
|
+
#include "internal.h"
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
//************************************************************************
|
|
35
|
+
//**** Platform implementation functions ****
|
|
36
|
+
//************************************************************************
|
|
37
|
+
|
|
38
|
+
//========================================================================
|
|
39
|
+
// Check if an OpenGL extension is available at runtime (Windows version checks
|
|
40
|
+
// for WGL extensions)
|
|
41
|
+
//========================================================================
|
|
42
|
+
|
|
43
|
+
int _glfwPlatformExtensionSupported( const char *extension )
|
|
44
|
+
{
|
|
45
|
+
const GLubyte *extensions;
|
|
46
|
+
|
|
47
|
+
// Try wglGetExtensionsStringEXT
|
|
48
|
+
if( _glfwWin.GetExtensionsStringEXT != NULL )
|
|
49
|
+
{
|
|
50
|
+
extensions = (GLubyte *) _glfwWin.GetExtensionsStringEXT();
|
|
51
|
+
if( extensions != NULL )
|
|
52
|
+
{
|
|
53
|
+
if( _glfwStringInExtensionString( extension, extensions ) )
|
|
54
|
+
{
|
|
55
|
+
return GL_TRUE;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Try wglGetExtensionsStringARB
|
|
61
|
+
if( _glfwWin.GetExtensionsStringARB != NULL )
|
|
62
|
+
{
|
|
63
|
+
extensions = (GLubyte *) _glfwWin.GetExtensionsStringARB( _glfwWin.DC );
|
|
64
|
+
if( extensions != NULL )
|
|
65
|
+
{
|
|
66
|
+
if( _glfwStringInExtensionString( extension, extensions ) )
|
|
67
|
+
{
|
|
68
|
+
return GL_TRUE;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return GL_FALSE;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
//========================================================================
|
|
78
|
+
// Get the function pointer to an OpenGL function
|
|
79
|
+
//========================================================================
|
|
80
|
+
|
|
81
|
+
void * _glfwPlatformGetProcAddress( const char *procname )
|
|
82
|
+
{
|
|
83
|
+
return (void *) wglGetProcAddress( procname );
|
|
84
|
+
}
|
|
85
|
+
|
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
//========================================================================
|
|
2
|
+
// GLFW - An OpenGL framework
|
|
3
|
+
// File: win32_init.c
|
|
4
|
+
// Platform: Windows
|
|
5
|
+
// API version: 2.6
|
|
6
|
+
// WWW: http://glfw.sourceforge.net
|
|
7
|
+
//------------------------------------------------------------------------
|
|
8
|
+
// Copyright (c) 2002-2006 Camilla Berglund
|
|
9
|
+
//
|
|
10
|
+
// This software is provided 'as-is', without any express or implied
|
|
11
|
+
// warranty. In no event will the authors be held liable for any damages
|
|
12
|
+
// arising from the use of this software.
|
|
13
|
+
//
|
|
14
|
+
// Permission is granted to anyone to use this software for any purpose,
|
|
15
|
+
// including commercial applications, and to alter it and redistribute it
|
|
16
|
+
// freely, subject to the following restrictions:
|
|
17
|
+
//
|
|
18
|
+
// 1. The origin of this software must not be misrepresented; you must not
|
|
19
|
+
// claim that you wrote the original software. If you use this software
|
|
20
|
+
// in a product, an acknowledgment in the product documentation would
|
|
21
|
+
// be appreciated but is not required.
|
|
22
|
+
//
|
|
23
|
+
// 2. Altered source versions must be plainly marked as such, and must not
|
|
24
|
+
// be misrepresented as being the original software.
|
|
25
|
+
//
|
|
26
|
+
// 3. This notice may not be removed or altered from any source
|
|
27
|
+
// distribution.
|
|
28
|
+
//
|
|
29
|
+
//========================================================================
|
|
30
|
+
|
|
31
|
+
#include "internal.h"
|
|
32
|
+
|
|
33
|
+
// With the Borland C++ compiler, we want to disable FPU exceptions
|
|
34
|
+
#ifdef __BORLANDC__
|
|
35
|
+
#include <float.h>
|
|
36
|
+
#endif // __BORLANDC__
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
//************************************************************************
|
|
41
|
+
//**** GLFW internal functions ****
|
|
42
|
+
//************************************************************************
|
|
43
|
+
|
|
44
|
+
//========================================================================
|
|
45
|
+
// _glfwInitLibraries() - Load necessary libraries (DLLs)
|
|
46
|
+
//========================================================================
|
|
47
|
+
|
|
48
|
+
static int _glfwInitLibraries( void )
|
|
49
|
+
{
|
|
50
|
+
// gdi32.dll (OpenGL pixel format functions & SwapBuffers)
|
|
51
|
+
#ifndef _GLFW_NO_DLOAD_GDI32
|
|
52
|
+
_glfwLibrary.Libs.gdi32 = LoadLibrary( "gdi32.dll" );
|
|
53
|
+
if( _glfwLibrary.Libs.gdi32 != NULL )
|
|
54
|
+
{
|
|
55
|
+
_glfwLibrary.Libs.ChoosePixelFormat = (CHOOSEPIXELFORMAT_T)
|
|
56
|
+
GetProcAddress( _glfwLibrary.Libs.gdi32, "ChoosePixelFormat" );
|
|
57
|
+
_glfwLibrary.Libs.DescribePixelFormat = (DESCRIBEPIXELFORMAT_T)
|
|
58
|
+
GetProcAddress( _glfwLibrary.Libs.gdi32, "DescribePixelFormat" );
|
|
59
|
+
_glfwLibrary.Libs.GetPixelFormat = (GETPIXELFORMAT_T)
|
|
60
|
+
GetProcAddress( _glfwLibrary.Libs.gdi32, "GetPixelFormat" );
|
|
61
|
+
_glfwLibrary.Libs.SetPixelFormat = (SETPIXELFORMAT_T)
|
|
62
|
+
GetProcAddress( _glfwLibrary.Libs.gdi32, "SetPixelFormat" );
|
|
63
|
+
_glfwLibrary.Libs.SwapBuffers = (SWAPBUFFERS_T)
|
|
64
|
+
GetProcAddress( _glfwLibrary.Libs.gdi32, "SwapBuffers" );
|
|
65
|
+
if( _glfwLibrary.Libs.ChoosePixelFormat == NULL ||
|
|
66
|
+
_glfwLibrary.Libs.DescribePixelFormat == NULL ||
|
|
67
|
+
_glfwLibrary.Libs.GetPixelFormat == NULL ||
|
|
68
|
+
_glfwLibrary.Libs.SetPixelFormat == NULL ||
|
|
69
|
+
_glfwLibrary.Libs.SwapBuffers == NULL )
|
|
70
|
+
{
|
|
71
|
+
FreeLibrary( _glfwLibrary.Libs.gdi32 );
|
|
72
|
+
_glfwLibrary.Libs.gdi32 = NULL;
|
|
73
|
+
return GL_FALSE;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
else
|
|
77
|
+
{
|
|
78
|
+
return GL_FALSE;
|
|
79
|
+
}
|
|
80
|
+
#endif // _GLFW_NO_DLOAD_GDI32
|
|
81
|
+
|
|
82
|
+
// winmm.dll (for joystick and timer support)
|
|
83
|
+
#ifndef _GLFW_NO_DLOAD_WINMM
|
|
84
|
+
_glfwLibrary.Libs.winmm = LoadLibrary( "winmm.dll" );
|
|
85
|
+
if( _glfwLibrary.Libs.winmm != NULL )
|
|
86
|
+
{
|
|
87
|
+
_glfwLibrary.Libs.joyGetDevCapsA = (JOYGETDEVCAPSA_T)
|
|
88
|
+
GetProcAddress( _glfwLibrary.Libs.winmm, "joyGetDevCapsA" );
|
|
89
|
+
_glfwLibrary.Libs.joyGetPos = (JOYGETPOS_T)
|
|
90
|
+
GetProcAddress( _glfwLibrary.Libs.winmm, "joyGetPos" );
|
|
91
|
+
_glfwLibrary.Libs.joyGetPosEx = (JOYGETPOSEX_T)
|
|
92
|
+
GetProcAddress( _glfwLibrary.Libs.winmm, "joyGetPosEx" );
|
|
93
|
+
_glfwLibrary.Libs.timeGetTime = (TIMEGETTIME_T)
|
|
94
|
+
GetProcAddress( _glfwLibrary.Libs.winmm, "timeGetTime" );
|
|
95
|
+
if( _glfwLibrary.Libs.joyGetDevCapsA == NULL ||
|
|
96
|
+
_glfwLibrary.Libs.joyGetPos == NULL ||
|
|
97
|
+
_glfwLibrary.Libs.joyGetPosEx == NULL ||
|
|
98
|
+
_glfwLibrary.Libs.timeGetTime == NULL )
|
|
99
|
+
{
|
|
100
|
+
FreeLibrary( _glfwLibrary.Libs.winmm );
|
|
101
|
+
_glfwLibrary.Libs.winmm = NULL;
|
|
102
|
+
return GL_FALSE;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
else
|
|
106
|
+
{
|
|
107
|
+
return GL_FALSE;
|
|
108
|
+
}
|
|
109
|
+
#endif // _GLFW_NO_DLOAD_WINMM
|
|
110
|
+
|
|
111
|
+
return GL_TRUE;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
//========================================================================
|
|
116
|
+
// _glfwFreeLibraries() - Unload used libraries (DLLs)
|
|
117
|
+
//========================================================================
|
|
118
|
+
|
|
119
|
+
static void _glfwFreeLibraries( void )
|
|
120
|
+
{
|
|
121
|
+
// gdi32.dll
|
|
122
|
+
#ifndef _GLFW_NO_DLOAD_GDI32
|
|
123
|
+
if( _glfwLibrary.Libs.gdi32 != NULL )
|
|
124
|
+
{
|
|
125
|
+
FreeLibrary( _glfwLibrary.Libs.gdi32 );
|
|
126
|
+
_glfwLibrary.Libs.gdi32 = NULL;
|
|
127
|
+
}
|
|
128
|
+
#endif // _GLFW_NO_DLOAD_GDI32
|
|
129
|
+
|
|
130
|
+
// winmm.dll
|
|
131
|
+
#ifndef _GLFW_NO_DLOAD_WINMM
|
|
132
|
+
if( _glfwLibrary.Libs.winmm != NULL )
|
|
133
|
+
{
|
|
134
|
+
FreeLibrary( _glfwLibrary.Libs.winmm );
|
|
135
|
+
_glfwLibrary.Libs.winmm = NULL;
|
|
136
|
+
}
|
|
137
|
+
#endif // _GLFW_NO_DLOAD_WINMM
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
//========================================================================
|
|
142
|
+
// _glfwInitThreads() - Initialize GLFW thread package
|
|
143
|
+
//========================================================================
|
|
144
|
+
|
|
145
|
+
static void _glfwInitThreads( void )
|
|
146
|
+
{
|
|
147
|
+
// Initialize critical section handle
|
|
148
|
+
InitializeCriticalSection( &_glfwThrd.CriticalSection );
|
|
149
|
+
|
|
150
|
+
// The first thread (the main thread) has ID 0
|
|
151
|
+
_glfwThrd.NextID = 0;
|
|
152
|
+
|
|
153
|
+
// Fill out information about the main thread (this thread)
|
|
154
|
+
_glfwThrd.First.ID = _glfwThrd.NextID ++;
|
|
155
|
+
_glfwThrd.First.Function = NULL;
|
|
156
|
+
_glfwThrd.First.Handle = GetCurrentThread();
|
|
157
|
+
_glfwThrd.First.WinID = GetCurrentThreadId();
|
|
158
|
+
_glfwThrd.First.Previous = NULL;
|
|
159
|
+
_glfwThrd.First.Next = NULL;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
//========================================================================
|
|
164
|
+
// _glfwTerminateThreads() - Terminate GLFW thread package
|
|
165
|
+
//========================================================================
|
|
166
|
+
|
|
167
|
+
static void _glfwTerminateThreads( void )
|
|
168
|
+
{
|
|
169
|
+
_GLFWthread *t, *t_next;
|
|
170
|
+
|
|
171
|
+
// Enter critical section
|
|
172
|
+
ENTER_THREAD_CRITICAL_SECTION
|
|
173
|
+
|
|
174
|
+
// Kill all threads (NOTE: THE USER SHOULD WAIT FOR ALL THREADS TO
|
|
175
|
+
// DIE, _BEFORE_ CALLING glfwTerminate()!!!)
|
|
176
|
+
t = _glfwThrd.First.Next;
|
|
177
|
+
while( t != NULL )
|
|
178
|
+
{
|
|
179
|
+
// Get pointer to next thread
|
|
180
|
+
t_next = t->Next;
|
|
181
|
+
|
|
182
|
+
// Simply murder the process, no mercy!
|
|
183
|
+
if( TerminateThread( t->Handle, 0 ) )
|
|
184
|
+
{
|
|
185
|
+
// Close thread handle
|
|
186
|
+
CloseHandle( t->Handle );
|
|
187
|
+
|
|
188
|
+
// Free memory allocated for this thread
|
|
189
|
+
free( (void *) t );
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// Select next thread in list
|
|
193
|
+
t = t_next;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// Leave critical section
|
|
197
|
+
LEAVE_THREAD_CRITICAL_SECTION
|
|
198
|
+
|
|
199
|
+
// Delete critical section handle
|
|
200
|
+
DeleteCriticalSection( &_glfwThrd.CriticalSection );
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
//========================================================================
|
|
205
|
+
// _glfwTerminate_atexit() - Terminate GLFW when exiting application
|
|
206
|
+
//========================================================================
|
|
207
|
+
|
|
208
|
+
void _glfwTerminate_atexit( void )
|
|
209
|
+
{
|
|
210
|
+
glfwTerminate();
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
//************************************************************************
|
|
216
|
+
//**** Platform implementation functions ****
|
|
217
|
+
//************************************************************************
|
|
218
|
+
|
|
219
|
+
//========================================================================
|
|
220
|
+
// _glfwPlatformInit() - Initialize various GLFW state
|
|
221
|
+
//========================================================================
|
|
222
|
+
|
|
223
|
+
int _glfwPlatformInit( void )
|
|
224
|
+
{
|
|
225
|
+
OSVERSIONINFO osi;
|
|
226
|
+
|
|
227
|
+
// To make SetForegroundWindow() work as we want, we need to fiddle
|
|
228
|
+
// with the FOREGROUNDLOCKTIMEOUT system setting (we do this as early
|
|
229
|
+
// as possible in the hope of still being the foreground process)
|
|
230
|
+
SystemParametersInfo( SPI_GETFOREGROUNDLOCKTIMEOUT, 0,
|
|
231
|
+
&_glfwLibrary.Sys.ForegroundLockTimeout, 0 );
|
|
232
|
+
SystemParametersInfo( SPI_SETFOREGROUNDLOCKTIMEOUT, 0, (LPVOID)0,
|
|
233
|
+
SPIF_SENDCHANGE );
|
|
234
|
+
|
|
235
|
+
// Check which OS version we are running
|
|
236
|
+
osi.dwOSVersionInfoSize = sizeof( OSVERSIONINFO );
|
|
237
|
+
GetVersionEx( &osi );
|
|
238
|
+
_glfwLibrary.Sys.WinVer = _GLFW_WIN_UNKNOWN;
|
|
239
|
+
if( osi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS )
|
|
240
|
+
{
|
|
241
|
+
if( osi.dwMajorVersion == 4 && osi.dwMinorVersion < 10 )
|
|
242
|
+
{
|
|
243
|
+
_glfwLibrary.Sys.WinVer = _GLFW_WIN_95;
|
|
244
|
+
}
|
|
245
|
+
else if( osi.dwMajorVersion == 4 && osi.dwMinorVersion < 90 )
|
|
246
|
+
{
|
|
247
|
+
_glfwLibrary.Sys.WinVer = _GLFW_WIN_98;
|
|
248
|
+
}
|
|
249
|
+
else if( osi.dwMajorVersion == 4 && osi.dwMinorVersion == 90 )
|
|
250
|
+
{
|
|
251
|
+
_glfwLibrary.Sys.WinVer = _GLFW_WIN_ME;
|
|
252
|
+
}
|
|
253
|
+
else if( osi.dwMajorVersion >= 4 )
|
|
254
|
+
{
|
|
255
|
+
_glfwLibrary.Sys.WinVer = _GLFW_WIN_UNKNOWN_9x;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
else if( osi.dwPlatformId == VER_PLATFORM_WIN32_NT )
|
|
259
|
+
{
|
|
260
|
+
if( osi.dwMajorVersion == 4 && osi.dwMinorVersion == 0 )
|
|
261
|
+
{
|
|
262
|
+
_glfwLibrary.Sys.WinVer = _GLFW_WIN_NT4;
|
|
263
|
+
}
|
|
264
|
+
else if( osi.dwMajorVersion == 5 && osi.dwMinorVersion == 0 )
|
|
265
|
+
{
|
|
266
|
+
_glfwLibrary.Sys.WinVer = _GLFW_WIN_2K;
|
|
267
|
+
}
|
|
268
|
+
else if( osi.dwMajorVersion == 5 && osi.dwMinorVersion == 1 )
|
|
269
|
+
{
|
|
270
|
+
_glfwLibrary.Sys.WinVer = _GLFW_WIN_XP;
|
|
271
|
+
}
|
|
272
|
+
else if( osi.dwMajorVersion == 5 && osi.dwMinorVersion == 2 )
|
|
273
|
+
{
|
|
274
|
+
_glfwLibrary.Sys.WinVer = _GLFW_WIN_NET_SERVER;
|
|
275
|
+
}
|
|
276
|
+
else if( osi.dwMajorVersion >= 5 )
|
|
277
|
+
{
|
|
278
|
+
_glfwLibrary.Sys.WinVer = _GLFW_WIN_UNKNOWN_NT;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// Do we have Unicode support?
|
|
283
|
+
if( _glfwLibrary.Sys.WinVer >= _GLFW_WIN_NT4 )
|
|
284
|
+
{
|
|
285
|
+
// Windows NT/2000/XP/.NET has Unicode support
|
|
286
|
+
_glfwLibrary.Sys.HasUnicode = GL_TRUE;
|
|
287
|
+
}
|
|
288
|
+
else
|
|
289
|
+
{
|
|
290
|
+
// Windows 9x/ME does not have Unicode support
|
|
291
|
+
_glfwLibrary.Sys.HasUnicode = GL_FALSE;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
// Load libraries (DLLs)
|
|
295
|
+
if( !_glfwInitLibraries() )
|
|
296
|
+
{
|
|
297
|
+
return GL_FALSE;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// With the Borland C++ compiler, we want to disable FPU exceptions
|
|
301
|
+
// (this is recommended for OpenGL applications under Windows)
|
|
302
|
+
#ifdef __BORLANDC__
|
|
303
|
+
_control87( MCW_EM, MCW_EM );
|
|
304
|
+
#endif
|
|
305
|
+
|
|
306
|
+
// Retrieve GLFW instance handle
|
|
307
|
+
_glfwLibrary.Instance = GetModuleHandle( NULL );
|
|
308
|
+
|
|
309
|
+
// System keys are not disabled
|
|
310
|
+
_glfwWin.KeyboardHook = NULL;
|
|
311
|
+
|
|
312
|
+
// Initialise thread package
|
|
313
|
+
_glfwInitThreads();
|
|
314
|
+
|
|
315
|
+
// Install atexit() routine
|
|
316
|
+
atexit( _glfwTerminate_atexit );
|
|
317
|
+
|
|
318
|
+
// Start the timer
|
|
319
|
+
_glfwInitTimer();
|
|
320
|
+
|
|
321
|
+
return GL_TRUE;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
//========================================================================
|
|
326
|
+
// _glfwPlatformTerminate() - Close window and kill all threads
|
|
327
|
+
//========================================================================
|
|
328
|
+
|
|
329
|
+
int _glfwPlatformTerminate( void )
|
|
330
|
+
{
|
|
331
|
+
// Only the main thread is allowed to do this...
|
|
332
|
+
if( GetCurrentThreadId() != _glfwThrd.First.WinID )
|
|
333
|
+
{
|
|
334
|
+
return GL_FALSE;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
// Close OpenGL window
|
|
338
|
+
glfwCloseWindow();
|
|
339
|
+
|
|
340
|
+
// Kill thread package
|
|
341
|
+
_glfwTerminateThreads();
|
|
342
|
+
|
|
343
|
+
// Enable system keys again (if they were disabled)
|
|
344
|
+
glfwEnable( GLFW_SYSTEM_KEYS );
|
|
345
|
+
|
|
346
|
+
// Unload libraries (DLLs)
|
|
347
|
+
_glfwFreeLibraries();
|
|
348
|
+
|
|
349
|
+
// Restore FOREGROUNDLOCKTIMEOUT system setting
|
|
350
|
+
SystemParametersInfo( SPI_SETFOREGROUNDLOCKTIMEOUT, 0,
|
|
351
|
+
(LPVOID)_glfwLibrary.Sys.ForegroundLockTimeout,
|
|
352
|
+
SPIF_SENDCHANGE );
|
|
353
|
+
|
|
354
|
+
return GL_TRUE;
|
|
355
|
+
}
|
|
356
|
+
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
//========================================================================
|
|
2
|
+
// GLFW - An OpenGL framework
|
|
3
|
+
// File: win32_joystick.c
|
|
4
|
+
// Platform: Windows
|
|
5
|
+
// API version: 2.6
|
|
6
|
+
// WWW: http://glfw.sourceforge.net
|
|
7
|
+
//------------------------------------------------------------------------
|
|
8
|
+
// Copyright (c) 2002-2006 Camilla Berglund
|
|
9
|
+
//
|
|
10
|
+
// This software is provided 'as-is', without any express or implied
|
|
11
|
+
// warranty. In no event will the authors be held liable for any damages
|
|
12
|
+
// arising from the use of this software.
|
|
13
|
+
//
|
|
14
|
+
// Permission is granted to anyone to use this software for any purpose,
|
|
15
|
+
// including commercial applications, and to alter it and redistribute it
|
|
16
|
+
// freely, subject to the following restrictions:
|
|
17
|
+
//
|
|
18
|
+
// 1. The origin of this software must not be misrepresented; you must not
|
|
19
|
+
// claim that you wrote the original software. If you use this software
|
|
20
|
+
// in a product, an acknowledgment in the product documentation would
|
|
21
|
+
// be appreciated but is not required.
|
|
22
|
+
//
|
|
23
|
+
// 2. Altered source versions must be plainly marked as such, and must not
|
|
24
|
+
// be misrepresented as being the original software.
|
|
25
|
+
//
|
|
26
|
+
// 3. This notice may not be removed or altered from any source
|
|
27
|
+
// distribution.
|
|
28
|
+
//
|
|
29
|
+
//========================================================================
|
|
30
|
+
|
|
31
|
+
#include "internal.h"
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
//************************************************************************
|
|
35
|
+
//**** GLFW internal functions ****
|
|
36
|
+
//************************************************************************
|
|
37
|
+
|
|
38
|
+
//========================================================================
|
|
39
|
+
// _glfwJoystickPresent() - Return GL_TRUE if joystick is present,
|
|
40
|
+
// else return GL_FALSE.
|
|
41
|
+
//========================================================================
|
|
42
|
+
|
|
43
|
+
static int _glfwJoystickPresent( int joy )
|
|
44
|
+
{
|
|
45
|
+
JOYINFO ji;
|
|
46
|
+
|
|
47
|
+
// Windows NT 4.0 MMSYSTEM only supports 2 sticks (other Windows
|
|
48
|
+
// versions support 16 sticks)
|
|
49
|
+
if( _glfwLibrary.Sys.WinVer == _GLFW_WIN_NT4 && joy > GLFW_JOYSTICK_2 )
|
|
50
|
+
{
|
|
51
|
+
return GL_FALSE;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Is it a valid stick ID (Windows don't support more than 16 sticks)?
|
|
55
|
+
if( joy < GLFW_JOYSTICK_1 || joy > GLFW_JOYSTICK_16 )
|
|
56
|
+
{
|
|
57
|
+
return GL_FALSE;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Is the joystick present?
|
|
61
|
+
if( _glfw_joyGetPos( joy - GLFW_JOYSTICK_1, &ji ) != JOYERR_NOERROR )
|
|
62
|
+
{
|
|
63
|
+
return GL_FALSE;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return GL_TRUE;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
//========================================================================
|
|
71
|
+
// _glfwCalcJoystickPos() - Calculate joystick position
|
|
72
|
+
//========================================================================
|
|
73
|
+
|
|
74
|
+
static float _glfwCalcJoystickPos( DWORD pos, DWORD min, DWORD max )
|
|
75
|
+
{
|
|
76
|
+
float fpos = (float) pos;
|
|
77
|
+
float fmin = (float) min;
|
|
78
|
+
float fmax = (float) max;
|
|
79
|
+
return (2.0f*(fpos - fmin) / (fmax - fmin)) - 1.0f;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
//************************************************************************
|
|
85
|
+
//**** Platform implementation functions ****
|
|
86
|
+
//************************************************************************
|
|
87
|
+
|
|
88
|
+
//========================================================================
|
|
89
|
+
// _glfwPlatformGetJoystickParam() - Determine joystick capabilities
|
|
90
|
+
//========================================================================
|
|
91
|
+
|
|
92
|
+
int _glfwPlatformGetJoystickParam( int joy, int param )
|
|
93
|
+
{
|
|
94
|
+
JOYCAPS jc;
|
|
95
|
+
|
|
96
|
+
// return 0;
|
|
97
|
+
|
|
98
|
+
// Is joystick present?
|
|
99
|
+
if( !_glfwJoystickPresent( joy ) )
|
|
100
|
+
{
|
|
101
|
+
return 0;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// We got this far, the joystick is present
|
|
105
|
+
if( param == GLFW_PRESENT )
|
|
106
|
+
{
|
|
107
|
+
return GL_TRUE;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Get joystick capabilities
|
|
111
|
+
_glfw_joyGetDevCaps( joy - GLFW_JOYSTICK_1, &jc, sizeof(JOYCAPS) );
|
|
112
|
+
|
|
113
|
+
switch( param )
|
|
114
|
+
{
|
|
115
|
+
case GLFW_AXES:
|
|
116
|
+
// Return number of joystick axes
|
|
117
|
+
return jc.wNumAxes;
|
|
118
|
+
|
|
119
|
+
case GLFW_BUTTONS:
|
|
120
|
+
// Return number of joystick axes
|
|
121
|
+
return jc.wNumButtons;
|
|
122
|
+
|
|
123
|
+
default:
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return 0;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
//========================================================================
|
|
132
|
+
// _glfwPlatformGetJoystickPos() - Get joystick axis positions
|
|
133
|
+
//========================================================================
|
|
134
|
+
|
|
135
|
+
int _glfwPlatformGetJoystickPos( int joy, float *pos, int numaxes )
|
|
136
|
+
{
|
|
137
|
+
JOYCAPS jc;
|
|
138
|
+
JOYINFOEX ji;
|
|
139
|
+
int axis;
|
|
140
|
+
|
|
141
|
+
// return 0;
|
|
142
|
+
|
|
143
|
+
// Is joystick present?
|
|
144
|
+
if( !_glfwJoystickPresent( joy ) )
|
|
145
|
+
{
|
|
146
|
+
return 0;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// Get joystick capabilities
|
|
150
|
+
_glfw_joyGetDevCaps( joy - GLFW_JOYSTICK_1, &jc, sizeof(JOYCAPS) );
|
|
151
|
+
|
|
152
|
+
// Get joystick state
|
|
153
|
+
ji.dwSize = sizeof( JOYINFOEX );
|
|
154
|
+
ji.dwFlags = JOY_RETURNX | JOY_RETURNY | JOY_RETURNZ |
|
|
155
|
+
JOY_RETURNR | JOY_RETURNU | JOY_RETURNV;
|
|
156
|
+
_glfw_joyGetPosEx( joy - GLFW_JOYSTICK_1, &ji );
|
|
157
|
+
|
|
158
|
+
// Get position values for all axes
|
|
159
|
+
axis = 0;
|
|
160
|
+
if( axis < numaxes )
|
|
161
|
+
{
|
|
162
|
+
pos[ axis++ ] = _glfwCalcJoystickPos( ji.dwXpos, jc.wXmin,
|
|
163
|
+
jc.wXmax );
|
|
164
|
+
}
|
|
165
|
+
if( axis < numaxes )
|
|
166
|
+
{
|
|
167
|
+
pos[ axis++ ] = -_glfwCalcJoystickPos( ji.dwYpos, jc.wYmin,
|
|
168
|
+
jc.wYmax );
|
|
169
|
+
}
|
|
170
|
+
if( axis < numaxes && jc.wCaps & JOYCAPS_HASZ )
|
|
171
|
+
{
|
|
172
|
+
pos[ axis++ ] = _glfwCalcJoystickPos( ji.dwZpos, jc.wZmin,
|
|
173
|
+
jc.wZmax );
|
|
174
|
+
}
|
|
175
|
+
if( axis < numaxes && jc.wCaps & JOYCAPS_HASR )
|
|
176
|
+
{
|
|
177
|
+
pos[ axis++ ] = _glfwCalcJoystickPos( ji.dwRpos, jc.wRmin,
|
|
178
|
+
jc.wRmax );
|
|
179
|
+
}
|
|
180
|
+
if( axis < numaxes && jc.wCaps & JOYCAPS_HASU )
|
|
181
|
+
{
|
|
182
|
+
pos[ axis++ ] = _glfwCalcJoystickPos( ji.dwUpos, jc.wUmin,
|
|
183
|
+
jc.wUmax );
|
|
184
|
+
}
|
|
185
|
+
if( axis < numaxes && jc.wCaps & JOYCAPS_HASV )
|
|
186
|
+
{
|
|
187
|
+
pos[ axis++ ] = -_glfwCalcJoystickPos( ji.dwVpos, jc.wVmin,
|
|
188
|
+
jc.wVmax );
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// Return number of returned axes
|
|
192
|
+
return axis;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
//========================================================================
|
|
197
|
+
// _glfwPlatformGetJoystickButtons() - Get joystick button states
|
|
198
|
+
//========================================================================
|
|
199
|
+
|
|
200
|
+
int _glfwPlatformGetJoystickButtons( int joy, unsigned char *buttons,
|
|
201
|
+
int numbuttons )
|
|
202
|
+
{
|
|
203
|
+
JOYCAPS jc;
|
|
204
|
+
JOYINFOEX ji;
|
|
205
|
+
int button;
|
|
206
|
+
|
|
207
|
+
// return 0;
|
|
208
|
+
|
|
209
|
+
// Is joystick present?
|
|
210
|
+
if( !_glfwJoystickPresent( joy ) )
|
|
211
|
+
{
|
|
212
|
+
return 0;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// Get joystick capabilities
|
|
216
|
+
_glfw_joyGetDevCaps( joy - GLFW_JOYSTICK_1, &jc, sizeof(JOYCAPS) );
|
|
217
|
+
|
|
218
|
+
// Get joystick state
|
|
219
|
+
ji.dwSize = sizeof( JOYINFOEX );
|
|
220
|
+
ji.dwFlags = JOY_RETURNBUTTONS;
|
|
221
|
+
_glfw_joyGetPosEx( joy - GLFW_JOYSTICK_1, &ji );
|
|
222
|
+
|
|
223
|
+
// Get states of all requested buttons
|
|
224
|
+
button = 0;
|
|
225
|
+
while( button < numbuttons && button < (int) jc.wNumButtons )
|
|
226
|
+
{
|
|
227
|
+
buttons[ button ] = (unsigned char)
|
|
228
|
+
(ji.dwButtons & (1UL << button) ? GLFW_PRESS : GLFW_RELEASE);
|
|
229
|
+
button ++;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
return button;
|
|
233
|
+
}
|
|
234
|
+
|