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/website/index.txt
CHANGED
@@ -14,7 +14,7 @@ h3. Windows
|
|
14
14
|
* Ruby/SDL
|
15
15
|
|
16
16
|
You can see "Ruby/SDL on Windows":http://eto.com/d/RubySDLonWindows.html
|
17
|
-
|
17
|
+
install documnet.
|
18
18
|
|
19
19
|
h3. Mac OS X
|
20
20
|
|
@@ -28,18 +28,16 @@ h2. Installing
|
|
28
28
|
|
29
29
|
h2. The basics
|
30
30
|
|
31
|
-
Save this progarm as @test1.rb@.
|
32
31
|
<pre syntax="ruby">
|
32
|
+
# test1.rb
|
33
33
|
require "sgl"
|
34
34
|
window 100, 100
|
35
35
|
line 0, 0, 100, 100
|
36
36
|
wait
|
37
37
|
</pre>
|
38
38
|
|
39
|
-
Run the program with @ruby test1.rb@.
|
40
|
-
|
41
|
-
@test2.rb@.
|
42
39
|
<pre syntax="ruby">
|
40
|
+
# test2.rb
|
43
41
|
require "sgl"
|
44
42
|
window 100, 100
|
45
43
|
background 0
|
@@ -48,8 +46,8 @@ line 0, 0, 100, 100
|
|
48
46
|
wait
|
49
47
|
</pre>
|
50
48
|
|
51
|
-
@test3.rb@.
|
52
49
|
<pre syntax="ruby">
|
50
|
+
# test3.rb
|
53
51
|
require "sgl"
|
54
52
|
|
55
53
|
def setup
|
@@ -63,27 +61,30 @@ end
|
|
63
61
|
mainloop
|
64
62
|
</pre>
|
65
63
|
|
66
|
-
h2.
|
64
|
+
h2. Documents
|
67
65
|
|
68
|
-
* "API
|
69
|
-
* "cocoa
|
66
|
+
* "API Reference":rdoc/
|
67
|
+
* "Description of sgl-cocoa":cocoa.html
|
70
68
|
|
71
69
|
* Pages below are in Japanese
|
72
|
-
** "
|
73
|
-
** "How to for
|
70
|
+
** "Description":description.html
|
71
|
+
** "How to for Beginner":howto.html
|
74
72
|
** "How to use Sound function":sound.html
|
75
73
|
|
76
74
|
h2. Classes
|
77
75
|
|
78
|
-
We did some classes using sgl in art schools.
|
79
|
-
You
|
76
|
+
We did some classes using sgl in some art schools.
|
77
|
+
You can see some materials for the classes.
|
80
78
|
|
81
79
|
* Pages below are in Japanese
|
82
|
-
** "
|
83
|
-
** "
|
84
|
-
** "
|
85
|
-
** "
|
86
|
-
** "
|
80
|
+
** "Exercise 1":exercise1.html
|
81
|
+
** "Exercise 2":exercise2.html
|
82
|
+
** "Exercise 3":exercise3.html
|
83
|
+
** "Exercise 4":exercise4.html
|
84
|
+
** "Exercise 5":exercise5.html
|
85
|
+
** "Special Exercise 1":challenge1.html
|
86
|
+
** "Special Exercise 2":challenge2.html
|
87
|
+
** "Final Exercise":challenge3.html
|
87
88
|
|
88
89
|
h2. Repositry
|
89
90
|
|
@@ -95,4 +96,4 @@ Ruby License.
|
|
95
96
|
|
96
97
|
h2. Contact
|
97
98
|
|
98
|
-
Comments are welcome. Send an email to
|
99
|
+
Comments are welcome. Send an email to Kouichirou Eto "eto at rubyforge dot org".
|
data/website/sound.html
CHANGED
@@ -1,141 +1,141 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
-
<head>
|
5
|
-
<link rel="stylesheet" href="stylesheets/screen.css" type="text/css" media="screen" />
|
6
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
7
|
-
<title>
|
8
|
-
サウンド機能
|
9
|
-
</title>
|
10
|
-
<script src="javascripts/rounded_corners_lite.inc.js" type="text/javascript"></script>
|
11
|
-
<style>
|
12
|
-
|
13
|
-
</style>
|
14
|
-
<script type="text/javascript">
|
15
|
-
window.onload = function() {
|
16
|
-
settings = {
|
17
|
-
tl: { radius: 10 },
|
18
|
-
tr: { radius: 10 },
|
19
|
-
bl: { radius: 10 },
|
20
|
-
br: { radius: 10 },
|
21
|
-
antiAlias: true,
|
22
|
-
autoPad: true,
|
23
|
-
validTags: ["div"]
|
24
|
-
}
|
25
|
-
var versionBox = new curvyCorners(settings, document.getElementById("version"));
|
26
|
-
versionBox.applyCornersToAll();
|
27
|
-
}
|
28
|
-
</script>
|
29
|
-
</head>
|
30
|
-
<body>
|
31
|
-
<div id="main">
|
32
|
-
|
33
|
-
<h1>サウンド機能</h1>
|
34
|
-
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/sgl"; return false'>
|
35
|
-
<p>Get Version</p>
|
36
|
-
<a href="http://rubyforge.org/projects/sgl" class="numbers">0.
|
37
|
-
</div>
|
38
|
-
<h2>使い方</h2>
|
39
|
-
|
40
|
-
|
41
|
-
<p>サウンド機能の使い方について解説する.</p>
|
42
|
-
|
43
|
-
|
44
|
-
<pre syntax="ruby">
|
45
|
-
require 'sgl'
|
46
|
-
|
47
|
-
useSound # soundを使うことを宣言する.
|
48
|
-
|
49
|
-
sound = loadSound('sine.wav') # サンプル音をファイルから読みこむ.
|
50
|
-
# 同じディレクトリーにsine.wavというファイルを置いておく.
|
51
|
-
|
52
|
-
sound.play # そのサンプル音を再生する.
|
53
|
-
|
54
|
-
wait # プログラムがすぐ終了するのをふせぐために待つ.
|
55
|
-
# Ctrl+Cで,プログラムが終了する.
|
56
|
-
</pre>
|
57
|
-
|
58
|
-
<p>元となるサンプル音は,マイクからサンプリングしたり,インターネットから
|
59
|
-
フリーの音源をダウンロードする.波形編集ソフトを使ってMP3ファイルから
|
60
|
-
切り出したりする方法もある.</p>
|
61
|
-
|
62
|
-
|
63
|
-
<pre syntax="ruby">
|
64
|
-
require 'sgl'
|
65
|
-
|
66
|
-
def setup
|
67
|
-
useSound
|
68
|
-
window -200, -200, 200, 200
|
69
|
-
$y = 0
|
70
|
-
$sound = loadSound('sine.wav')
|
71
|
-
end
|
72
|
-
|
73
|
-
def onMouseDown(x, y)
|
74
|
-
$y = y
|
75
|
-
$sound.play(y / 10 + 60)
|
76
|
-
end
|
77
|
-
|
78
|
-
def display
|
79
|
-
line -200, $y, 200, $y
|
80
|
-
end
|
81
|
-
|
82
|
-
mainloop
|
83
|
-
</pre>
|
84
|
-
|
85
|
-
<p>マウスが押されると,その高さに応じた音を再生する.音量も変化する.</p>
|
86
|
-
|
87
|
-
|
88
|
-
<pre syntax="ruby">
|
89
|
-
require 'sgl'
|
90
|
-
|
91
|
-
def setup
|
92
|
-
useSound
|
93
|
-
window -200, -200, 200, 200
|
94
|
-
$x = 0
|
95
|
-
$y = 0
|
96
|
-
$sound = loadSound('sine.wav')
|
97
|
-
end
|
98
|
-
|
99
|
-
def onMouseDown(x, y)
|
100
|
-
$x = x
|
101
|
-
$y = y
|
102
|
-
$sound.play(y / 10 + 60, x / 4 + 50)
|
103
|
-
end
|
104
|
-
|
105
|
-
def display
|
106
|
-
circle($x, $y, 10)
|
107
|
-
end
|
108
|
-
|
109
|
-
mainloop
|
110
|
-
</pre>
|
111
|
-
|
112
|
-
<h2>注意点</h2>
|
113
|
-
|
114
|
-
|
115
|
-
<p>音を同時にたくさん出すと,システム全体が固まる.プログラムが止まるだけ
|
116
|
-
でなく,マシン全体が固まる.あまりたくさん音を同時に出しすぎないように
|
117
|
-
プログラム側で調整する.</p>
|
118
|
-
|
119
|
-
|
120
|
-
<h2>波形編集ソフト</h2>
|
121
|
-
|
122
|
-
|
123
|
-
<p>AudacityやWave Editor <span class="caps">TWE</span>などのフリーの波形編集ソフトを使ってサンプル
|
124
|
-
音を編集できる.自分が持っているMP3ファイルを元に編集することもできる.
|
125
|
-
AudacityなどでMP3ファイルを開き,該当個所のみを切り出して保存しなおす
|
126
|
-
とよい.</p>
|
127
|
-
|
128
|
-
|
129
|
-
<ul>
|
130
|
-
<li><a href="http://audacity.sourceforge.net/">Audacity</a></li>
|
131
|
-
<li><a href="http://www.yamaha.co.jp/product/syndtm/dl/utility/twe/">Wave Editor <span class="caps">TWE</span></a></li>
|
132
|
-
</ul>
|
133
|
-
<p class="coda">
|
134
|
-
|
135
|
-
</p>
|
136
|
-
</div>
|
137
|
-
|
138
|
-
<!-- insert site tracking codes here, like Google Urchin -->
|
139
|
-
|
140
|
-
</body>
|
141
|
-
</html>
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<link rel="stylesheet" href="stylesheets/screen.css" type="text/css" media="screen" />
|
6
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
7
|
+
<title>
|
8
|
+
サウンド機能
|
9
|
+
</title>
|
10
|
+
<script src="javascripts/rounded_corners_lite.inc.js" type="text/javascript"></script>
|
11
|
+
<style>
|
12
|
+
|
13
|
+
</style>
|
14
|
+
<script type="text/javascript">
|
15
|
+
window.onload = function() {
|
16
|
+
settings = {
|
17
|
+
tl: { radius: 10 },
|
18
|
+
tr: { radius: 10 },
|
19
|
+
bl: { radius: 10 },
|
20
|
+
br: { radius: 10 },
|
21
|
+
antiAlias: true,
|
22
|
+
autoPad: true,
|
23
|
+
validTags: ["div"]
|
24
|
+
}
|
25
|
+
var versionBox = new curvyCorners(settings, document.getElementById("version"));
|
26
|
+
versionBox.applyCornersToAll();
|
27
|
+
}
|
28
|
+
</script>
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="main">
|
32
|
+
|
33
|
+
<h1>サウンド機能</h1>
|
34
|
+
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/sgl"; return false'>
|
35
|
+
<p>Get Version</p>
|
36
|
+
<a href="http://rubyforge.org/projects/sgl" class="numbers">1.0.0</a>
|
37
|
+
</div>
|
38
|
+
<h2>使い方</h2>
|
39
|
+
|
40
|
+
|
41
|
+
<p>サウンド機能の使い方について解説する.</p>
|
42
|
+
|
43
|
+
|
44
|
+
<pre syntax="ruby">
|
45
|
+
require 'sgl'
|
46
|
+
|
47
|
+
useSound # soundを使うことを宣言する.
|
48
|
+
|
49
|
+
sound = loadSound('sine.wav') # サンプル音をファイルから読みこむ.
|
50
|
+
# 同じディレクトリーにsine.wavというファイルを置いておく.
|
51
|
+
|
52
|
+
sound.play # そのサンプル音を再生する.
|
53
|
+
|
54
|
+
wait # プログラムがすぐ終了するのをふせぐために待つ.
|
55
|
+
# Ctrl+Cで,プログラムが終了する.
|
56
|
+
</pre>
|
57
|
+
|
58
|
+
<p>元となるサンプル音は,マイクからサンプリングしたり,インターネットから
|
59
|
+
フリーの音源をダウンロードする.波形編集ソフトを使ってMP3ファイルから
|
60
|
+
切り出したりする方法もある.</p>
|
61
|
+
|
62
|
+
|
63
|
+
<pre syntax="ruby">
|
64
|
+
require 'sgl'
|
65
|
+
|
66
|
+
def setup
|
67
|
+
useSound
|
68
|
+
window -200, -200, 200, 200
|
69
|
+
$y = 0
|
70
|
+
$sound = loadSound('sine.wav')
|
71
|
+
end
|
72
|
+
|
73
|
+
def onMouseDown(x, y)
|
74
|
+
$y = y
|
75
|
+
$sound.play(y / 10 + 60)
|
76
|
+
end
|
77
|
+
|
78
|
+
def display
|
79
|
+
line -200, $y, 200, $y
|
80
|
+
end
|
81
|
+
|
82
|
+
mainloop
|
83
|
+
</pre>
|
84
|
+
|
85
|
+
<p>マウスが押されると,その高さに応じた音を再生する.音量も変化する.</p>
|
86
|
+
|
87
|
+
|
88
|
+
<pre syntax="ruby">
|
89
|
+
require 'sgl'
|
90
|
+
|
91
|
+
def setup
|
92
|
+
useSound
|
93
|
+
window -200, -200, 200, 200
|
94
|
+
$x = 0
|
95
|
+
$y = 0
|
96
|
+
$sound = loadSound('sine.wav')
|
97
|
+
end
|
98
|
+
|
99
|
+
def onMouseDown(x, y)
|
100
|
+
$x = x
|
101
|
+
$y = y
|
102
|
+
$sound.play(y / 10 + 60, x / 4 + 50)
|
103
|
+
end
|
104
|
+
|
105
|
+
def display
|
106
|
+
circle($x, $y, 10)
|
107
|
+
end
|
108
|
+
|
109
|
+
mainloop
|
110
|
+
</pre>
|
111
|
+
|
112
|
+
<h2>注意点</h2>
|
113
|
+
|
114
|
+
|
115
|
+
<p>音を同時にたくさん出すと,システム全体が固まる.プログラムが止まるだけ
|
116
|
+
でなく,マシン全体が固まる.あまりたくさん音を同時に出しすぎないように
|
117
|
+
プログラム側で調整する.</p>
|
118
|
+
|
119
|
+
|
120
|
+
<h2>波形編集ソフト</h2>
|
121
|
+
|
122
|
+
|
123
|
+
<p>AudacityやWave Editor <span class="caps">TWE</span>などのフリーの波形編集ソフトを使ってサンプル
|
124
|
+
音を編集できる.自分が持っているMP3ファイルを元に編集することもできる.
|
125
|
+
AudacityなどでMP3ファイルを開き,該当個所のみを切り出して保存しなおす
|
126
|
+
とよい.</p>
|
127
|
+
|
128
|
+
|
129
|
+
<ul>
|
130
|
+
<li><a href="http://audacity.sourceforge.net/">Audacity</a></li>
|
131
|
+
<li><a href="http://www.yamaha.co.jp/product/syndtm/dl/utility/twe/">Wave Editor <span class="caps">TWE</span></a></li>
|
132
|
+
</ul>
|
133
|
+
<p class="coda">
|
134
|
+
30th June 2007<br>
|
135
|
+
</p>
|
136
|
+
</div>
|
137
|
+
|
138
|
+
<!-- insert site tracking codes here, like Google Urchin -->
|
139
|
+
|
140
|
+
</body>
|
141
|
+
</html>
|
metadata
CHANGED
@@ -3,12 +3,12 @@ rubygems_version: 0.9.2
|
|
3
3
|
specification_version: 1
|
4
4
|
name: sgl
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date: 2007-
|
6
|
+
version: 1.0.0
|
7
|
+
date: 2007-07-01 00:00:00 +09:00
|
8
8
|
summary: "\"sgl: simple generic library\" enables you to create a program with graphics and sound easily."
|
9
9
|
require_paths:
|
10
10
|
- lib
|
11
|
-
email: eto
|
11
|
+
email: eto _at_ rubyforge _dot_ org
|
12
12
|
homepage: http://sgl.rubyforge.org
|
13
13
|
rubyforge_project: sgl
|
14
14
|
description: "\"sgl: simple generic library\" enables you to create a program with graphics and sound easily."
|
@@ -100,9 +100,13 @@ files:
|
|
100
100
|
- lib/sgl/sgl-timer.rb
|
101
101
|
- lib/sgl/sgl.rb
|
102
102
|
- lib/sgl/version.rb
|
103
|
+
- scripts/lib-txt2html.rb
|
103
104
|
- scripts/makemanifest.rb
|
104
105
|
- scripts/txt2html
|
105
106
|
- setup.rb
|
107
|
+
- spec/sgl_spec.rb
|
108
|
+
- spec/spec.opts
|
109
|
+
- spec/spec_helper.rb
|
106
110
|
- test/test_bass.rb
|
107
111
|
- test/test_cocoa_app.rb
|
108
112
|
- test/test_helper.rb
|
@@ -127,6 +131,12 @@ files:
|
|
127
131
|
- website/exercise1.txt
|
128
132
|
- website/exercise2.html
|
129
133
|
- website/exercise2.txt
|
134
|
+
- website/exercise3.html
|
135
|
+
- website/exercise3.txt
|
136
|
+
- website/exercise4.html
|
137
|
+
- website/exercise4.txt
|
138
|
+
- website/exercise5.html
|
139
|
+
- website/exercise5.txt
|
130
140
|
- website/exhibition.html
|
131
141
|
- website/exhibition.txt
|
132
142
|
- website/howto.html
|
@@ -165,6 +175,9 @@ extra_rdoc_files:
|
|
165
175
|
- website/description.txt
|
166
176
|
- website/exercise1.txt
|
167
177
|
- website/exercise2.txt
|
178
|
+
- website/exercise3.txt
|
179
|
+
- website/exercise4.txt
|
180
|
+
- website/exercise5.txt
|
168
181
|
- website/exhibition.txt
|
169
182
|
- website/howto.txt
|
170
183
|
- website/index.txt
|