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,341 @@
|
|
|
1
|
+
//========================================================================
|
|
2
|
+
// GLFW - An OpenGL framework
|
|
3
|
+
// File: platform.h
|
|
4
|
+
// Platform: DOS
|
|
5
|
+
// API version: 2.6
|
|
6
|
+
// WWW: http://glfw.sourceforge.net
|
|
7
|
+
//------------------------------------------------------------------------
|
|
8
|
+
// Copyright (c) 2002-2006 Camilla Berglund
|
|
9
|
+
//
|
|
10
|
+
// This software is provided 'as-is', without any express or implied
|
|
11
|
+
// warranty. In no event will the authors be held liable for any damages
|
|
12
|
+
// arising from the use of this software.
|
|
13
|
+
//
|
|
14
|
+
// Permission is granted to anyone to use this software for any purpose,
|
|
15
|
+
// including commercial applications, and to alter it and redistribute it
|
|
16
|
+
// freely, subject to the following restrictions:
|
|
17
|
+
//
|
|
18
|
+
// 1. The origin of this software must not be misrepresented; you must not
|
|
19
|
+
// claim that you wrote the original software. If you use this software
|
|
20
|
+
// in a product, an acknowledgment in the product documentation would
|
|
21
|
+
// be appreciated but is not required.
|
|
22
|
+
//
|
|
23
|
+
// 2. Altered source versions must be plainly marked as such, and must not
|
|
24
|
+
// be misrepresented as being the original software.
|
|
25
|
+
//
|
|
26
|
+
// 3. This notice may not be removed or altered from any source
|
|
27
|
+
// distribution.
|
|
28
|
+
//
|
|
29
|
+
//========================================================================
|
|
30
|
+
|
|
31
|
+
#ifndef _platform_h_
|
|
32
|
+
#define _platform_h_
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
// This is the DOS version of GLFW
|
|
36
|
+
#define _GLFW_DOS
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
// Include files
|
|
40
|
+
#include <stdio.h>
|
|
41
|
+
#include <stdlib.h>
|
|
42
|
+
#include <unistd.h>
|
|
43
|
+
#include <time.h>
|
|
44
|
+
#include <dos.h>
|
|
45
|
+
#include <dpmi.h>
|
|
46
|
+
#include <fcntl.h>
|
|
47
|
+
#include <pc.h>
|
|
48
|
+
#include <sys/stat.h>
|
|
49
|
+
#include <sys/exceptn.h>
|
|
50
|
+
#include <sys/farptr.h>
|
|
51
|
+
#include <sys/segments.h>
|
|
52
|
+
|
|
53
|
+
// GLFW+GL+GLU defines
|
|
54
|
+
#include "../../include/GL/glfw.h"
|
|
55
|
+
|
|
56
|
+
// DOS Mesa (include this AFTER gl.h!)
|
|
57
|
+
#include <GL/dmesa.h>
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
// Stack size for each thread (in bytes)
|
|
61
|
+
#define _GLFW_TASK_STACK_SIZE 50000
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
//========================================================================
|
|
67
|
+
// Global variables (GLFW internals)
|
|
68
|
+
//========================================================================
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
//------------------------------------------------------------------------
|
|
72
|
+
// Window structure
|
|
73
|
+
//------------------------------------------------------------------------
|
|
74
|
+
typedef struct _GLFWwin_struct _GLFWwin;
|
|
75
|
+
|
|
76
|
+
struct _GLFWwin_struct {
|
|
77
|
+
|
|
78
|
+
// ========= PLATFORM INDEPENDENT MANDATORY PART =========================
|
|
79
|
+
|
|
80
|
+
// User callback functions
|
|
81
|
+
GLFWwindowsizefun WindowSizeCallback;
|
|
82
|
+
GLFWwindowclosefun WindowCloseCallback;
|
|
83
|
+
GLFWwindowrefreshfun WindowRefreshCallback;
|
|
84
|
+
GLFWmousebuttonfun MouseButtonCallback;
|
|
85
|
+
GLFWmouseposfun MousePosCallback;
|
|
86
|
+
GLFWmousewheelfun MouseWheelCallback;
|
|
87
|
+
GLFWkeyfun KeyCallback;
|
|
88
|
+
GLFWcharfun CharCallback;
|
|
89
|
+
|
|
90
|
+
// User selected window settings
|
|
91
|
+
int Fullscreen; // Fullscreen flag
|
|
92
|
+
int MouseLock; // Mouse-lock flag
|
|
93
|
+
int AutoPollEvents; // Auto polling flag
|
|
94
|
+
int SysKeysDisabled; // System keys disabled flag
|
|
95
|
+
int WindowNoResize; // Resize- and maximize gadgets disabled flag
|
|
96
|
+
|
|
97
|
+
// Window status & parameters
|
|
98
|
+
int Opened; // Flag telling if window is opened or not
|
|
99
|
+
int Active; // Application active flag
|
|
100
|
+
int Iconified; // Window iconified flag
|
|
101
|
+
int Width, Height; // Window width and heigth
|
|
102
|
+
int Accelerated; // GL_TRUE if window is HW accelerated
|
|
103
|
+
int RedBits;
|
|
104
|
+
int GreenBits;
|
|
105
|
+
int BlueBits;
|
|
106
|
+
int AlphaBits;
|
|
107
|
+
int DepthBits;
|
|
108
|
+
int StencilBits;
|
|
109
|
+
int AccumRedBits;
|
|
110
|
+
int AccumGreenBits;
|
|
111
|
+
int AccumBlueBits;
|
|
112
|
+
int AccumAlphaBits;
|
|
113
|
+
int AuxBuffers;
|
|
114
|
+
int Stereo;
|
|
115
|
+
int RefreshRate; // Vertical monitor refresh rate
|
|
116
|
+
|
|
117
|
+
// Extensions & OpenGL version
|
|
118
|
+
int Has_GL_SGIS_generate_mipmap;
|
|
119
|
+
int Has_GL_ARB_texture_non_power_of_two;
|
|
120
|
+
int GLVerMajor,GLVerMinor;
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
// ========= PLATFORM SPECIFIC PART ======================================
|
|
124
|
+
|
|
125
|
+
// Platform specific window resources
|
|
126
|
+
DMesaVisual Visual;
|
|
127
|
+
DMesaContext Context;
|
|
128
|
+
DMesaBuffer Buffer;
|
|
129
|
+
|
|
130
|
+
// Standard output redirection
|
|
131
|
+
char OutName[L_tmpnam];
|
|
132
|
+
char ErrName[L_tmpnam];
|
|
133
|
+
int hOut,hOutOld,hErr,hErrOld;
|
|
134
|
+
|
|
135
|
+
// Platform specific extensions
|
|
136
|
+
|
|
137
|
+
// Various platform specific internal variables
|
|
138
|
+
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
GLFWGLOBAL _GLFWwin _glfwWin;
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
//------------------------------------------------------------------------
|
|
145
|
+
// User input status (most of this should go in _GLFWwin)
|
|
146
|
+
//------------------------------------------------------------------------
|
|
147
|
+
GLFWGLOBAL struct {
|
|
148
|
+
|
|
149
|
+
// ========= PLATFORM INDEPENDENT MANDATORY PART =========================
|
|
150
|
+
|
|
151
|
+
// Mouse status
|
|
152
|
+
int MousePosX, MousePosY;
|
|
153
|
+
int WheelPos;
|
|
154
|
+
char MouseButton[ GLFW_MOUSE_BUTTON_LAST+1 ];
|
|
155
|
+
|
|
156
|
+
// Keyboard status
|
|
157
|
+
char Key[ GLFW_KEY_LAST+1 ];
|
|
158
|
+
int LastChar;
|
|
159
|
+
|
|
160
|
+
// User selected settings
|
|
161
|
+
int StickyKeys;
|
|
162
|
+
int StickyMouseButtons;
|
|
163
|
+
int KeyRepeat;
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
// ========= PLATFORM SPECIFIC PART ======================================
|
|
167
|
+
|
|
168
|
+
// Platform specific internal variables
|
|
169
|
+
|
|
170
|
+
} _glfwInput;
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
//------------------------------------------------------------------------
|
|
174
|
+
// Timer status
|
|
175
|
+
//------------------------------------------------------------------------
|
|
176
|
+
GLFWGLOBAL struct {
|
|
177
|
+
double Period;
|
|
178
|
+
long long t0;
|
|
179
|
+
int HasRDTSC;
|
|
180
|
+
} _glfwTimer;
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
//------------------------------------------------------------------------
|
|
184
|
+
// Thread record (one for each thread)
|
|
185
|
+
//------------------------------------------------------------------------
|
|
186
|
+
typedef struct _GLFWthread_struct _GLFWthread;
|
|
187
|
+
|
|
188
|
+
struct _GLFWthread_struct {
|
|
189
|
+
|
|
190
|
+
// ========= PLATFORM INDEPENDENT MANDATORY PART =========================
|
|
191
|
+
|
|
192
|
+
// Pointer to previous and next threads in linked list
|
|
193
|
+
_GLFWthread *Previous, *Next;
|
|
194
|
+
|
|
195
|
+
// GLFW user side thread information
|
|
196
|
+
GLFWthread ID;
|
|
197
|
+
|
|
198
|
+
// ========= PLATFORM SPECIFIC PART ======================================
|
|
199
|
+
|
|
200
|
+
// System side thread information
|
|
201
|
+
GLFWthreadfun Function;
|
|
202
|
+
void *Arg;
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
//------------------------------------------------------------------------
|
|
207
|
+
// General thread information
|
|
208
|
+
//------------------------------------------------------------------------
|
|
209
|
+
GLFWGLOBAL struct {
|
|
210
|
+
|
|
211
|
+
// ========= PLATFORM INDEPENDENT MANDATORY PART =========================
|
|
212
|
+
|
|
213
|
+
// Next thread ID to use (increments for every created thread)
|
|
214
|
+
GLFWthread NextID;
|
|
215
|
+
|
|
216
|
+
// First thread in linked list (always the main thread)
|
|
217
|
+
_GLFWthread First;
|
|
218
|
+
|
|
219
|
+
// ========= PLATFORM SPECIFIC PART ======================================
|
|
220
|
+
|
|
221
|
+
// Critical section lock
|
|
222
|
+
|
|
223
|
+
} _glfwThrd;
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
//------------------------------------------------------------------------
|
|
227
|
+
// Joystick information & state
|
|
228
|
+
//------------------------------------------------------------------------
|
|
229
|
+
GLFWGLOBAL struct {
|
|
230
|
+
int dummy;
|
|
231
|
+
} _glfwJoy;
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
//========================================================================
|
|
235
|
+
// Macros for encapsulating critical code sections (i.e. making parts
|
|
236
|
+
// of GLFW thread safe)
|
|
237
|
+
//========================================================================
|
|
238
|
+
|
|
239
|
+
// Thread list management
|
|
240
|
+
#define ENTER_THREAD_CRITICAL_SECTION \
|
|
241
|
+
;
|
|
242
|
+
#define LEAVE_THREAD_CRITICAL_SECTION \
|
|
243
|
+
;
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
//========================================================================
|
|
247
|
+
// DOS events
|
|
248
|
+
//========================================================================
|
|
249
|
+
|
|
250
|
+
// Valid event types
|
|
251
|
+
#define _GLFW_DOS_KEY_EVENT 1
|
|
252
|
+
#define _GLFW_DOS_MOUSE_MOVE_EVENT 2
|
|
253
|
+
#define _GLFW_DOS_MOUSE_WHEEL_EVENT 3
|
|
254
|
+
#define _GLFW_DOS_MOUSE_BUTTON_EVENT 4
|
|
255
|
+
|
|
256
|
+
// Keyboard event structure
|
|
257
|
+
struct key_event {
|
|
258
|
+
int Type;
|
|
259
|
+
int Key;
|
|
260
|
+
int KeyNoMod;
|
|
261
|
+
int Action;
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
// Mouse move event structure
|
|
265
|
+
struct mousemove_event {
|
|
266
|
+
int Type;
|
|
267
|
+
int DeltaX, DeltaY;
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
// Mouse wheel event structure
|
|
271
|
+
struct mousewheel_event {
|
|
272
|
+
int Type;
|
|
273
|
+
int WheelDelta;
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
// Mouse button event structure
|
|
277
|
+
struct mousebutton_event {
|
|
278
|
+
int Type;
|
|
279
|
+
int Button;
|
|
280
|
+
int Action;
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
// DOS event structure
|
|
284
|
+
typedef union {
|
|
285
|
+
int Type;
|
|
286
|
+
struct key_event Key;
|
|
287
|
+
struct mousemove_event MouseMove;
|
|
288
|
+
struct mousewheel_event MouseWheel;
|
|
289
|
+
struct mousebutton_event MouseButton;
|
|
290
|
+
} _GLFWdosevent;
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
//========================================================================
|
|
295
|
+
// Prototypes for platform specific internal functions
|
|
296
|
+
//========================================================================
|
|
297
|
+
|
|
298
|
+
// Time
|
|
299
|
+
int _glfwInitTimer( void );
|
|
300
|
+
void _glfwTerminateTimer( void );
|
|
301
|
+
|
|
302
|
+
// Fullscreen
|
|
303
|
+
|
|
304
|
+
// Events
|
|
305
|
+
int _glfwInitEvents( void );
|
|
306
|
+
void _glfwTerminateEvents( void );
|
|
307
|
+
void _glfwWaitNextEvent( void );
|
|
308
|
+
int _glfwGetNextEvent( _GLFWdosevent *event );
|
|
309
|
+
void _glfwPostDOSEvent( _GLFWdosevent *event );
|
|
310
|
+
|
|
311
|
+
// Mouse
|
|
312
|
+
int _glfwInitMouse( void );
|
|
313
|
+
void _glfwTerminateMouse( void );
|
|
314
|
+
|
|
315
|
+
// Keyboard
|
|
316
|
+
int _glfwInitKeyboard( void );
|
|
317
|
+
void _glfwTerminateKeyboard( void );
|
|
318
|
+
|
|
319
|
+
// Joystick
|
|
320
|
+
void _glfwInitJoysticks( void );
|
|
321
|
+
void _glfwTerminateJoysticks( void );
|
|
322
|
+
|
|
323
|
+
// Threads
|
|
324
|
+
int _glfwInitThreads( void );
|
|
325
|
+
void _glfwTerminateThreads( void );
|
|
326
|
+
|
|
327
|
+
// Interrupt handling
|
|
328
|
+
int _glfwInstallDOSIrq( int i, int (*handler) () );
|
|
329
|
+
int _glfwRemoveDOSIrq( int i );
|
|
330
|
+
|
|
331
|
+
// Interrupt macros
|
|
332
|
+
#define ENABLE() __asm __volatile("sti")
|
|
333
|
+
#define DISABLE() __asm __volatile("cli")
|
|
334
|
+
|
|
335
|
+
// Memory macros (for locking memory)
|
|
336
|
+
#define ENDOFUNC(x) static void x##_end() { }
|
|
337
|
+
#define LOCKFUNC(x) _go32_dpmi_lock_code((void *)x, (long)x##_end - (long)x)
|
|
338
|
+
#define LOCKDATA(x) _go32_dpmi_lock_data((void *)&x, sizeof(x))
|
|
339
|
+
#define LOCKBUFF(x, l) _go32_dpmi_lock_data((void *)x, l)
|
|
340
|
+
|
|
341
|
+
#endif // _platform_h_
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
//========================================================================
|
|
2
|
+
// GLFW - An OpenGL framework
|
|
3
|
+
// File: enable.c
|
|
4
|
+
// Platform: Any
|
|
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
|
+
// Enable (show) mouse cursor
|
|
40
|
+
//========================================================================
|
|
41
|
+
|
|
42
|
+
static void _glfwEnableMouseCursor( void )
|
|
43
|
+
{
|
|
44
|
+
int CenterPosX, CenterPosY;
|
|
45
|
+
|
|
46
|
+
if( !_glfwWin.Opened || !_glfwWin.MouseLock )
|
|
47
|
+
{
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Show mouse cursor
|
|
52
|
+
_glfwPlatformShowMouseCursor();
|
|
53
|
+
|
|
54
|
+
CenterPosX = _glfwWin.Width / 2;
|
|
55
|
+
CenterPosY = _glfwWin.Height / 2;
|
|
56
|
+
|
|
57
|
+
if( CenterPosX != _glfwInput.MousePosX || CenterPosY != _glfwInput.MousePosY )
|
|
58
|
+
{
|
|
59
|
+
_glfwPlatformSetMouseCursorPos( CenterPosX, CenterPosY );
|
|
60
|
+
|
|
61
|
+
_glfwInput.MousePosX = CenterPosX;
|
|
62
|
+
_glfwInput.MousePosY = CenterPosY;
|
|
63
|
+
|
|
64
|
+
if( _glfwWin.MousePosCallback )
|
|
65
|
+
{
|
|
66
|
+
_glfwWin.MousePosCallback( _glfwInput.MousePosX,
|
|
67
|
+
_glfwInput.MousePosY );
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// From now on the mouse is unlocked
|
|
72
|
+
_glfwWin.MouseLock = GL_FALSE;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
//========================================================================
|
|
76
|
+
// Disable (hide) mouse cursor
|
|
77
|
+
//========================================================================
|
|
78
|
+
|
|
79
|
+
static void _glfwDisableMouseCursor( void )
|
|
80
|
+
{
|
|
81
|
+
if( !_glfwWin.Opened || _glfwWin.MouseLock )
|
|
82
|
+
{
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Hide mouse cursor
|
|
87
|
+
_glfwPlatformHideMouseCursor();
|
|
88
|
+
|
|
89
|
+
// Move cursor to the middle of the window
|
|
90
|
+
_glfwPlatformSetMouseCursorPos( _glfwWin.Width>>1,
|
|
91
|
+
_glfwWin.Height>>1 );
|
|
92
|
+
|
|
93
|
+
// From now on the mouse is locked
|
|
94
|
+
_glfwWin.MouseLock = GL_TRUE;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
//========================================================================
|
|
99
|
+
// _glfwEnableStickyKeys() - Enable sticky keys
|
|
100
|
+
// _glfwDisableStickyKeys() - Disable sticky keys
|
|
101
|
+
//========================================================================
|
|
102
|
+
|
|
103
|
+
static void _glfwEnableStickyKeys( void )
|
|
104
|
+
{
|
|
105
|
+
_glfwInput.StickyKeys = 1;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
static void _glfwDisableStickyKeys( void )
|
|
109
|
+
{
|
|
110
|
+
int i;
|
|
111
|
+
|
|
112
|
+
_glfwInput.StickyKeys = 0;
|
|
113
|
+
|
|
114
|
+
// Release all sticky keys
|
|
115
|
+
for( i = 0; i <= GLFW_KEY_LAST; i ++ )
|
|
116
|
+
{
|
|
117
|
+
if( _glfwInput.Key[ i ] == 2 )
|
|
118
|
+
{
|
|
119
|
+
_glfwInput.Key[ i ] = 0;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
//========================================================================
|
|
126
|
+
// _glfwEnableStickyMouseButtons() - Enable sticky mouse buttons
|
|
127
|
+
// _glfwDisableStickyMouseButtons() - Disable sticky mouse buttons
|
|
128
|
+
//========================================================================
|
|
129
|
+
|
|
130
|
+
static void _glfwEnableStickyMouseButtons( void )
|
|
131
|
+
{
|
|
132
|
+
_glfwInput.StickyMouseButtons = 1;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
static void _glfwDisableStickyMouseButtons( void )
|
|
136
|
+
{
|
|
137
|
+
int i;
|
|
138
|
+
|
|
139
|
+
_glfwInput.StickyMouseButtons = 0;
|
|
140
|
+
|
|
141
|
+
// Release all sticky mouse buttons
|
|
142
|
+
for( i = 0; i <= GLFW_MOUSE_BUTTON_LAST; i ++ )
|
|
143
|
+
{
|
|
144
|
+
if( _glfwInput.MouseButton[ i ] == 2 )
|
|
145
|
+
{
|
|
146
|
+
_glfwInput.MouseButton[ i ] = 0;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
//========================================================================
|
|
153
|
+
// _glfwEnableSystemKeys() - Enable system keys
|
|
154
|
+
// _glfwDisableSystemKeys() - Disable system keys
|
|
155
|
+
//========================================================================
|
|
156
|
+
|
|
157
|
+
static void _glfwEnableSystemKeys( void )
|
|
158
|
+
{
|
|
159
|
+
if( !_glfwWin.SysKeysDisabled )
|
|
160
|
+
{
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
_glfwPlatformEnableSystemKeys();
|
|
165
|
+
|
|
166
|
+
// Indicate that system keys are no longer disabled
|
|
167
|
+
_glfwWin.SysKeysDisabled = GL_FALSE;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
static void _glfwDisableSystemKeys( void )
|
|
171
|
+
{
|
|
172
|
+
if( _glfwWin.SysKeysDisabled )
|
|
173
|
+
{
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
_glfwPlatformDisableSystemKeys();
|
|
178
|
+
|
|
179
|
+
// Indicate that system keys are now disabled
|
|
180
|
+
_glfwWin.SysKeysDisabled = GL_TRUE;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
//========================================================================
|
|
185
|
+
// _glfwEnableKeyRepeat() - Enable key repeat
|
|
186
|
+
// _glfwDisableKeyRepeat() - Disable key repeat
|
|
187
|
+
//========================================================================
|
|
188
|
+
|
|
189
|
+
static void _glfwEnableKeyRepeat( void )
|
|
190
|
+
{
|
|
191
|
+
_glfwInput.KeyRepeat = 1;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
static void _glfwDisableKeyRepeat( void )
|
|
195
|
+
{
|
|
196
|
+
_glfwInput.KeyRepeat = 0;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
//========================================================================
|
|
201
|
+
// _glfwEnableAutoPollEvents() - Enable automatic event polling
|
|
202
|
+
// _glfwDisableAutoPollEvents() - Disable automatic event polling
|
|
203
|
+
//========================================================================
|
|
204
|
+
|
|
205
|
+
static void _glfwEnableAutoPollEvents( void )
|
|
206
|
+
{
|
|
207
|
+
_glfwWin.AutoPollEvents = 1;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
static void _glfwDisableAutoPollEvents( void )
|
|
211
|
+
{
|
|
212
|
+
_glfwWin.AutoPollEvents = 0;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
//************************************************************************
|
|
218
|
+
//**** GLFW user functions ****
|
|
219
|
+
//************************************************************************
|
|
220
|
+
|
|
221
|
+
//========================================================================
|
|
222
|
+
// glfwEnable() - Enable certain GLFW/window/system functions.
|
|
223
|
+
//========================================================================
|
|
224
|
+
|
|
225
|
+
GLFWAPI void GLFWAPIENTRY glfwEnable( int token )
|
|
226
|
+
{
|
|
227
|
+
// Is GLFW initialized?
|
|
228
|
+
if( !_glfwInitialized )
|
|
229
|
+
{
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
switch( token )
|
|
234
|
+
{
|
|
235
|
+
case GLFW_MOUSE_CURSOR:
|
|
236
|
+
_glfwEnableMouseCursor();
|
|
237
|
+
break;
|
|
238
|
+
case GLFW_STICKY_KEYS:
|
|
239
|
+
_glfwEnableStickyKeys();
|
|
240
|
+
break;
|
|
241
|
+
case GLFW_STICKY_MOUSE_BUTTONS:
|
|
242
|
+
_glfwEnableStickyMouseButtons();
|
|
243
|
+
break;
|
|
244
|
+
case GLFW_SYSTEM_KEYS:
|
|
245
|
+
_glfwEnableSystemKeys();
|
|
246
|
+
break;
|
|
247
|
+
case GLFW_KEY_REPEAT:
|
|
248
|
+
_glfwEnableKeyRepeat();
|
|
249
|
+
break;
|
|
250
|
+
case GLFW_AUTO_POLL_EVENTS:
|
|
251
|
+
_glfwEnableAutoPollEvents();
|
|
252
|
+
break;
|
|
253
|
+
default:
|
|
254
|
+
break;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
//========================================================================
|
|
260
|
+
// glfwDisable() - Disable certain GLFW/window/system functions.
|
|
261
|
+
//========================================================================
|
|
262
|
+
|
|
263
|
+
GLFWAPI void GLFWAPIENTRY glfwDisable( int token )
|
|
264
|
+
{
|
|
265
|
+
// Is GLFW initialized?
|
|
266
|
+
if( !_glfwInitialized )
|
|
267
|
+
{
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
switch( token )
|
|
272
|
+
{
|
|
273
|
+
case GLFW_MOUSE_CURSOR:
|
|
274
|
+
_glfwDisableMouseCursor();
|
|
275
|
+
break;
|
|
276
|
+
case GLFW_STICKY_KEYS:
|
|
277
|
+
_glfwDisableStickyKeys();
|
|
278
|
+
break;
|
|
279
|
+
case GLFW_STICKY_MOUSE_BUTTONS:
|
|
280
|
+
_glfwDisableStickyMouseButtons();
|
|
281
|
+
break;
|
|
282
|
+
case GLFW_SYSTEM_KEYS:
|
|
283
|
+
_glfwDisableSystemKeys();
|
|
284
|
+
break;
|
|
285
|
+
case GLFW_KEY_REPEAT:
|
|
286
|
+
_glfwDisableKeyRepeat();
|
|
287
|
+
break;
|
|
288
|
+
case GLFW_AUTO_POLL_EVENTS:
|
|
289
|
+
_glfwDisableAutoPollEvents();
|
|
290
|
+
break;
|
|
291
|
+
default:
|
|
292
|
+
break;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|