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,101 @@
|
|
|
1
|
+
Attribute VB_Name = "Program"
|
|
2
|
+
'========================================================================
|
|
3
|
+
' This is a small test application for GLFW.
|
|
4
|
+
' The program opens a window (640x480), and renders a spinning colored
|
|
5
|
+
' triangle (it is controlled with both the GLFW timer and the mouse). It
|
|
6
|
+
' also calculates the rendering speed (FPS), which is displayed in the
|
|
7
|
+
' window title bar.
|
|
8
|
+
'========================================================================
|
|
9
|
+
|
|
10
|
+
Private Sub Main()
|
|
11
|
+
|
|
12
|
+
Dim running, frames, Ok As Long
|
|
13
|
+
Dim x, y, width, height As Long
|
|
14
|
+
Dim t0, t, fps As Double
|
|
15
|
+
Dim titlestr As String
|
|
16
|
+
|
|
17
|
+
' Initialize GLFW
|
|
18
|
+
Ok = glfwInit
|
|
19
|
+
|
|
20
|
+
' Open OpenGL window
|
|
21
|
+
Ok = glfwOpenWindow(640, 480, 0, 0, 0, 0, 0, 0, GLFW_WINDOW)
|
|
22
|
+
If Ok = 0 Then
|
|
23
|
+
glfwTerminate
|
|
24
|
+
End
|
|
25
|
+
End If
|
|
26
|
+
|
|
27
|
+
' Enable sticky keys
|
|
28
|
+
glfwEnable (GLFW_STICKY_KEYS)
|
|
29
|
+
|
|
30
|
+
' Disable vertical sync (on cards that support it)
|
|
31
|
+
glfwSwapInterval 0
|
|
32
|
+
|
|
33
|
+
' Main loop
|
|
34
|
+
running = 1
|
|
35
|
+
frames = 0
|
|
36
|
+
t0 = glfwGetTime
|
|
37
|
+
While running = 1
|
|
38
|
+
' Get time and mouse position
|
|
39
|
+
t = glfwGetTime
|
|
40
|
+
glfwGetMousePos x, y
|
|
41
|
+
|
|
42
|
+
' Calculate and display FPS (frames per second)
|
|
43
|
+
If (t - t0) > 1# Or frames = 0 Then
|
|
44
|
+
fps = frames / (t - t0)
|
|
45
|
+
titlestr = "Spinning Triangle (" + Str(Round(fps, 1)) + " FPS)"
|
|
46
|
+
glfwSetWindowTitle titlestr
|
|
47
|
+
t0 = t
|
|
48
|
+
frames = 0
|
|
49
|
+
End If
|
|
50
|
+
frames = frames + 1
|
|
51
|
+
|
|
52
|
+
' Get window size (may be different than the requested size)
|
|
53
|
+
glfwGetWindowSize width, height
|
|
54
|
+
If height <= 0 Then height = 1
|
|
55
|
+
|
|
56
|
+
' Set viewport
|
|
57
|
+
glViewport 0, 0, width, height
|
|
58
|
+
|
|
59
|
+
' Clear color buffer
|
|
60
|
+
glClearColor 0#, 0#, 0#, 0#
|
|
61
|
+
glClear GL_COLOR_BUFFER_BIT
|
|
62
|
+
|
|
63
|
+
' Select and setup the projection matrix
|
|
64
|
+
glMatrixMode GL_PROJECTION
|
|
65
|
+
glLoadIdentity
|
|
66
|
+
gluPerspective 65#, width / height, 1#, 100#
|
|
67
|
+
|
|
68
|
+
' Select and setup the modelview matrix
|
|
69
|
+
glMatrixMode GL_MODELVIEW
|
|
70
|
+
glLoadIdentity
|
|
71
|
+
gluLookAt 0#, 1#, 0#, 0#, 20#, 0#, 0#, 0#, 1#
|
|
72
|
+
|
|
73
|
+
' Draw a rotating colorful triangle
|
|
74
|
+
glTranslatef 0#, 14#, 0#
|
|
75
|
+
glRotatef 0.3 * x + t * 100#, 0#, 0#, 1#
|
|
76
|
+
glBegin GL_TRIANGLES
|
|
77
|
+
glColor3f 1#, 0#, 0#
|
|
78
|
+
glVertex3f -5#, 0#, -4#
|
|
79
|
+
glColor3f 0#, 1#, 0#
|
|
80
|
+
glVertex3f 5#, 0#, -4#
|
|
81
|
+
glColor3f 0#, 0#, 1#
|
|
82
|
+
glVertex3f 0#, 0#, 6#
|
|
83
|
+
glEnd
|
|
84
|
+
|
|
85
|
+
' Swap buffers
|
|
86
|
+
glfwSwapBuffers
|
|
87
|
+
|
|
88
|
+
' Check if the ESC key was pressed or the window was closed
|
|
89
|
+
If glfwGetKey(GLFW_KEY_ESC) = 1 Or glfwGetWindowParam(GLFW_OPENED) = 0 Then
|
|
90
|
+
running = 0
|
|
91
|
+
End If
|
|
92
|
+
Wend
|
|
93
|
+
|
|
94
|
+
' Close OpenGL window and terminate GLFW
|
|
95
|
+
glfwTerminate
|
|
96
|
+
|
|
97
|
+
' Exit program
|
|
98
|
+
End
|
|
99
|
+
|
|
100
|
+
End Sub
|
|
101
|
+
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
<html>
|
|
2
|
+
|
|
3
|
+
<head>
|
|
4
|
+
<title>GLFW Readme file for Visual Basic</title>
|
|
5
|
+
</head>
|
|
6
|
+
<body>
|
|
7
|
+
|
|
8
|
+
<!-- TITLE -------------------------------------------------------------->
|
|
9
|
+
<center>
|
|
10
|
+
<font face="bookman old style,arial" size=+4><b>GLFW v2.5</b></font><br>
|
|
11
|
+
<font face="bookman old style,arial" size=+3>for Visual Basic</font>
|
|
12
|
+
</center>
|
|
13
|
+
|
|
14
|
+
<!-- CONTENTS ----------------------------------------------------------->
|
|
15
|
+
<p>
|
|
16
|
+
<center>
|
|
17
|
+
<table border=0><tr><td>
|
|
18
|
+
<b>
|
|
19
|
+
<ol>
|
|
20
|
+
<li><a href="#sec1">Introduction</li></a>
|
|
21
|
+
<li><a href="#sec2">Using GLFW from Visual Basic</li></a>
|
|
22
|
+
<li><a href="#sec3">The author</li></a>
|
|
23
|
+
</ol>
|
|
24
|
+
</b>
|
|
25
|
+
</td></tr></table>
|
|
26
|
+
</center>
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
<!----------------------------------------------------------------------->
|
|
30
|
+
<p><hr>
|
|
31
|
+
<!----------------------------------------------------------------------->
|
|
32
|
+
|
|
33
|
+
<a name="sec1">
|
|
34
|
+
<p><h2>1. Introduction</h2>
|
|
35
|
+
|
|
36
|
+
<p>This directory contains Visual Basic bindings for the GLFW v2.5.x
|
|
37
|
+
Windows DLL, and Visual Basic example programs. For further information
|
|
38
|
+
on how to use GLFW you should read the GLFW documentation.
|
|
39
|
+
|
|
40
|
+
<!----------------------------------------------------------------------->
|
|
41
|
+
<p><hr>
|
|
42
|
+
<!----------------------------------------------------------------------->
|
|
43
|
+
|
|
44
|
+
<a name="sec2">
|
|
45
|
+
<p><h2>2. Using GLFW from Visual Basic</h2>
|
|
46
|
+
|
|
47
|
+
<p><h3>2.1 General</h3>
|
|
48
|
+
|
|
49
|
+
<p>Using GLFW is slightly different from what Visual Basic users may be
|
|
50
|
+
used to, since GLFW replaces much of the functionality already built in to
|
|
51
|
+
Visual Basic. For instance, mouse clicks and key presses that occur in a
|
|
52
|
+
GLFW window are handled completely by GLFW, and in order to handle such
|
|
53
|
+
events you have to rely on GLFW functionality. While this may feel odd at
|
|
54
|
+
first, it does not necessarily have to be a disadvantage.
|
|
55
|
+
|
|
56
|
+
<p>The most important thing to comprehend is the way a GLFW "main loop"
|
|
57
|
+
works. Unlike ordinary Visual Basic programs, which are largely event
|
|
58
|
+
based, GLFW programs usually have a core loop that runs "forever" (until
|
|
59
|
+
aborted for some reason). To understand how it works, please look at the
|
|
60
|
+
supplied example programs. You should also read the GLFW Users Guide,
|
|
61
|
+
which explains how to use GLFW (regardless of programming language).
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
<p><br><h3>2.2 About the Visual Basic project</h3>
|
|
65
|
+
|
|
66
|
+
<p>In order to use GLFW from a Visual Basic project, you need to add the
|
|
67
|
+
file <b>glfw.bas</b> to your project (add existing module). It contains
|
|
68
|
+
all the necessary constant, structure and function definitions. You also
|
|
69
|
+
have to copy the file <b>glfw.dll</b> to your project directory.
|
|
70
|
+
|
|
71
|
+
<p>Typically you want to call OpenGL functions from your Visual Basic
|
|
72
|
+
program too. Threfore there are also bindings for opengl32.dll and
|
|
73
|
+
glu32.dll included in this distribution, namely <b>opengl32.bas</b> and
|
|
74
|
+
<b>glu32.bas</b>. Note that these files have not been tested fully, so
|
|
75
|
+
there may be bugs in them (please report them if you find them).
|
|
76
|
+
|
|
77
|
+
<p>If you wish to make a "pure" GLFW project (no forms), you can create a
|
|
78
|
+
a new module, in which you place a procedure named 'Main':
|
|
79
|
+
|
|
80
|
+
<p><b>Private Sub Main()<br>End Sub</b>
|
|
81
|
+
|
|
82
|
+
<p>Then select <i>Project Properties</i>, and under the <i>General</i>
|
|
83
|
+
tab, in the <i>Startup Object</i> field, select <b>Sub Main</b>. This is
|
|
84
|
+
how the example programs are meant to be used.
|
|
85
|
+
|
|
86
|
+
<p>It is of course possible to mix Visual Basic forms and GLFW code. For
|
|
87
|
+
instance you can have a form button that starts your OpenGL program by
|
|
88
|
+
initializing GLFW, opening a GLFW window and entering a GLFW main loop
|
|
89
|
+
etc.
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
<p><br><h3>2.3 Calling GLFW functions</h3>
|
|
93
|
+
|
|
94
|
+
<p>In principle, the GLFW functions can be called with the same syntax as
|
|
95
|
+
described in the GLFW Reference Manual. The primary difference is that
|
|
96
|
+
some GLFW functions are treated as Visual Basic subroutines ("Sub"), which
|
|
97
|
+
means that you should not use parentheses around the argument list. The
|
|
98
|
+
functions that are treated as subroutines are functions that, in 'C'
|
|
99
|
+
terms, return "void" (in other words, nothing). An example is
|
|
100
|
+
the <b>glfwGetMousePos</b> function, which should be called like this:
|
|
101
|
+
|
|
102
|
+
<p> <b>glfwGetMousePos xpos, ypos</b>
|
|
103
|
+
|
|
104
|
+
<p>To be honest, my knowledge in Visual Basic is quite limited, so there
|
|
105
|
+
may be other options and other things to consider. Have a look at the
|
|
106
|
+
example programs for examples of how to call GLFW functions.
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
<p><br><h3>2.4 Using callback functions</h3>
|
|
110
|
+
|
|
111
|
+
<p>GLFW callback functions are very similar to Visual Basic event
|
|
112
|
+
subroutines (e.g. <b>Private Sub Command1_Click()</b>). The primary
|
|
113
|
+
difference is that you have to specify the functions manually, using GLFW
|
|
114
|
+
functions (such as <b>glfwSetMousePosCallback</b>). GLFW callback
|
|
115
|
+
functions, once registered, are called only when <b>glfwSwapBuffers</b> or
|
|
116
|
+
<b>glfwPollEvents</b> are called (if there are any corresponding events
|
|
117
|
+
pending).
|
|
118
|
+
|
|
119
|
+
<p>Creating callback functions is pretty simple. All you need to do is to
|
|
120
|
+
declare a subroutine as specified in the GLFW Reference Manual, but of
|
|
121
|
+
course translated to Visual Basic. For instance a mouse position callback
|
|
122
|
+
function should, in 'C' language, be:
|
|
123
|
+
|
|
124
|
+
<p><b>void GLFWCALL MyFun( int xpos, int ypos)</b>
|
|
125
|
+
|
|
126
|
+
<p>Never mind the GLFWCALL thing (it has to do with 'C' language calling
|
|
127
|
+
conventions). In Visual Basic, this translates into:
|
|
128
|
+
|
|
129
|
+
<p><b>Private Sub MyFun(ByVal xpos As Long, ByVal ypos As Long)</b>
|
|
130
|
+
|
|
131
|
+
<p>To register the callback function you should use the <b>AddressOf</b>
|
|
132
|
+
operator, like this:
|
|
133
|
+
|
|
134
|
+
<p> <b>glfwSetMousePosCallback AddressOf MyFun</b>
|
|
135
|
+
|
|
136
|
+
<p>Done!
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
<!----------------------------------------------------------------------->
|
|
141
|
+
<p><hr>
|
|
142
|
+
<!----------------------------------------------------------------------->
|
|
143
|
+
|
|
144
|
+
<a name="sec3">
|
|
145
|
+
<p><h2>3. The maintainer</h2>
|
|
146
|
+
|
|
147
|
+
<p>My name is Camilla Berglund,
|
|
148
|
+
<a href="mailto:elmindreda@users.sourceforge.net">elmindreda@users.sourceforge.net</a>.
|
|
149
|
+
Please visit our
|
|
150
|
+
<a href="http://sourceforge.net/projects/glfw/">support forums</a>
|
|
151
|
+
if you have any problems with GLFW or any questions concerning GLFW.
|
|
152
|
+
|
|
153
|
+
<p>The GLFW web site can be found here:
|
|
154
|
+
<a href="http://glfw.sourceforge.net/">http://glfw.sourceforge.net/</a>.
|
|
155
|
+
It contains the latest version of GLFW, news and other information that is
|
|
156
|
+
useful for OpenGL development.
|
|
157
|
+
|
|
158
|
+
<!----------------------------------------------------------------------->
|
|
159
|
+
<p><hr>
|
|
160
|
+
<!----------------------------------------------------------------------->
|
|
161
|
+
|
|
162
|
+
</body>
|
|
163
|
+
</html>
|
|
164
|
+
|
data/website/index.html
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
3
|
+
|
|
4
|
+
<head profile="http://gmpg.org/xfn/11">
|
|
5
|
+
<title>Ruby bindings for GLFW library</title>
|
|
6
|
+
<link rel="shortcut icon" href="image/favicon.ico" />
|
|
7
|
+
<link rel="stylesheet" href="style.css" type="text/css" media="screen" />
|
|
8
|
+
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
|
9
|
+
<meta http-equiv="content-language" content="en-us" />
|
|
10
|
+
<meta http-equiv="imagetoolbar" content="false" />
|
|
11
|
+
<meta name="author" content="Jan Dvorak" />
|
|
12
|
+
<meta name="copyright" content="Copyright (c) Jan Dvorak 2007" />
|
|
13
|
+
<meta name="description" content="Ruby bindings for GLFW library" />
|
|
14
|
+
<meta name="keywords" content="ruby glfw opengl bindings" />
|
|
15
|
+
<meta name="last-modified" content="Sat, 22 Oct 2007 02:00:00 GMT" />
|
|
16
|
+
<meta name="mssmarttagspreventparsing" content="true" />
|
|
17
|
+
<meta name="robots" content="index, follow, noarchive" />
|
|
18
|
+
<meta name="revisit-after" content="7 days" />
|
|
19
|
+
</head>
|
|
20
|
+
|
|
21
|
+
<body>
|
|
22
|
+
<div id="header">
|
|
23
|
+
<h1>Ruby bindings for GLFW library</h1>
|
|
24
|
+
</div>
|
|
25
|
+
<div id="content">
|
|
26
|
+
|
|
27
|
+
<h1>Introduction</h1>
|
|
28
|
+
<p>This project contains <a href="http://www.ruby-lang.org">Ruby</a> bindings for <a href="http://glfw.sourceforge.net">GLFW library</a>. The package
|
|
29
|
+
also includes the GLFW library itself, due to the fact that the library is small and generally not preinstalled on target operating systems.</p>
|
|
30
|
+
|
|
31
|
+
<p>GLFW is a free, Open Source, portable framework for <a href="http://www.opengl.org">OpenGL</a> application
|
|
32
|
+
development. In short, it is a single library providing a powerful,
|
|
33
|
+
portable API for otherwise operating system specific tasks such as
|
|
34
|
+
opening an OpenGL window, and reading keyboard, time, mouse and joystick
|
|
35
|
+
input.</p>
|
|
36
|
+
|
|
37
|
+
<p>Both the bindings and the GLFW library are licensed under <a href="http://www.opensource.org/licenses/zlib-license.php">zlib/libpng license</a>.</p>
|
|
38
|
+
|
|
39
|
+
<p>Currently tested and supported systems are Linux, Mac OS X and Windows, although any POSIX compatible system should work as well.</p>
|
|
40
|
+
|
|
41
|
+
<h1>Contact</h1>
|
|
42
|
+
|
|
43
|
+
<p> You can visit the <a href="http://rubyforge.org/projects/ruby-glfw/">project page</a> on rubyforge -
|
|
44
|
+
there you can fill in <a href="http://rubyforge.org/tracker/?atid=17530&group_id=4539&func=browse">bug reports</a> or join <a href="http://rubyforge.org/mail/?group_id=4539">mailing list</a>.</p>
|
|
45
|
+
<p> I can be reached directly at <a href="mailto:jan.dvorak@kraxnet.cz">jan.dvorak@kraxnet.cz</a></p>
|
|
46
|
+
|
|
47
|
+
<h1>Usage and API</h1>
|
|
48
|
+
<p>For usage information and API documentation see the <a href="rdoc/index.html">RDoc page</a>.</p>
|
|
49
|
+
|
|
50
|
+
<h1>Download</h1>
|
|
51
|
+
<p>Latest stable version: <a href="http://rubyforge.org/frs/?group_id=4539">0.9</a> / 23 Oct 2007</p>
|
|
52
|
+
<p>Changes from last version: </p>
|
|
53
|
+
<ul><li>None, first public release</li></ul>
|
|
54
|
+
<p>You can install directly from gems by typing '<b>gem install ruby-glfw</b>' (see below for notes)</p>
|
|
55
|
+
<p>Additionaly, you can also access the <a href="http://rubyforge.org/scm/?group_id=4539">SVN repository.</a></p>
|
|
56
|
+
|
|
57
|
+
<h1>Installation</h1>
|
|
58
|
+
<p>You need of course ruby(1.8.5+), C compiler, and rake and mkrf(0.20+) (both can be
|
|
59
|
+
installed from gems). You would probably want to install <a href="http://ruby-opengl.rubyforge.org">ruby-opengl</a>
|
|
60
|
+
as well, although it is not required for the installation process itself.</p>
|
|
61
|
+
|
|
62
|
+
<p><b>Windows notes:</b> Binary version of ruby-glfw gem is available for windows - for that you don't need C compiler, just
|
|
63
|
+
the ruby one-click installer and mkrf + rake from gems. In case you decide to compile the source gem, you will need the
|
|
64
|
+
same compiler that was used to compile the ruby binary (in case of the one-click installer it is MSVC 6.0). You may need to
|
|
65
|
+
tweak the Rakefile if you're using other compiler than MSVC.</p>
|
|
66
|
+
|
|
67
|
+
<p><b>Mac OS X notes:</b> You will need ruby version from ports (macports or fink), and also Xcode framework which you can
|
|
68
|
+
download from apple.</p>
|
|
69
|
+
|
|
70
|
+
<p><b>Linux notes:</b> On some distributions you may need aditional development packages, like xorg-dev or ruby1.8-dev.</p>
|
|
71
|
+
|
|
72
|
+
<h1>Limitations</h1>
|
|
73
|
+
|
|
74
|
+
<p>The GLFW threading is not implemented, as ruby has its own threading API.</p>
|
|
75
|
+
<p>glfwGetProcAddress is also not implemented, use ruby-opengl functions instead</p>
|
|
76
|
+
|
|
77
|
+
<p></p>
|
|
78
|
+
</div>
|
|
79
|
+
<div id="footer">
|
|
80
|
+
<p>Copyright © <a href="mailto:jan.dvorak@kraxnet.cz">Jan Dvorak</a> 2007 | Design by <a href="http://www.edg3.co.uk/">edg3.co.uk</a> via <a href="http://www.opendesigns.org/">Open Designs</a> | Valid <a href="http://jigsaw.w3.org/css-validator/">CSS</a> & <a href="http://validator.w3.org/">XHTML</a></p>
|
|
81
|
+
</div>
|
|
82
|
+
</body>
|
|
83
|
+
|
|
84
|
+
</html>
|
data/website/style.css
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Author : Christopher Robinson
|
|
3
|
+
Email : christopher@edg3.co.uk
|
|
4
|
+
Website : http://www.edg3.co.uk/
|
|
5
|
+
*/
|
|
6
|
+
* {
|
|
7
|
+
border:0;
|
|
8
|
+
margin:0;
|
|
9
|
+
padding:0;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/* general */
|
|
13
|
+
a {
|
|
14
|
+
color:#33c;
|
|
15
|
+
text-decoration:none;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
a:hover {
|
|
19
|
+
color:#33c;
|
|
20
|
+
text-decoration:underline;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/* body */
|
|
24
|
+
body {
|
|
25
|
+
background:#fafafa;
|
|
26
|
+
color:#555;
|
|
27
|
+
font:0.8em Arial, Helvetica, "bitstream vera sans", sans-serif;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* header */
|
|
31
|
+
#header {
|
|
32
|
+
border-bottom:1px solid #999;
|
|
33
|
+
height:80px;
|
|
34
|
+
margin:0 auto;
|
|
35
|
+
width:751px;
|
|
36
|
+
}
|
|
37
|
+
#header h1 {
|
|
38
|
+
color:#888;
|
|
39
|
+
font-size:300%;
|
|
40
|
+
letter-spacing:-3px;
|
|
41
|
+
text-align:right;
|
|
42
|
+
padding:5px;
|
|
43
|
+
margin-bottom:-20px;
|
|
44
|
+
}
|
|
45
|
+
#header h2 {
|
|
46
|
+
color:#CCC;
|
|
47
|
+
font-size:200%;
|
|
48
|
+
letter-spacing:-2px;
|
|
49
|
+
text-align:right;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/* navigation */
|
|
53
|
+
#navigation {
|
|
54
|
+
background:#fafafa;
|
|
55
|
+
border-right:1px solid #999;
|
|
56
|
+
margin:0 auto;
|
|
57
|
+
width:750px;
|
|
58
|
+
height:50px;
|
|
59
|
+
list-style:none;
|
|
60
|
+
}
|
|
61
|
+
#navigation li {
|
|
62
|
+
border-left:1px solid #999;
|
|
63
|
+
float:left;
|
|
64
|
+
width:124px;
|
|
65
|
+
list-style:none;
|
|
66
|
+
}
|
|
67
|
+
#navigation a {
|
|
68
|
+
color:#555;
|
|
69
|
+
display:block;
|
|
70
|
+
line-height:50px;
|
|
71
|
+
text-align:center;
|
|
72
|
+
}
|
|
73
|
+
#navigation a:hover {
|
|
74
|
+
background:#e3e3e3;
|
|
75
|
+
color:#555;
|
|
76
|
+
}
|
|
77
|
+
#navigation .active {
|
|
78
|
+
background:#e3e3e3;
|
|
79
|
+
color:#777;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/* content */
|
|
83
|
+
#content {
|
|
84
|
+
height:auto;
|
|
85
|
+
margin:0 auto;
|
|
86
|
+
padding:0 0 20px;
|
|
87
|
+
width:751px;
|
|
88
|
+
}
|
|
89
|
+
#content h1 {
|
|
90
|
+
border-bottom:1px dashed #999;
|
|
91
|
+
font-size:1.8em;
|
|
92
|
+
padding:20px 0 0;
|
|
93
|
+
}
|
|
94
|
+
#content p {
|
|
95
|
+
padding:20px 20px 0;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
#content ul {
|
|
99
|
+
padding:0 40px 0;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/* footer */
|
|
103
|
+
#footer {
|
|
104
|
+
border-top:1px solid #999;
|
|
105
|
+
height:50px;
|
|
106
|
+
margin:0 auto;
|
|
107
|
+
padding:10px;
|
|
108
|
+
text-align:center;
|
|
109
|
+
width:751px;
|
|
110
|
+
}
|