sgl 0.4.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +254 -234
- data/History.txt +6 -0
- data/Manifest.txt +10 -0
- data/Rakefile +27 -7
- data/examples/cocoa1-basic.rb +14 -14
- data/examples/cocoa10-transparent.rb +26 -26
- data/examples/cocoa11-application.rb +13 -13
- data/examples/cocoa2-draw.rb +23 -23
- data/examples/cocoa3-affine.rb +29 -29
- data/examples/cocoa4-font.rb +24 -24
- data/examples/cocoa5-image.rb +22 -22
- data/examples/cocoa6-sound.rb +24 -24
- data/examples/cocoa7-movie.rb +40 -40
- data/examples/cocoa8-movieoverlay.rb +42 -42
- data/examples/cocoa9-streaming.rb +40 -40
- data/examples/opengl1-basic.rb +14 -14
- data/examples/opengl11-application.rb +13 -13
- data/examples/opengl2-draw.rb +23 -23
- data/examples/opengl3-affine.rb +29 -29
- data/examples/sample1.rb +11 -11
- data/examples/sample10.rb +16 -16
- data/examples/sample11.rb +22 -22
- data/examples/sample11a.rb +33 -33
- data/examples/sample12.rb +30 -30
- data/examples/sample12a.rb +35 -35
- data/examples/sample13.rb +116 -116
- data/examples/sample15.rb +24 -24
- data/examples/sample16.rb +31 -31
- data/examples/sample16a.rb +35 -35
- data/examples/sample6.rb +18 -18
- data/examples/sample7.rb +16 -16
- data/examples/sample9.rb +20 -20
- data/examples/testgl.rb +169 -169
- data/lib/sgl/bass.rb +46 -46
- data/lib/sgl/cocoa-app.rb +43 -43
- data/lib/sgl/cocoa-color.rb +65 -65
- data/lib/sgl/cocoa-draw.rb +72 -72
- data/lib/sgl/cocoa-event.rb +229 -229
- data/lib/sgl/cocoa-media.rb +144 -144
- data/lib/sgl/cocoa-notuse.rb +493 -493
- data/lib/sgl/cocoa-window.rb +203 -203
- data/lib/sgl/cocoa.rb +8 -8
- data/lib/sgl/opengl-app.rb +38 -38
- data/lib/sgl/opengl-color.rb +44 -44
- data/lib/sgl/opengl-draw.rb +260 -260
- data/lib/sgl/opengl-event.rb +325 -325
- data/lib/sgl/opengl-modules.rb +22 -22
- data/lib/sgl/opengl-window.rb +224 -224
- data/lib/sgl/opengl.rb +7 -7
- data/lib/sgl/sgl-button.rb +135 -135
- data/lib/sgl/sgl-client.rb +21 -21
- data/lib/sgl/sgl-color.rb +68 -82
- data/lib/sgl/sgl-connect.rb +9 -9
- data/lib/sgl/sgl-server.rb +58 -58
- data/lib/sgl/sgl-spring.rb +216 -216
- data/lib/sgl/version.rb +2 -2
- data/scripts/lib-txt2html.rb +130 -0
- data/scripts/txt2html +2 -63
- data/spec/sgl_spec.rb +13 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +1 -0
- data/test/test_cocoa_app.rb +291 -291
- data/test/test_module_ruby16.rb +30 -30
- data/test/test_opengl_app.rb +147 -147
- data/test/test_opengl_basic.rb +22 -22
- data/test/test_opengl_fullscreen.rb +23 -23
- data/test/test_opengl_novice.rb +35 -35
- data/website/challenge1.html +91 -91
- data/website/challenge1.txt +3 -3
- data/website/challenge2.html +143 -144
- data/website/challenge2.txt +13 -14
- data/website/challenge3.html +66 -63
- data/website/challenge3.txt +7 -7
- data/website/cocoa.html +85 -88
- data/website/cocoa.txt +2 -4
- data/website/description.html +138 -138
- data/website/description.txt +1 -1
- data/website/exercise1.html +262 -264
- data/website/exercise1.txt +58 -53
- data/website/exercise2.html +241 -683
- data/website/exercise2.txt +11 -427
- data/website/exercise3.html +206 -0
- data/website/exercise3.txt +155 -0
- data/website/exercise4.html +198 -0
- data/website/exercise4.txt +151 -0
- data/website/exercise5.html +162 -0
- data/website/exercise5.txt +113 -0
- data/website/exhibition.html +84 -84
- data/website/howto.html +146 -134
- data/website/howto.txt +9 -0
- data/website/index.html +178 -178
- data/website/index.txt +20 -19
- data/website/sound.html +141 -141
- metadata +16 -3
data/lib/sgl/cocoa-window.rb
CHANGED
@@ -1,203 +1,203 @@
|
|
1
|
-
# Copyright (C) 2004-2007 Kouichirou Eto, All rights reserved.
|
2
|
-
# License: Ruby License
|
3
|
-
|
4
|
-
module SGL
|
5
|
-
# window functions
|
6
|
-
def window(*a) $__a__.window(*a); end
|
7
|
-
def close_window() $__a__.close_window; end
|
8
|
-
def width() $__a__.width; end
|
9
|
-
def height() $__a__.height; end
|
10
|
-
|
11
|
-
class Application
|
12
|
-
def initialize_window
|
13
|
-
@options = default_options
|
14
|
-
@win = @bgview = nil
|
15
|
-
@width = @height = nil
|
16
|
-
@oview = @movview = nil
|
17
|
-
@thread = nil
|
18
|
-
end
|
19
|
-
private :initialize_window
|
20
|
-
|
21
|
-
def default_options
|
22
|
-
{
|
23
|
-
:shadow=>true,
|
24
|
-
:border=>true,
|
25
|
-
:movie=>false,
|
26
|
-
:overlay=>false,
|
27
|
-
}
|
28
|
-
end
|
29
|
-
private :default_options
|
30
|
-
|
31
|
-
# create window
|
32
|
-
def window(*a)
|
33
|
-
return if @win
|
34
|
-
|
35
|
-
@options.update(a.pop) if a.last.is_a? Hash
|
36
|
-
|
37
|
-
if defined?($windowShadow)
|
38
|
-
@options[:shadow] = $windowShadow == 1
|
39
|
-
end
|
40
|
-
|
41
|
-
if defined?($windowBorder)
|
42
|
-
@options[:border] = $windowBorder == 1
|
43
|
-
end
|
44
|
-
|
45
|
-
if @block[:display_overlay]
|
46
|
-
@options[:overlay] = true
|
47
|
-
end
|
48
|
-
|
49
|
-
# get window size
|
50
|
-
case a.length
|
51
|
-
when 2
|
52
|
-
w, h = a
|
53
|
-
when 4
|
54
|
-
raise "not implemented" # x1, y1, x2, y3 = a
|
55
|
-
else
|
56
|
-
raise "please specify width and height"
|
57
|
-
end
|
58
|
-
@width, @height = w, h
|
59
|
-
|
60
|
-
cocoa_create_window(w, h)
|
61
|
-
end
|
62
|
-
|
63
|
-
def close_window
|
64
|
-
@win.close if @win
|
65
|
-
@win = @bgview = nil
|
66
|
-
end
|
67
|
-
|
68
|
-
attr_reader :width, :height
|
69
|
-
|
70
|
-
def cocoa_create_window(w, h)
|
71
|
-
@receiver = CocoaReceiver.alloc.init
|
72
|
-
@receiver.setApp(self)
|
73
|
-
|
74
|
-
# create a window
|
75
|
-
s = OSX::NSScreen.mainScreen.frame.size
|
76
|
-
x = (s.width - w) / 2.0
|
77
|
-
y = (s.height - h) / 2.0
|
78
|
-
win_frame = [x.to_f, y.to_f, w.to_f, h.to_f]
|
79
|
-
style = OSX::NSClosableWindowMask
|
80
|
-
style |= @options[:border] ? OSX::NSTitledWindowMask :
|
81
|
-
OSX::NSBorderlessWindowMask
|
82
|
-
win = NSWindow.alloc.
|
83
|
-
initWithContentRect(win_frame,
|
84
|
-
:styleMask, style,
|
85
|
-
:backing, OSX::NSBackingStoreBuffered,
|
86
|
-
:defer, true)
|
87
|
-
win.setTitle("sgl")
|
88
|
-
|
89
|
-
# create a view
|
90
|
-
view = SglNSView.alloc.init
|
91
|
-
view.setApp(self)
|
92
|
-
win.setContentView(view)
|
93
|
-
background(100) # white
|
94
|
-
color(0) # black
|
95
|
-
|
96
|
-
# for handling windowShouldClose
|
97
|
-
win.setDelegate(@receiver)
|
98
|
-
win.setOpaque(false) # can be transparent
|
99
|
-
win.setHasShadow(@options[:shadow])
|
100
|
-
win.setReleasedWhenClosed(false)
|
101
|
-
win.makeKeyAndOrderFront(@receiver)
|
102
|
-
win.orderFrontRegardless # show the window now
|
103
|
-
@win = win
|
104
|
-
@bgview = view
|
105
|
-
window_movie(@options) if @options[:movie]
|
106
|
-
#window_overlay(@options) if defined?(displayOverlay)
|
107
|
-
window_overlay(@options) if @options[:overlay]
|
108
|
-
@win
|
109
|
-
end
|
110
|
-
|
111
|
-
# sub view
|
112
|
-
def window_movie(options)
|
113
|
-
@movwin, @movview = make_view(@win, @bgview, NSViewForMovie, @options)
|
114
|
-
@win.addChildWindow(@movwin, :ordered, OSX::NSWindowAbove)
|
115
|
-
@movview.setNeedsDisplay(true)
|
116
|
-
@movwin
|
117
|
-
end
|
118
|
-
|
119
|
-
def window_overlay(options)
|
120
|
-
@owin, @oview = make_view(@win, @bgview, NSViewForOverlay, options)
|
121
|
-
win = options[:movie] ? @movwin : @win
|
122
|
-
win.addChildWindow(@owin, :ordered, OSX::NSWindowAbove)
|
123
|
-
@oview.setNeedsDisplay(true)
|
124
|
-
@owin
|
125
|
-
end
|
126
|
-
|
127
|
-
def make_view(parent_win, parent_view, viewclass, options)
|
128
|
-
o = parent_view.frame.origin
|
129
|
-
so = parent_win.convertBaseToScreen([o.x, o.y])
|
130
|
-
s = parent_view.frame.size
|
131
|
-
win_frame = [so.x, so.y, s.width, s.height]
|
132
|
-
win = NSWindow.alloc.
|
133
|
-
initWithContentRect(win_frame,
|
134
|
-
:styleMask, OSX::NSBorderlessWindowMask,
|
135
|
-
:backing, OSX::NSBackingStoreBuffered,
|
136
|
-
:defer, true)
|
137
|
-
win.setOpaque(false) # can be transparent
|
138
|
-
win.setHasShadow(false)
|
139
|
-
win.setIgnoresMouseEvents(true)
|
140
|
-
win.setAlphaValue(1.0) # transparent
|
141
|
-
b = parent_view.bounds
|
142
|
-
bo, bs = b.origin, b.size
|
143
|
-
frame = [bo.x, bo.y, bs.width, bs.height]
|
144
|
-
view = viewclass.alloc.initWithFrame(frame)
|
145
|
-
view.setApp(self)
|
146
|
-
win.contentView.addSubview(view)
|
147
|
-
win.orderFront(@receiver)
|
148
|
-
return win, view
|
149
|
-
end
|
150
|
-
private :window_movie, :window_overlay, :make_view
|
151
|
-
|
152
|
-
# Cocoa callback methods
|
153
|
-
def window_should_close
|
154
|
-
stop
|
155
|
-
end
|
156
|
-
end
|
157
|
-
|
158
|
-
class CocoaReceiver < OSX::NSObject
|
159
|
-
def init
|
160
|
-
@app = nil
|
161
|
-
return self
|
162
|
-
end
|
163
|
-
|
164
|
-
def setApp(app)
|
165
|
-
@app = app
|
166
|
-
end
|
167
|
-
|
168
|
-
# Cocoa callback methods
|
169
|
-
def windowShouldClose(sender)
|
170
|
-
@app.window_should_close
|
171
|
-
end
|
172
|
-
end
|
173
|
-
|
174
|
-
class NSWindow < OSX::NSWindow
|
175
|
-
end
|
176
|
-
|
177
|
-
# Do not use NSView for class name.
|
178
|
-
# It causes Illeagal Instruction Error.
|
179
|
-
# I don't know why.
|
180
|
-
class SglNSView < OSX::NSView
|
181
|
-
ns_overrides :drawRect_,
|
182
|
-
:mouseDown_, :mouseDragged_, :mouseUp_, :keyDown_, :keyUp_
|
183
|
-
def setApp(app) @app = app; end
|
184
|
-
def drawRect(rect) @app.display_all(rect); end
|
185
|
-
def mouseDown(event) @app.do_mousedown; end
|
186
|
-
def mouseDragged(event) end # ignore
|
187
|
-
def mouseUp(event) @app.do_mouseup; end
|
188
|
-
def keyDown(event) @app.do_keydown(event); end
|
189
|
-
def keyUp(event) @app.do_keyup(event); end
|
190
|
-
end
|
191
|
-
|
192
|
-
class NSViewForOverlay < OSX::NSView
|
193
|
-
ns_overrides :drawRect_
|
194
|
-
def setApp(app) @app = app; end
|
195
|
-
def drawRect(rect) @app.display_overlay_all(rect); end
|
196
|
-
end
|
197
|
-
|
198
|
-
class NSViewForMovie < OSX::NSView
|
199
|
-
ns_overrides :drawRect_
|
200
|
-
def setApp(app) @app = app; end
|
201
|
-
def drawRect(rect) @app.display_mov(rect); end
|
202
|
-
end
|
203
|
-
end
|
1
|
+
# Copyright (C) 2004-2007 Kouichirou Eto, All rights reserved.
|
2
|
+
# License: Ruby License
|
3
|
+
|
4
|
+
module SGL
|
5
|
+
# window functions
|
6
|
+
def window(*a) $__a__.window(*a); end
|
7
|
+
def close_window() $__a__.close_window; end
|
8
|
+
def width() $__a__.width; end
|
9
|
+
def height() $__a__.height; end
|
10
|
+
|
11
|
+
class Application
|
12
|
+
def initialize_window
|
13
|
+
@options = default_options
|
14
|
+
@win = @bgview = nil
|
15
|
+
@width = @height = nil
|
16
|
+
@oview = @movview = nil
|
17
|
+
@thread = nil
|
18
|
+
end
|
19
|
+
private :initialize_window
|
20
|
+
|
21
|
+
def default_options
|
22
|
+
{
|
23
|
+
:shadow=>true,
|
24
|
+
:border=>true,
|
25
|
+
:movie=>false,
|
26
|
+
:overlay=>false,
|
27
|
+
}
|
28
|
+
end
|
29
|
+
private :default_options
|
30
|
+
|
31
|
+
# create window
|
32
|
+
def window(*a)
|
33
|
+
return if @win
|
34
|
+
|
35
|
+
@options.update(a.pop) if a.last.is_a? Hash
|
36
|
+
|
37
|
+
if defined?($windowShadow)
|
38
|
+
@options[:shadow] = $windowShadow == 1
|
39
|
+
end
|
40
|
+
|
41
|
+
if defined?($windowBorder)
|
42
|
+
@options[:border] = $windowBorder == 1
|
43
|
+
end
|
44
|
+
|
45
|
+
if @block[:display_overlay]
|
46
|
+
@options[:overlay] = true
|
47
|
+
end
|
48
|
+
|
49
|
+
# get window size
|
50
|
+
case a.length
|
51
|
+
when 2
|
52
|
+
w, h = a
|
53
|
+
when 4
|
54
|
+
raise "not implemented" # x1, y1, x2, y3 = a
|
55
|
+
else
|
56
|
+
raise "please specify width and height"
|
57
|
+
end
|
58
|
+
@width, @height = w, h
|
59
|
+
|
60
|
+
cocoa_create_window(w, h)
|
61
|
+
end
|
62
|
+
|
63
|
+
def close_window
|
64
|
+
@win.close if @win
|
65
|
+
@win = @bgview = nil
|
66
|
+
end
|
67
|
+
|
68
|
+
attr_reader :width, :height
|
69
|
+
|
70
|
+
def cocoa_create_window(w, h)
|
71
|
+
@receiver = CocoaReceiver.alloc.init
|
72
|
+
@receiver.setApp(self)
|
73
|
+
|
74
|
+
# create a window
|
75
|
+
s = OSX::NSScreen.mainScreen.frame.size
|
76
|
+
x = (s.width - w) / 2.0
|
77
|
+
y = (s.height - h) / 2.0
|
78
|
+
win_frame = [x.to_f, y.to_f, w.to_f, h.to_f]
|
79
|
+
style = OSX::NSClosableWindowMask
|
80
|
+
style |= @options[:border] ? OSX::NSTitledWindowMask :
|
81
|
+
OSX::NSBorderlessWindowMask
|
82
|
+
win = NSWindow.alloc.
|
83
|
+
initWithContentRect(win_frame,
|
84
|
+
:styleMask, style,
|
85
|
+
:backing, OSX::NSBackingStoreBuffered,
|
86
|
+
:defer, true)
|
87
|
+
win.setTitle("sgl")
|
88
|
+
|
89
|
+
# create a view
|
90
|
+
view = SglNSView.alloc.init
|
91
|
+
view.setApp(self)
|
92
|
+
win.setContentView(view)
|
93
|
+
background(100) # white
|
94
|
+
color(0) # black
|
95
|
+
|
96
|
+
# for handling windowShouldClose
|
97
|
+
win.setDelegate(@receiver)
|
98
|
+
win.setOpaque(false) # can be transparent
|
99
|
+
win.setHasShadow(@options[:shadow])
|
100
|
+
win.setReleasedWhenClosed(false)
|
101
|
+
win.makeKeyAndOrderFront(@receiver)
|
102
|
+
win.orderFrontRegardless # show the window now
|
103
|
+
@win = win
|
104
|
+
@bgview = view
|
105
|
+
window_movie(@options) if @options[:movie]
|
106
|
+
#window_overlay(@options) if defined?(displayOverlay)
|
107
|
+
window_overlay(@options) if @options[:overlay]
|
108
|
+
@win
|
109
|
+
end
|
110
|
+
|
111
|
+
# sub view
|
112
|
+
def window_movie(options)
|
113
|
+
@movwin, @movview = make_view(@win, @bgview, NSViewForMovie, @options)
|
114
|
+
@win.addChildWindow(@movwin, :ordered, OSX::NSWindowAbove)
|
115
|
+
@movview.setNeedsDisplay(true)
|
116
|
+
@movwin
|
117
|
+
end
|
118
|
+
|
119
|
+
def window_overlay(options)
|
120
|
+
@owin, @oview = make_view(@win, @bgview, NSViewForOverlay, options)
|
121
|
+
win = options[:movie] ? @movwin : @win
|
122
|
+
win.addChildWindow(@owin, :ordered, OSX::NSWindowAbove)
|
123
|
+
@oview.setNeedsDisplay(true)
|
124
|
+
@owin
|
125
|
+
end
|
126
|
+
|
127
|
+
def make_view(parent_win, parent_view, viewclass, options)
|
128
|
+
o = parent_view.frame.origin
|
129
|
+
so = parent_win.convertBaseToScreen([o.x, o.y])
|
130
|
+
s = parent_view.frame.size
|
131
|
+
win_frame = [so.x, so.y, s.width, s.height]
|
132
|
+
win = NSWindow.alloc.
|
133
|
+
initWithContentRect(win_frame,
|
134
|
+
:styleMask, OSX::NSBorderlessWindowMask,
|
135
|
+
:backing, OSX::NSBackingStoreBuffered,
|
136
|
+
:defer, true)
|
137
|
+
win.setOpaque(false) # can be transparent
|
138
|
+
win.setHasShadow(false)
|
139
|
+
win.setIgnoresMouseEvents(true)
|
140
|
+
win.setAlphaValue(1.0) # transparent
|
141
|
+
b = parent_view.bounds
|
142
|
+
bo, bs = b.origin, b.size
|
143
|
+
frame = [bo.x, bo.y, bs.width, bs.height]
|
144
|
+
view = viewclass.alloc.initWithFrame(frame)
|
145
|
+
view.setApp(self)
|
146
|
+
win.contentView.addSubview(view)
|
147
|
+
win.orderFront(@receiver)
|
148
|
+
return win, view
|
149
|
+
end
|
150
|
+
private :window_movie, :window_overlay, :make_view
|
151
|
+
|
152
|
+
# Cocoa callback methods
|
153
|
+
def window_should_close
|
154
|
+
stop
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
class CocoaReceiver < OSX::NSObject
|
159
|
+
def init
|
160
|
+
@app = nil
|
161
|
+
return self
|
162
|
+
end
|
163
|
+
|
164
|
+
def setApp(app)
|
165
|
+
@app = app
|
166
|
+
end
|
167
|
+
|
168
|
+
# Cocoa callback methods
|
169
|
+
def windowShouldClose(sender)
|
170
|
+
@app.window_should_close
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
class NSWindow < OSX::NSWindow
|
175
|
+
end
|
176
|
+
|
177
|
+
# Do not use NSView for class name.
|
178
|
+
# It causes Illeagal Instruction Error.
|
179
|
+
# I don't know why.
|
180
|
+
class SglNSView < OSX::NSView
|
181
|
+
ns_overrides :drawRect_,
|
182
|
+
:mouseDown_, :mouseDragged_, :mouseUp_, :keyDown_, :keyUp_
|
183
|
+
def setApp(app) @app = app; end
|
184
|
+
def drawRect(rect) @app.display_all(rect); end
|
185
|
+
def mouseDown(event) @app.do_mousedown; end
|
186
|
+
def mouseDragged(event) end # ignore
|
187
|
+
def mouseUp(event) @app.do_mouseup; end
|
188
|
+
def keyDown(event) @app.do_keydown(event); end
|
189
|
+
def keyUp(event) @app.do_keyup(event); end
|
190
|
+
end
|
191
|
+
|
192
|
+
class NSViewForOverlay < OSX::NSView
|
193
|
+
ns_overrides :drawRect_
|
194
|
+
def setApp(app) @app = app; end
|
195
|
+
def drawRect(rect) @app.display_overlay_all(rect); end
|
196
|
+
end
|
197
|
+
|
198
|
+
class NSViewForMovie < OSX::NSView
|
199
|
+
ns_overrides :drawRect_
|
200
|
+
def setApp(app) @app = app; end
|
201
|
+
def drawRect(rect) @app.display_mov(rect); end
|
202
|
+
end
|
203
|
+
end
|
data/lib/sgl/cocoa.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
# Copyright (C) 2004-2007 Kouichirou Eto, All rights reserved.
|
2
|
-
# License: Ruby License
|
3
|
-
|
4
|
-
require "sgl/cocoa-app"
|
5
|
-
require "sgl/cocoa-functions"
|
6
|
-
|
7
|
-
include SGL
|
8
|
-
$__a__ = Application.new
|
1
|
+
# Copyright (C) 2004-2007 Kouichirou Eto, All rights reserved.
|
2
|
+
# License: Ruby License
|
3
|
+
|
4
|
+
require "sgl/cocoa-app"
|
5
|
+
require "sgl/cocoa-functions"
|
6
|
+
|
7
|
+
include SGL
|
8
|
+
$__a__ = Application.new
|
data/lib/sgl/opengl-app.rb
CHANGED
@@ -1,38 +1,38 @@
|
|
1
|
-
# Copyright (C) 2004-2007 Kouichirou Eto, All rights reserved.
|
2
|
-
# License: Ruby License
|
3
|
-
|
4
|
-
require "sdl"
|
5
|
-
require "opengl"
|
6
|
-
require "sgl/sgl-color"
|
7
|
-
require "sgl/opengl-window"
|
8
|
-
require "sgl/opengl-color"
|
9
|
-
require "sgl/opengl-event"
|
10
|
-
require "sgl/opengl-draw"
|
11
|
-
require "sgl/sgl-sound"
|
12
|
-
|
13
|
-
module SGL
|
14
|
-
class Application
|
15
|
-
def initialize
|
16
|
-
Thread.abort_on_exception = true
|
17
|
-
@options = default_options
|
18
|
-
initialize_window # opengl-window.rb
|
19
|
-
initialize_color # sgl-color.rb
|
20
|
-
initialize_event # opengl-event.rb
|
21
|
-
end
|
22
|
-
|
23
|
-
def default_options
|
24
|
-
{
|
25
|
-
:fullscreen=>nil,
|
26
|
-
:fov=>45,
|
27
|
-
:cursor=>nil,
|
28
|
-
:depth=>false,
|
29
|
-
:culling=>false,
|
30
|
-
:smooth=>false,
|
31
|
-
:delaytime=>1.0/60,
|
32
|
-
:framerate=>nil,
|
33
|
-
:runtime=>nil,
|
34
|
-
}
|
35
|
-
end
|
36
|
-
private :default_options
|
37
|
-
end
|
38
|
-
end
|
1
|
+
# Copyright (C) 2004-2007 Kouichirou Eto, All rights reserved.
|
2
|
+
# License: Ruby License
|
3
|
+
|
4
|
+
require "sdl"
|
5
|
+
require "opengl"
|
6
|
+
require "sgl/sgl-color"
|
7
|
+
require "sgl/opengl-window"
|
8
|
+
require "sgl/opengl-color"
|
9
|
+
require "sgl/opengl-event"
|
10
|
+
require "sgl/opengl-draw"
|
11
|
+
require "sgl/sgl-sound"
|
12
|
+
|
13
|
+
module SGL
|
14
|
+
class Application
|
15
|
+
def initialize
|
16
|
+
Thread.abort_on_exception = true
|
17
|
+
@options = default_options
|
18
|
+
initialize_window # opengl-window.rb
|
19
|
+
initialize_color # sgl-color.rb
|
20
|
+
initialize_event # opengl-event.rb
|
21
|
+
end
|
22
|
+
|
23
|
+
def default_options
|
24
|
+
{
|
25
|
+
:fullscreen=>nil,
|
26
|
+
:fov=>45,
|
27
|
+
:cursor=>nil,
|
28
|
+
:depth=>false,
|
29
|
+
:culling=>false,
|
30
|
+
:smooth=>false,
|
31
|
+
:delaytime=>1.0/60,
|
32
|
+
:framerate=>nil,
|
33
|
+
:runtime=>nil,
|
34
|
+
}
|
35
|
+
end
|
36
|
+
private :default_options
|
37
|
+
end
|
38
|
+
end
|