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/test/test_module_ruby16.rb
CHANGED
@@ -1,30 +1,30 @@
|
|
1
|
-
# Copyright (C) 2004-2007 Kouichirou Eto, All rights reserved.
|
2
|
-
# License: Ruby License
|
3
|
-
|
4
|
-
# only for Ruby 1.6
|
5
|
-
if /\A1\.6/ =~ RUBY_VERSION
|
6
|
-
class Array
|
7
|
-
def fetch(n)
|
8
|
-
a = self[n]
|
9
|
-
if a.nil?
|
10
|
-
a = yield
|
11
|
-
end
|
12
|
-
a
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
module Enumerable
|
17
|
-
def sort_by
|
18
|
-
self.collect {|i| [yield(i), i]}.
|
19
|
-
sort {|a,b| a[0] <=> b[0]}.
|
20
|
-
collect! {|i| i[1]}
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
alias org_exit exit
|
25
|
-
def exit(n)
|
26
|
-
n = 0 if n == true
|
27
|
-
n = 1 if n == false
|
28
|
-
org_exit(n)
|
29
|
-
end
|
30
|
-
end
|
1
|
+
# Copyright (C) 2004-2007 Kouichirou Eto, All rights reserved.
|
2
|
+
# License: Ruby License
|
3
|
+
|
4
|
+
# only for Ruby 1.6
|
5
|
+
if /\A1\.6/ =~ RUBY_VERSION
|
6
|
+
class Array
|
7
|
+
def fetch(n)
|
8
|
+
a = self[n]
|
9
|
+
if a.nil?
|
10
|
+
a = yield
|
11
|
+
end
|
12
|
+
a
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
module Enumerable
|
17
|
+
def sort_by
|
18
|
+
self.collect {|i| [yield(i), i]}.
|
19
|
+
sort {|a,b| a[0] <=> b[0]}.
|
20
|
+
collect! {|i| i[1]}
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
alias org_exit exit
|
25
|
+
def exit(n)
|
26
|
+
n = 0 if n == true
|
27
|
+
n = 1 if n == false
|
28
|
+
org_exit(n)
|
29
|
+
end
|
30
|
+
end
|
data/test/test_opengl_app.rb
CHANGED
@@ -1,147 +1,147 @@
|
|
1
|
-
#!/usr/bin/env ruby -w
|
2
|
-
# Copyright (C) 2004-2007 Kouichirou Eto, All rights reserved.
|
3
|
-
# License: Ruby License
|
4
|
-
|
5
|
-
require File.dirname(__FILE__) + '/test_helper.rb'
|
6
|
-
|
7
|
-
class TestOpenglBasic < Test::Unit::TestCase
|
8
|
-
def test_basic
|
9
|
-
app = SGL::Application.new
|
10
|
-
app.set_setup {
|
11
|
-
app.window(100, 100)
|
12
|
-
app.runtime = 0.1
|
13
|
-
}
|
14
|
-
i = 0
|
15
|
-
app.set_display {
|
16
|
-
app.line(0, 0, 100, i*5)
|
17
|
-
i += 2
|
18
|
-
i = 0 if 20 < i
|
19
|
-
}
|
20
|
-
app.mainloop
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_window
|
24
|
-
app = SGL::Application.new
|
25
|
-
sleep 0.01; app.window(100, 100)
|
26
|
-
sleep 0.01; app.close_window
|
27
|
-
sleep 0.01; app.window(500, 500)
|
28
|
-
sleep 0.01; app.close_window
|
29
|
-
sleep 0.01; app.window(100, 100, :border=>false)
|
30
|
-
sleep 0.01; app.close_window
|
31
|
-
sleep 0.01; app.window(100, 100, :shadow=>false, :border=>false)
|
32
|
-
sleep 0.01; app.close_window
|
33
|
-
end
|
34
|
-
|
35
|
-
def nutest_color
|
36
|
-
app = SGL::Application.new
|
37
|
-
app.window(100, 100)
|
38
|
-
app.background(100)
|
39
|
-
bgcolor = app.instance_eval { @bgcolor }
|
40
|
-
assert_equal([1.0, 1.0, 1.0, 1.0], bgcolor)
|
41
|
-
app.background(10, 20, 30)
|
42
|
-
bgcolor = app.instance_eval { @bgcolor }
|
43
|
-
assert_equal([0.1, 0.2, 0.3, 1.0], bgcolor)
|
44
|
-
app.color(0)
|
45
|
-
curcolor = app.instance_eval { @curcolor }
|
46
|
-
assert_equal([0.0, 0.0, 0.0, 1.0], curcolor)
|
47
|
-
app.color(10, 20, 30)
|
48
|
-
curcolor = app.instance_eval { @curcolor }
|
49
|
-
assert_equal([0.1, 0.2, 0.3, 1.0], curcolor)
|
50
|
-
app.close_window
|
51
|
-
end
|
52
|
-
|
53
|
-
def test_setup_and_display
|
54
|
-
app = SGL::Application.new
|
55
|
-
app.window(100, 100)
|
56
|
-
|
57
|
-
test_setup_done = false
|
58
|
-
app.set_setup { test_setup_done = true }
|
59
|
-
assert_equal(false, test_setup_done)
|
60
|
-
app.do_setup
|
61
|
-
assert_equal(true, test_setup_done)
|
62
|
-
|
63
|
-
test_display_done = false
|
64
|
-
app.set_display { test_display_done = true }
|
65
|
-
assert_equal(false, test_display_done)
|
66
|
-
app.do_display
|
67
|
-
assert_equal(true, test_display_done)
|
68
|
-
app.close_window
|
69
|
-
end
|
70
|
-
|
71
|
-
def test_event
|
72
|
-
app = SGL::Application.new
|
73
|
-
app.window(100, 100)
|
74
|
-
|
75
|
-
test = {}
|
76
|
-
app.set_mousedown { test[:mousedown] = true }
|
77
|
-
assert_equal(nil, test[:mousedown])
|
78
|
-
app.do_mousedown
|
79
|
-
assert_equal(true, test[:mousedown])
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
class TestCocoaDraw < Test::Unit::TestCase
|
84
|
-
def test_commands
|
85
|
-
app = SGL::Application.new
|
86
|
-
app.set_setup {
|
87
|
-
app.window(100, 100)
|
88
|
-
app.runtime = 0.1
|
89
|
-
}
|
90
|
-
app.set_display {
|
91
|
-
app.line(0, 0, 100, 100)
|
92
|
-
app.rect(40, 40, 60, 60)
|
93
|
-
app.circle(20, 20, 10)
|
94
|
-
}
|
95
|
-
app.mainloop
|
96
|
-
end
|
97
|
-
|
98
|
-
def test_for
|
99
|
-
app = SGL::Application.new
|
100
|
-
app.set_setup {
|
101
|
-
app.window(100, 100)
|
102
|
-
app.runtime = 0.1
|
103
|
-
}
|
104
|
-
app.set_display {
|
105
|
-
for i in 0..20
|
106
|
-
app.line(0, 0, 100, i*5)
|
107
|
-
end
|
108
|
-
}
|
109
|
-
app.mainloop
|
110
|
-
end
|
111
|
-
|
112
|
-
def test_iterate
|
113
|
-
app = SGL::Application.new
|
114
|
-
app.set_setup {
|
115
|
-
app.window(100, 100)
|
116
|
-
app.runtime = 0.2
|
117
|
-
}
|
118
|
-
i = 0
|
119
|
-
app.set_display {
|
120
|
-
app.line(0, 0, 100, i*5)
|
121
|
-
i += 1
|
122
|
-
i = 0 if 20 < i
|
123
|
-
}
|
124
|
-
app.mainloop
|
125
|
-
end
|
126
|
-
|
127
|
-
def test_affine
|
128
|
-
app = SGL::Application.new
|
129
|
-
app.set_setup {
|
130
|
-
app.window(300, 300)
|
131
|
-
app.runtime = 0.2
|
132
|
-
}
|
133
|
-
i = 0
|
134
|
-
app.set_display {
|
135
|
-
app.colorHSV 66, 100, 100, 50
|
136
|
-
app.lineWidth(i/10)
|
137
|
-
app.line(0, 0, 300, i)
|
138
|
-
app.translate i, i
|
139
|
-
app.rotateZ i
|
140
|
-
app.colorHSV i, 100, 100
|
141
|
-
app.rect(-10, -10, +10, +10)
|
142
|
-
i += 20
|
143
|
-
i = 0 if 300 < i
|
144
|
-
}
|
145
|
-
app.mainloop
|
146
|
-
end
|
147
|
-
end
|
1
|
+
#!/usr/bin/env ruby -w
|
2
|
+
# Copyright (C) 2004-2007 Kouichirou Eto, All rights reserved.
|
3
|
+
# License: Ruby License
|
4
|
+
|
5
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
6
|
+
|
7
|
+
class TestOpenglBasic < Test::Unit::TestCase
|
8
|
+
def test_basic
|
9
|
+
app = SGL::Application.new
|
10
|
+
app.set_setup {
|
11
|
+
app.window(100, 100)
|
12
|
+
app.runtime = 0.1
|
13
|
+
}
|
14
|
+
i = 0
|
15
|
+
app.set_display {
|
16
|
+
app.line(0, 0, 100, i*5)
|
17
|
+
i += 2
|
18
|
+
i = 0 if 20 < i
|
19
|
+
}
|
20
|
+
app.mainloop
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_window
|
24
|
+
app = SGL::Application.new
|
25
|
+
sleep 0.01; app.window(100, 100)
|
26
|
+
sleep 0.01; app.close_window
|
27
|
+
sleep 0.01; app.window(500, 500)
|
28
|
+
sleep 0.01; app.close_window
|
29
|
+
sleep 0.01; app.window(100, 100, :border=>false)
|
30
|
+
sleep 0.01; app.close_window
|
31
|
+
sleep 0.01; app.window(100, 100, :shadow=>false, :border=>false)
|
32
|
+
sleep 0.01; app.close_window
|
33
|
+
end
|
34
|
+
|
35
|
+
def nutest_color
|
36
|
+
app = SGL::Application.new
|
37
|
+
app.window(100, 100)
|
38
|
+
app.background(100)
|
39
|
+
bgcolor = app.instance_eval { @bgcolor }
|
40
|
+
assert_equal([1.0, 1.0, 1.0, 1.0], bgcolor)
|
41
|
+
app.background(10, 20, 30)
|
42
|
+
bgcolor = app.instance_eval { @bgcolor }
|
43
|
+
assert_equal([0.1, 0.2, 0.3, 1.0], bgcolor)
|
44
|
+
app.color(0)
|
45
|
+
curcolor = app.instance_eval { @curcolor }
|
46
|
+
assert_equal([0.0, 0.0, 0.0, 1.0], curcolor)
|
47
|
+
app.color(10, 20, 30)
|
48
|
+
curcolor = app.instance_eval { @curcolor }
|
49
|
+
assert_equal([0.1, 0.2, 0.3, 1.0], curcolor)
|
50
|
+
app.close_window
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_setup_and_display
|
54
|
+
app = SGL::Application.new
|
55
|
+
app.window(100, 100)
|
56
|
+
|
57
|
+
test_setup_done = false
|
58
|
+
app.set_setup { test_setup_done = true }
|
59
|
+
assert_equal(false, test_setup_done)
|
60
|
+
app.do_setup
|
61
|
+
assert_equal(true, test_setup_done)
|
62
|
+
|
63
|
+
test_display_done = false
|
64
|
+
app.set_display { test_display_done = true }
|
65
|
+
assert_equal(false, test_display_done)
|
66
|
+
app.do_display
|
67
|
+
assert_equal(true, test_display_done)
|
68
|
+
app.close_window
|
69
|
+
end
|
70
|
+
|
71
|
+
def test_event
|
72
|
+
app = SGL::Application.new
|
73
|
+
app.window(100, 100)
|
74
|
+
|
75
|
+
test = {}
|
76
|
+
app.set_mousedown { test[:mousedown] = true }
|
77
|
+
assert_equal(nil, test[:mousedown])
|
78
|
+
app.do_mousedown
|
79
|
+
assert_equal(true, test[:mousedown])
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
class TestCocoaDraw < Test::Unit::TestCase
|
84
|
+
def test_commands
|
85
|
+
app = SGL::Application.new
|
86
|
+
app.set_setup {
|
87
|
+
app.window(100, 100)
|
88
|
+
app.runtime = 0.1
|
89
|
+
}
|
90
|
+
app.set_display {
|
91
|
+
app.line(0, 0, 100, 100)
|
92
|
+
app.rect(40, 40, 60, 60)
|
93
|
+
app.circle(20, 20, 10)
|
94
|
+
}
|
95
|
+
app.mainloop
|
96
|
+
end
|
97
|
+
|
98
|
+
def test_for
|
99
|
+
app = SGL::Application.new
|
100
|
+
app.set_setup {
|
101
|
+
app.window(100, 100)
|
102
|
+
app.runtime = 0.1
|
103
|
+
}
|
104
|
+
app.set_display {
|
105
|
+
for i in 0..20
|
106
|
+
app.line(0, 0, 100, i*5)
|
107
|
+
end
|
108
|
+
}
|
109
|
+
app.mainloop
|
110
|
+
end
|
111
|
+
|
112
|
+
def test_iterate
|
113
|
+
app = SGL::Application.new
|
114
|
+
app.set_setup {
|
115
|
+
app.window(100, 100)
|
116
|
+
app.runtime = 0.2
|
117
|
+
}
|
118
|
+
i = 0
|
119
|
+
app.set_display {
|
120
|
+
app.line(0, 0, 100, i*5)
|
121
|
+
i += 1
|
122
|
+
i = 0 if 20 < i
|
123
|
+
}
|
124
|
+
app.mainloop
|
125
|
+
end
|
126
|
+
|
127
|
+
def test_affine
|
128
|
+
app = SGL::Application.new
|
129
|
+
app.set_setup {
|
130
|
+
app.window(300, 300)
|
131
|
+
app.runtime = 0.2
|
132
|
+
}
|
133
|
+
i = 0
|
134
|
+
app.set_display {
|
135
|
+
app.colorHSV 66, 100, 100, 50
|
136
|
+
app.lineWidth(i/10)
|
137
|
+
app.line(0, 0, 300, i)
|
138
|
+
app.translate i, i
|
139
|
+
app.rotateZ i
|
140
|
+
app.colorHSV i, 100, 100
|
141
|
+
app.rect(-10, -10, +10, +10)
|
142
|
+
i += 20
|
143
|
+
i = 0 if 300 < i
|
144
|
+
}
|
145
|
+
app.mainloop
|
146
|
+
end
|
147
|
+
end
|
data/test/test_opengl_basic.rb
CHANGED
@@ -1,22 +1,22 @@
|
|
1
|
-
#!/usr/bin/env ruby -w
|
2
|
-
# Copyright (C) 2004-2007 Kouichirou Eto, All rights reserved.
|
3
|
-
# License: Ruby License
|
4
|
-
|
5
|
-
require File.dirname(__FILE__) + '/test_helper.rb'
|
6
|
-
|
7
|
-
class TestOpenGLBasic < Test::Unit::TestCase
|
8
|
-
def test_all
|
9
|
-
app = SGL::Application.new
|
10
|
-
app.set_setup {
|
11
|
-
app.window(100, 100)
|
12
|
-
app.runtime = 0.1
|
13
|
-
}
|
14
|
-
@i = 0
|
15
|
-
app.set_display {
|
16
|
-
app.line(0, 0, 100, @i*5)
|
17
|
-
@i += 2
|
18
|
-
@i = 0 if 20 < @i
|
19
|
-
}
|
20
|
-
app.mainloop
|
21
|
-
end
|
22
|
-
end
|
1
|
+
#!/usr/bin/env ruby -w
|
2
|
+
# Copyright (C) 2004-2007 Kouichirou Eto, All rights reserved.
|
3
|
+
# License: Ruby License
|
4
|
+
|
5
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
6
|
+
|
7
|
+
class TestOpenGLBasic < Test::Unit::TestCase
|
8
|
+
def test_all
|
9
|
+
app = SGL::Application.new
|
10
|
+
app.set_setup {
|
11
|
+
app.window(100, 100)
|
12
|
+
app.runtime = 0.1
|
13
|
+
}
|
14
|
+
@i = 0
|
15
|
+
app.set_display {
|
16
|
+
app.line(0, 0, 100, @i*5)
|
17
|
+
@i += 2
|
18
|
+
@i = 0 if 20 < @i
|
19
|
+
}
|
20
|
+
app.mainloop
|
21
|
+
end
|
22
|
+
end
|
@@ -1,23 +1,23 @@
|
|
1
|
-
#!/usr/bin/env ruby -w
|
2
|
-
# Copyright (C) 2004-2007 Kouichirou Eto, All rights reserved.
|
3
|
-
# License: Ruby License
|
4
|
-
|
5
|
-
require File.dirname(__FILE__) + '/test_helper.rb'
|
6
|
-
|
7
|
-
class TestOpenGLFullscreen < Test::Unit::TestCase
|
8
|
-
def test_all
|
9
|
-
app = SGL::Application.new
|
10
|
-
app.set_setup {
|
11
|
-
app.useFullscreen(1024, 768)
|
12
|
-
app.window(100, 100)
|
13
|
-
app.runtime = 0.1
|
14
|
-
}
|
15
|
-
@i = 0
|
16
|
-
app.set_display {
|
17
|
-
app.line(0, 0, 100, @i*5)
|
18
|
-
@i += 2
|
19
|
-
@i = 0 if 20 < @i
|
20
|
-
}
|
21
|
-
app.mainloop
|
22
|
-
end
|
23
|
-
end
|
1
|
+
#!/usr/bin/env ruby -w
|
2
|
+
# Copyright (C) 2004-2007 Kouichirou Eto, All rights reserved.
|
3
|
+
# License: Ruby License
|
4
|
+
|
5
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
6
|
+
|
7
|
+
class TestOpenGLFullscreen < Test::Unit::TestCase
|
8
|
+
def test_all
|
9
|
+
app = SGL::Application.new
|
10
|
+
app.set_setup {
|
11
|
+
app.useFullscreen(1024, 768)
|
12
|
+
app.window(100, 100)
|
13
|
+
app.runtime = 0.1
|
14
|
+
}
|
15
|
+
@i = 0
|
16
|
+
app.set_display {
|
17
|
+
app.line(0, 0, 100, @i*5)
|
18
|
+
@i += 2
|
19
|
+
@i = 0 if 20 < @i
|
20
|
+
}
|
21
|
+
app.mainloop
|
22
|
+
end
|
23
|
+
end
|
data/test/test_opengl_novice.rb
CHANGED
@@ -1,35 +1,35 @@
|
|
1
|
-
#!/usr/bin/env ruby -w
|
2
|
-
# Copyright (C) 2004-2007 Kouichirou Eto, All rights reserved.
|
3
|
-
# License: Ruby License
|
4
|
-
|
5
|
-
require File.dirname(__FILE__) + '/test_helper.rb'
|
6
|
-
|
7
|
-
if $0 == __FILE__
|
8
|
-
class TestOpenGLNovice < Test::Unit::TestCase
|
9
|
-
def test_1st
|
10
|
-
window 100, 100
|
11
|
-
useRuntime(0.1)
|
12
|
-
for i in 0..20
|
13
|
-
line 0, 0, 100, i*2*5
|
14
|
-
flip
|
15
|
-
end
|
16
|
-
wait
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_2nd
|
20
|
-
window 400, 400
|
21
|
-
useRuntime(0.1)
|
22
|
-
useSmooth
|
23
|
-
process {
|
24
|
-
mx = mouseX
|
25
|
-
my = mouseY
|
26
|
-
push
|
27
|
-
translate mx, my
|
28
|
-
colorHSV(-mx+60, my, 100)
|
29
|
-
rect 0, 0, 100, 100
|
30
|
-
pop
|
31
|
-
flip
|
32
|
-
}
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
1
|
+
#!/usr/bin/env ruby -w
|
2
|
+
# Copyright (C) 2004-2007 Kouichirou Eto, All rights reserved.
|
3
|
+
# License: Ruby License
|
4
|
+
|
5
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
6
|
+
|
7
|
+
if $0 == __FILE__
|
8
|
+
class TestOpenGLNovice < Test::Unit::TestCase
|
9
|
+
def test_1st
|
10
|
+
window 100, 100
|
11
|
+
useRuntime(0.1)
|
12
|
+
for i in 0..20
|
13
|
+
line 0, 0, 100, i*2*5
|
14
|
+
flip
|
15
|
+
end
|
16
|
+
wait
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_2nd
|
20
|
+
window 400, 400
|
21
|
+
useRuntime(0.1)
|
22
|
+
useSmooth
|
23
|
+
process {
|
24
|
+
mx = mouseX
|
25
|
+
my = mouseY
|
26
|
+
push
|
27
|
+
translate mx, my
|
28
|
+
colorHSV(-mx+60, my, 100)
|
29
|
+
rect 0, 0, 100, 100
|
30
|
+
pop
|
31
|
+
flip
|
32
|
+
}
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|