sgl 0.4.0 → 1.0.0
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/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/challenge2.txt
CHANGED
@@ -51,23 +51,22 @@ h2. 作品制作にかかわる注意
|
|
51
51
|
|
52
52
|
必ず作品制作に取り組む前に絵コンテを描き,見せにくることが必要.まずど
|
53
53
|
のような動きを作るかを考えてから,プログラミングを開始する.絵コンテを
|
54
|
-
|
54
|
+
見せずにプログラムだけ作成した場合は,課題提出とは見なさない.
|
55
55
|
|
56
|
-
必ず5つのプログラムを作る.1つのプログラムで5
|
57
|
-
|
56
|
+
必ず5つのプログラムを作る.1つのプログラムで5つのアニメーションにはし
|
57
|
+
ない.
|
58
58
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
見なしません.
|
59
|
+
命令を定義する機能を最低5個は使う.5つのプログラムで5つの命令でよい.5
|
60
|
+
つのプログラムで共通に使いまわせるような命令を作るようにする.一つのテー
|
61
|
+
マを5つのプログラムで実現すると,同じ形が複数のプログラムにでてくるこ
|
62
|
+
とがある.そのとき,その形を書く命令を定義して,それを使い回すことによっ
|
63
|
+
てプログラムを簡略化できる.そのようにプログラムのテクニックとしてのコ
|
64
|
+
マンドの使い方を体験することが課題の一つである.コマンド機能を使ってな
|
65
|
+
いプログラムの場合は課題提出とは見なさない.
|
67
66
|
|
68
|
-
|
69
|
-
|
67
|
+
アニメーションの長さは指定しない.短くコンパクトにまとめること.最長で
|
68
|
+
も5つで3分以内におさめること.
|
70
69
|
|
71
70
|
h2. 採点
|
72
71
|
|
73
|
-
|
72
|
+
テーマ選び,絵コンテも含め,内容を重視した採点をする.
|
data/website/challenge3.html
CHANGED
@@ -1,63 +1,66 @@
|
|
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>課題: この授業では,プログラミングによってコンピュータ上に形を作るとい
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
<
|
51
|
-
|
52
|
-
<li
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
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>課題: この授業では,プログラミングによってコンピュータ上に形を作るとい
|
42
|
+
うことを学んだ.授業を受ける前と後とでは,プログラミングについて,どの
|
43
|
+
ような考え方の変化があったかをレポートとしてまとめ,提出する.</p>
|
44
|
+
|
45
|
+
|
46
|
+
<p>受ける前はプログラミングについてこう考えていた,受けた後ではプログラミ
|
47
|
+
ングとはこのようなものだと思うようになった,というこのような形式をとる.</p>
|
48
|
+
|
49
|
+
|
50
|
+
<ul>
|
51
|
+
<li>字数: 600字以上〜1200字以内</li>
|
52
|
+
<li>提出: メールで提出する.
|
53
|
+
<ul>
|
54
|
+
<li>レポートの最初に必ず,タイトル,学籍番号,名前を書く.</li>
|
55
|
+
<li>レポートはメールの本文に書く.ワードファイルは添付しない.</li>
|
56
|
+
</ul></li>
|
57
|
+
</ul>
|
58
|
+
<p class="coda">
|
59
|
+
30th June 2007<br>
|
60
|
+
</p>
|
61
|
+
</div>
|
62
|
+
|
63
|
+
<!-- insert site tracking codes here, like Google Urchin -->
|
64
|
+
|
65
|
+
</body>
|
66
|
+
</html>
|
data/website/challenge3.txt
CHANGED
@@ -3,13 +3,13 @@ h1. 最終課題
|
|
3
3
|
h2. レポート: プログラミングにふれてみての感想
|
4
4
|
|
5
5
|
課題: この授業では,プログラミングによってコンピュータ上に形を作るとい
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
うことを学んだ.授業を受ける前と後とでは,プログラミングについて,どの
|
7
|
+
ような考え方の変化があったかをレポートとしてまとめ,提出する.
|
8
|
+
|
9
|
+
受ける前はプログラミングについてこう考えていた,受けた後ではプログラミ
|
10
|
+
ングとはこのようなものだと思うようになった,というこのような形式をとる.
|
11
11
|
|
12
12
|
* 字数: 600字以上〜1200字以内
|
13
13
|
* 提出: メールで提出する.
|
14
|
-
|
15
|
-
|
14
|
+
** レポートの最初に必ず,タイトル,学籍番号,名前を書く.
|
15
|
+
** レポートはメールの本文に書く.ワードファイルは添付しない.
|
data/website/cocoa.html
CHANGED
@@ -1,88 +1,85 @@
|
|
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
|
-
sgl-cocoa → sgl with Ruby/Cocoa
|
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>sgl-cocoa → sgl with Ruby/Cocoa</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>What</h2>
|
39
|
-
|
40
|
-
|
41
|
-
<p>‘sgl-cocoa’ is a cocoa version of sgl.
|
42
|
-
You can use sgl functions with Ruby/Cocoa.</p>
|
43
|
-
|
44
|
-
|
45
|
-
<h2>Requirement</h2>
|
46
|
-
|
47
|
-
|
48
|
-
<p>You can use
|
49
|
-
|
50
|
-
|
51
|
-
<
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
</
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
</body>
|
88
|
-
</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
|
+
sgl-cocoa → sgl with Ruby/Cocoa
|
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>sgl-cocoa → sgl with Ruby/Cocoa</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>What</h2>
|
39
|
+
|
40
|
+
|
41
|
+
<p>‘sgl-cocoa’ is a cocoa version of sgl.
|
42
|
+
You can use sgl functions with Ruby/Cocoa.</p>
|
43
|
+
|
44
|
+
|
45
|
+
<h2>Requirement</h2>
|
46
|
+
|
47
|
+
|
48
|
+
<p>You can use sgl-cocoa only on Mac <span class="caps">OS X</span>.</p>
|
49
|
+
|
50
|
+
|
51
|
+
<ul>
|
52
|
+
<li>Mac <span class="caps">OS X 10</span>.3 or later</li>
|
53
|
+
<li>ruby 1.8.5 or later</li>
|
54
|
+
<li>RubyCocoa 0.4.1 or later</li>
|
55
|
+
</ul>
|
56
|
+
|
57
|
+
|
58
|
+
<h2>The basics</h2>
|
59
|
+
|
60
|
+
|
61
|
+
<pre syntax="ruby">
|
62
|
+
# test1.rb
|
63
|
+
require "sgl/cocoa"
|
64
|
+
|
65
|
+
def setup
|
66
|
+
window 100, 100
|
67
|
+
end
|
68
|
+
|
69
|
+
def display
|
70
|
+
line 0, 0, 100, 100
|
71
|
+
end
|
72
|
+
|
73
|
+
mainloop
|
74
|
+
</pre>
|
75
|
+
|
76
|
+
<p>Run the program with <code>ruby test1.rb</code>.</p>
|
77
|
+
<p class="coda">
|
78
|
+
30th June 2007<br>
|
79
|
+
</p>
|
80
|
+
</div>
|
81
|
+
|
82
|
+
<!-- insert site tracking codes here, like Google Urchin -->
|
83
|
+
|
84
|
+
</body>
|
85
|
+
</html>
|
data/website/cocoa.txt
CHANGED
@@ -7,9 +7,7 @@ You can use sgl functions with Ruby/Cocoa.
|
|
7
7
|
|
8
8
|
h2. Requirement
|
9
9
|
|
10
|
-
You can use
|
11
|
-
|
12
|
-
h3. Mac OS X
|
10
|
+
You can use sgl-cocoa only on Mac OS X.
|
13
11
|
|
14
12
|
* Mac OS X 10.3 or later
|
15
13
|
* ruby 1.8.5 or later
|
@@ -17,8 +15,8 @@ h3. Mac OS X
|
|
17
15
|
|
18
16
|
h2. The basics
|
19
17
|
|
20
|
-
Save this progarm as @test1.rb@.
|
21
18
|
<pre syntax="ruby">
|
19
|
+
# test1.rb
|
22
20
|
require "sgl/cocoa"
|
23
21
|
|
24
22
|
def setup
|
data/website/description.html
CHANGED
@@ -1,138 +1,138 @@
|
|
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
|
-
sglの説明
|
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>sglの説明</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>What is sgl?</h2>
|
39
|
-
|
40
|
-
|
41
|
-
<p>sglは,Rubyからグラフィックやサウンドを簡単に扱えるようにしたライブラ
|
42
|
-
リである.できるだけ優しくプログラミングを初められるように,シンプルな
|
43
|
-
記述で必要最小限の動作するプログラムを作成できるようになっている.</p>
|
44
|
-
|
45
|
-
|
46
|
-
<p><a href="http://dbn.media.mit.edu/"><span class="caps">DBN</span></a> というプログラミング環境が提供していた
|
47
|
-
理念を継承し,可能な限り簡単にプログラミングに取り組めるように工夫して
|
48
|
-
いる.DBNの理念を継承した環境として,
|
49
|
-
<a href="http://www.processing.org/">Processing</a> とは兄弟関係にあると言える.</p>
|
50
|
-
|
51
|
-
|
52
|
-
<p>グラフィックスはOpenGL,Window表示,マウス入力,キー入力などにはSDLを
|
53
|
-
用いている.またMIDIの入出力なども組み合せて使えるようになっている.ラ
|
54
|
-
イブラリーの構造はGLUTを参考にしている.</p>
|
55
|
-
|
56
|
-
|
57
|
-
<pre syntax="ruby">
|
58
|
-
# 基本的なプログラムの例
|
59
|
-
reuire 'sgl' # 最初に必ず必要
|
60
|
-
window 100,100 # 100x100のウィンドウを生成
|
61
|
-
background 0 # 背景は黒にします
|
62
|
-
color 100 # 白を指定します
|
63
|
-
line 20,20,80,80 # 線を引きます
|
64
|
-
rect 20,20,80,80 # 四角を描きます
|
65
|
-
wait # プログラムが終了しないように待つ.ESCキーで終了する.
|
66
|
-
|
67
|
-
# 色空間
|
68
|
-
color 100,0,0 # 赤になる.r,g,bで色が使える
|
69
|
-
color 100,0,0,50 # 半透明の赤.100が不透明(デフォルト).0が完全に透明.
|
70
|
-
colorHSV 50,0,100 # hsv方式での色指定もできる.
|
71
|
-
backgroundHSV 70,0,100 # 背景の指定もhsvでできる.
|
72
|
-
colorHSV 50,0,100,50 # もちろんhsv方式でもアルファ値は指定できる.
|
73
|
-
|
74
|
-
# 3Dも使える
|
75
|
-
useFov(60) # field of view.画角を指定
|
76
|
-
useDepth # depth bufferを使う
|
77
|
-
line 20,20,20,80,80,80 # とりあえず線
|
78
|
-
color 0,100,0,50 # とりあえず半透明
|
79
|
-
box 20,20,20,80,80,80 # 箱.半透明になっている
|
80
|
-
useSmooth # 線にanti aliasがかかる.
|
81
|
-
|
82
|
-
# MIDI関係
|
83
|
-
useMidi # midiを使うということ宣言
|
84
|
-
note 1, 60, 90, 100 # ch, note, vel, msec.
|
85
|
-
|
86
|
-
# 詳細な描画について
|
87
|
-
beginObj(QUADS)
|
88
|
-
vertex 20,20
|
89
|
-
vertex 80,20
|
90
|
-
vertex 80,80
|
91
|
-
vertex 20,80
|
92
|
-
endObj
|
93
|
-
# 同様に,vertexにz軸の情報を加えれば,3Dとなる.
|
94
|
-
|
95
|
-
オブジェクトの種類は,
|
96
|
-
LINES POINTS LINE_STRIP LINE_LOOP TRIANGLES TRIANGLE_STRIP
|
97
|
-
TRIANGLE_FAN QUADS QUAD_STRIP POLYGON
|
98
|
-
が使える.OpenGLと同じ.
|
99
|
-
|
100
|
-
# 基本的なループ構造
|
101
|
-
window 100,100
|
102
|
-
def display
|
103
|
-
line 0,0,100,100
|
104
|
-
end
|
105
|
-
mainloop
|
106
|
-
とすると,ループして,描画しつづける.
|
107
|
-
|
108
|
-
# マウス入力
|
109
|
-
ループした状態で,
|
110
|
-
def onMouseDown(x,y)
|
111
|
-
line 0,0,x,y
|
112
|
-
end
|
113
|
-
などとすると,callbackがかかる.
|
114
|
-
同様に,onMouseUp, onKeyDown, onKeyUpなど.
|
115
|
-
|
116
|
-
# MIDI input関係
|
117
|
-
useMidiIn # midi inを使うということ宣言
|
118
|
-
def onNoteOn(ch, note, vel)
|
119
|
-
p [ch, note, vel]
|
120
|
-
end
|
121
|
-
などとできる.
|
122
|
-
|
123
|
-
同様に,onNoteOff(ch, note)もある.
|
124
|
-
|
125
|
-
#
|
126
|
-
useSound
|
127
|
-
sound = loadSound('sine.wav')
|
128
|
-
sound.play(60, 100, -100) # note, vel, pan
|
129
|
-
</pre>
|
130
|
-
<p class="coda">
|
131
|
-
|
132
|
-
</p>
|
133
|
-
</div>
|
134
|
-
|
135
|
-
<!-- insert site tracking codes here, like Google Urchin -->
|
136
|
-
|
137
|
-
</body>
|
138
|
-
</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
|
+
sglの説明
|
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>sglの説明</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>What is sgl?</h2>
|
39
|
+
|
40
|
+
|
41
|
+
<p>sglは,Rubyからグラフィックやサウンドを簡単に扱えるようにしたライブラ
|
42
|
+
リである.できるだけ優しくプログラミングを初められるように,シンプルな
|
43
|
+
記述で必要最小限の動作するプログラムを作成できるようになっている.</p>
|
44
|
+
|
45
|
+
|
46
|
+
<p><a href="http://dbn.media.mit.edu/"><span class="caps">DBN</span></a> というプログラミング環境が提供していた
|
47
|
+
理念を継承し,可能な限り簡単にプログラミングに取り組めるように工夫して
|
48
|
+
いる.DBNの理念を継承した環境として,
|
49
|
+
<a href="http://www.processing.org/">Processing</a> とは兄弟関係にあると言える.</p>
|
50
|
+
|
51
|
+
|
52
|
+
<p>グラフィックスはOpenGL,Window表示,マウス入力,キー入力などにはSDLを
|
53
|
+
用いている.またMIDIの入出力なども組み合せて使えるようになっている.ラ
|
54
|
+
イブラリーの構造はGLUTを参考にしている.</p>
|
55
|
+
|
56
|
+
|
57
|
+
<pre syntax="ruby">
|
58
|
+
# 基本的なプログラムの例
|
59
|
+
reuire 'sgl' # 最初に必ず必要
|
60
|
+
window 100,100 # 100x100のウィンドウを生成
|
61
|
+
background 0 # 背景は黒にします
|
62
|
+
color 100 # 白を指定します
|
63
|
+
line 20,20,80,80 # 線を引きます
|
64
|
+
rect 20,20,80,80 # 四角を描きます
|
65
|
+
wait # プログラムが終了しないように待つ.ESCキーで終了する.
|
66
|
+
|
67
|
+
# 色空間
|
68
|
+
color 100,0,0 # 赤になる.r,g,bで色が使える
|
69
|
+
color 100,0,0,50 # 半透明の赤.100が不透明(デフォルト).0が完全に透明.
|
70
|
+
colorHSV 50,0,100 # hsv方式での色指定もできる.
|
71
|
+
backgroundHSV 70,0,100 # 背景の指定もhsvでできる.
|
72
|
+
colorHSV 50,0,100,50 # もちろんhsv方式でもアルファ値は指定できる.
|
73
|
+
|
74
|
+
# 3Dも使える
|
75
|
+
useFov(60) # field of view.画角を指定
|
76
|
+
useDepth # depth bufferを使う
|
77
|
+
line 20,20,20,80,80,80 # とりあえず線
|
78
|
+
color 0,100,0,50 # とりあえず半透明
|
79
|
+
box 20,20,20,80,80,80 # 箱.半透明になっている
|
80
|
+
useSmooth # 線にanti aliasがかかる.
|
81
|
+
|
82
|
+
# MIDI関係
|
83
|
+
useMidi # midiを使うということ宣言
|
84
|
+
note 1, 60, 90, 100 # ch, note, vel, msec.
|
85
|
+
|
86
|
+
# 詳細な描画について
|
87
|
+
beginObj(QUADS)
|
88
|
+
vertex 20,20
|
89
|
+
vertex 80,20
|
90
|
+
vertex 80,80
|
91
|
+
vertex 20,80
|
92
|
+
endObj
|
93
|
+
# 同様に,vertexにz軸の情報を加えれば,3Dとなる.
|
94
|
+
|
95
|
+
オブジェクトの種類は,
|
96
|
+
LINES POINTS LINE_STRIP LINE_LOOP TRIANGLES TRIANGLE_STRIP
|
97
|
+
TRIANGLE_FAN QUADS QUAD_STRIP POLYGON
|
98
|
+
が使える.OpenGLと同じ.
|
99
|
+
|
100
|
+
# 基本的なループ構造
|
101
|
+
window 100,100
|
102
|
+
def display
|
103
|
+
line 0,0,100,100
|
104
|
+
end
|
105
|
+
mainloop
|
106
|
+
とすると,ループして,描画しつづける.
|
107
|
+
|
108
|
+
# マウス入力
|
109
|
+
ループした状態で,
|
110
|
+
def onMouseDown(x,y)
|
111
|
+
line 0,0,x,y
|
112
|
+
end
|
113
|
+
などとすると,callbackがかかる.
|
114
|
+
同様に,onMouseUp, onKeyDown, onKeyUpなど.
|
115
|
+
|
116
|
+
# MIDI input関係
|
117
|
+
useMidiIn # midi inを使うということ宣言
|
118
|
+
def onNoteOn(ch, note, vel)
|
119
|
+
p [ch, note, vel]
|
120
|
+
end
|
121
|
+
などとできる.
|
122
|
+
|
123
|
+
同様に,onNoteOff(ch, note)もある.
|
124
|
+
|
125
|
+
# サウンド再生機能
|
126
|
+
useSound
|
127
|
+
sound = loadSound('sine.wav')
|
128
|
+
sound.play(60, 100, -100) # note, vel, pan
|
129
|
+
</pre>
|
130
|
+
<p class="coda">
|
131
|
+
30th June 2007<br>
|
132
|
+
</p>
|
133
|
+
</div>
|
134
|
+
|
135
|
+
<!-- insert site tracking codes here, like Google Urchin -->
|
136
|
+
|
137
|
+
</body>
|
138
|
+
</html>
|