sgl 0.3.1 → 0.4.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.
Files changed (103) hide show
  1. data/ChangeLog +234 -0
  2. data/Manifest.txt +94 -0
  3. data/Rakefile +16 -5
  4. data/examples/cocoa1-basic.rb +14 -0
  5. data/examples/cocoa10-transparent.rb +26 -0
  6. data/examples/cocoa11-application.rb +13 -0
  7. data/examples/cocoa2-draw.rb +23 -0
  8. data/examples/cocoa3-affine.rb +29 -0
  9. data/examples/cocoa4-font.rb +24 -0
  10. data/examples/cocoa5-image.rb +22 -0
  11. data/examples/cocoa6-sound.rb +24 -0
  12. data/examples/cocoa7-movie.rb +40 -0
  13. data/examples/cocoa8-movieoverlay.rb +42 -0
  14. data/examples/cocoa9-streaming.rb +40 -0
  15. data/examples/opengl1-basic.rb +14 -0
  16. data/examples/opengl11-application.rb +13 -0
  17. data/examples/opengl2-draw.rb +23 -0
  18. data/examples/opengl3-affine.rb +29 -0
  19. data/examples/sample1.rb +11 -0
  20. data/examples/sample10.rb +16 -0
  21. data/examples/sample11.rb +22 -0
  22. data/examples/sample11a.rb +33 -0
  23. data/examples/sample12.rb +30 -0
  24. data/examples/sample12a.rb +35 -0
  25. data/examples/sample13.rb +116 -0
  26. data/examples/sample15.rb +24 -0
  27. data/examples/sample16.rb +31 -0
  28. data/examples/sample16a.rb +35 -0
  29. data/examples/sample6.rb +18 -0
  30. data/examples/sample7.rb +16 -0
  31. data/examples/sample9.rb +20 -0
  32. data/examples/sgl-sound1.rb +6 -0
  33. data/examples/sgl-sound2.rb +19 -0
  34. data/examples/sine.ogg +0 -0
  35. data/examples/testgl.rb +169 -0
  36. data/lib/sgl/bass-api.rb +202 -0
  37. data/lib/sgl/bass-sample.rb +106 -0
  38. data/lib/sgl/bass.rb +46 -0
  39. data/lib/sgl/cocoa-app.rb +43 -0
  40. data/lib/sgl/cocoa-color.rb +65 -0
  41. data/lib/sgl/cocoa-draw.rb +72 -0
  42. data/lib/sgl/cocoa-event.rb +229 -0
  43. data/lib/sgl/cocoa-media.rb +144 -0
  44. data/lib/sgl/cocoa-notuse.rb +493 -0
  45. data/lib/sgl/cocoa-window.rb +203 -0
  46. data/lib/sgl/cocoa.rb +8 -0
  47. data/lib/sgl/notuse-objs.rb +358 -0
  48. data/lib/sgl/opengl-app.rb +38 -0
  49. data/lib/sgl/opengl-color.rb +44 -0
  50. data/lib/sgl/opengl-draw.rb +260 -0
  51. data/lib/sgl/opengl-event.rb +325 -0
  52. data/lib/sgl/opengl-modules.rb +22 -0
  53. data/lib/sgl/opengl-window.rb +224 -0
  54. data/lib/sgl/opengl.rb +7 -0
  55. data/lib/sgl/sgl-basic.rb +61 -0
  56. data/lib/sgl/sgl-button.rb +135 -0
  57. data/lib/sgl/sgl-client.rb +21 -0
  58. data/lib/sgl/sgl-color.rb +82 -0
  59. data/lib/sgl/sgl-connect.rb +9 -0
  60. data/lib/sgl/sgl-objlib.rb +0 -0
  61. data/lib/sgl/sgl-objs.rb +0 -0
  62. data/lib/sgl/sgl-server.rb +58 -0
  63. data/lib/sgl/sgl-sound.rb +24 -0
  64. data/lib/sgl/sgl-spring.rb +216 -0
  65. data/lib/sgl/sgl-timer.rb +72 -0
  66. data/lib/sgl/sgl.rb +5 -0
  67. data/lib/sgl/version.rb +2 -2
  68. data/scripts/makemanifest.rb +20 -0
  69. data/test/test_bass.rb +27 -0
  70. data/test/test_cocoa_app.rb +5 -5
  71. data/test/test_helper.rb +9 -1
  72. data/test/test_module_ruby16.rb +22 -21
  73. data/test/test_opengl_app.rb +4 -5
  74. data/test/test_opengl_basic.rb +3 -4
  75. data/test/test_opengl_fullscreen.rb +4 -6
  76. data/test/test_opengl_novice.rb +3 -6
  77. data/test/test_sgl.rb +4 -27
  78. data/test/test_sound.rb +15 -0
  79. data/website/challenge1.html +91 -0
  80. data/website/challenge1.txt +30 -0
  81. data/website/challenge2.html +144 -0
  82. data/website/challenge2.txt +73 -0
  83. data/website/challenge3.html +63 -0
  84. data/website/challenge3.txt +15 -0
  85. data/website/cocoa.html +88 -0
  86. data/website/cocoa.txt +35 -0
  87. data/website/description.html +138 -0
  88. data/website/description.txt +90 -0
  89. data/website/exercise1.html +264 -0
  90. data/website/exercise1.txt +192 -0
  91. data/website/exercise2.html +683 -0
  92. data/website/exercise2.txt +597 -0
  93. data/website/exhibition.html +84 -0
  94. data/website/exhibition.txt +24 -0
  95. data/website/howto.html +134 -0
  96. data/website/howto.txt +56 -0
  97. data/website/index.html +17 -9
  98. data/website/index.txt +13 -4
  99. data/website/sound.html +141 -0
  100. data/website/sound.txt +87 -0
  101. data/website/stylesheets/grade.png +0 -0
  102. data/website/stylesheets/screen.css +21 -20
  103. metadata +109 -3
data/ChangeLog ADDED
@@ -0,0 +1,234 @@
1
+ 2007-06-25 Kouichirou Eto <2007 eto.com>
2
+
3
+ * test_bass.rb: Reformat.
4
+ * test_bass.rb: Ditto.
5
+
6
+ * Rakefile: Obfuscate mail address.
7
+ * Rakefile: Reformat.
8
+
9
+ * website/stylesheets/grade.png: Add backgorund image.
10
+ * website/stylesheets/screen.css: Ditto.
11
+
12
+ * lib/sgl/sgl-sound.rb: New function sound.
13
+ * lib/sgl/opengl-app.rb: Ditto.
14
+ * lib/sgl/opengl-modules.rb: Ditto.
15
+ * test/test_sound.rb: Ditto.
16
+ * examples/sgl-sound1.rb: Ditto.
17
+ * examples/sgl-sound2.rb: Ditto.
18
+ * examples/sine.ogg: Sample sound.
19
+
20
+ * version: Version up to 0.4.0
21
+
22
+ 2007-06-23 Kouichirou Eto <2007 eto.com>
23
+
24
+ * test_bass.rb: New file. Test case for bass.
25
+
26
+ * bin: New directory.
27
+
28
+ 2007-06-22 Kouichirou Eto <2007 eto.com>
29
+
30
+ * test_helper.rb: Update to include LOAD_PATH.
31
+
32
+ * test_opengl_fullscreen.rb: Change runtime to 0.1
33
+
34
+ * examples/*: Change sgl/opengl to sgl.
35
+ * examples/*: Update comment.
36
+
37
+ * sgl/sgl.rb: Use sgl/opengl as default sgl_type.
38
+
39
+ * sgl/sgl-timer.rb: Refine comment.
40
+
41
+ * sgl/sgl-basic.rb: Create test case.
42
+
43
+ * sgl/make-release.rb: Remove unused file.
44
+
45
+ * bin: Remove unused directory.
46
+
47
+ * sgl/bass.rb: Restructuring.
48
+ * sgl/bass-api.rb: New file.
49
+ * sgl/bass-sample.rb: New file.
50
+
51
+ 2007-06-21 Kouichirou Eto <2007 eto.com>
52
+
53
+ * test_*: Update require.
54
+ * test_cocoa_app.rb: Add if.
55
+ * test_module_ruby16.rb: Add if.
56
+ * Rakefile: Add rule chmod to clean.
57
+ * sgl-objlib.rb: Moved to sgl-objs.rb
58
+ * sgl-objs.rb: New file.
59
+ * sgl-timer.rb: New file.
60
+ * sgl-basic.rb: New file.
61
+
62
+ 2007-06-20 Kouichirou Eto <2007 eto.com>
63
+
64
+ * Update documents.
65
+
66
+ * Rakefile: Add new task manifest to create Manifest.txt.
67
+
68
+ * Remove qp related lines.
69
+
70
+ * sgl-bass.rb: Update main not to define always.
71
+
72
+ * Update copyright lines to this year 2007.
73
+ * Update copyright lines again.
74
+
75
+ * test_opengl_fullscreen.rb: Change runtime to a second.
76
+
77
+ * bass.rb: Renamed from sgl-bass.rb
78
+ * bass.rb: Reformat.
79
+
80
+ * Add license information to each files.
81
+
82
+ * Reformat for RDoc.
83
+
84
+ * Truncate unused files.
85
+ * Delete unused files.
86
+ * Delete unused directories.
87
+
88
+ * sgl-objlib.rb: Reformat.
89
+
90
+ * test_*: Add license.
91
+
92
+ 2007-06-19 Kouichirou Eto <2007 eto.com>
93
+
94
+ * Restructuring. Adapt to newgem source code tree.
95
+
96
+ * Rakefile: Add new task replace for development.
97
+
98
+ * Move test files to test dir.
99
+
100
+ * Rename test files.
101
+
102
+ * Update test code.
103
+
104
+ 2005-07-14 Kouichirou Eto <2005 eto.com>
105
+
106
+ * opengl-event.rb: Bug fix. Do not reentrant mainloop.
107
+ * opengl-window.rb: Add default size for fullscreen.
108
+ * sgl-button.rb: Show them near by the buttons.
109
+
110
+ 2005-07-11 Kouichirou Eto <2005 eto.com>
111
+
112
+ * opengl-event.rb: Add fullscreen methods.
113
+ * test-opengl-fullscreen.rb: Test case.
114
+ * sgl-spring.rb: Spring object.
115
+ * sgl-button.rb: Button object.
116
+ * sgl-bass.rb: Bass object.
117
+ * sgl-objlib.rb: Obj library.
118
+
119
+ 2005-07-07 Kouichirou Eto <2005 eto.com>
120
+
121
+ * sgl-client.rb: New file for network test.
122
+ * sgl-server.rb: Ditto.
123
+ * sgl-connect.rb: Ditto.
124
+ * samples/sample15.rb, sample16.rb, sample16a.rb: New files.
125
+
126
+ 2005-06-16 Kouichirou Eto <2005 eto.com>
127
+
128
+ * opengl-event.rb: New method process.
129
+ * doc/style.css: Update.
130
+ * doc/*: Reformat.
131
+ * sample/sample*.rb: New files.
132
+ * README.txt, README-opengl.txt, README-cocoa.txt: New files.
133
+
134
+ 2005-06-01 Kouichirou Eto <2005 eto.com>
135
+
136
+ * opengl-app.rb: delete flip
137
+ * opengl-event.rb: add flip, wait for novice mode.
138
+
139
+ 2005-05-13 Kouichirou Eto <2005 eto.com>
140
+
141
+ * add documentation.
142
+
143
+ 2005-04-22 Kouichirou Eto <2005 eto.com>
144
+
145
+ * sgl-0.2 released.
146
+
147
+ 2005-04-20 Kouichirou Eto <2005 eto.com>
148
+
149
+ * opengl-window.rb: Add check windows?
150
+
151
+ 2005-04-19 Kouichirou Eto <2005 eto.com>
152
+
153
+ * cocoa-app.rb, cocoa-window.rb: Fix bug.
154
+ * cocoa-window.rb: Add setGLAttr for fix bug.
155
+ * cocoa-event.rb: Fix bug for keydown.
156
+
157
+ 2005-04-08 Kouichirou Eto <2005 eto.com>
158
+
159
+ * cocoa-app.rb: Refactoring.
160
+ * cocoa-window.rb: New file.
161
+ * cocoa-event.rb: New method check_runtime_finished
162
+ * opengl.rb: Refactoring.
163
+ * opengl-app.rb: Refactoring.
164
+ * opengl-draw.rb: Refactoring.
165
+ * opengl-window.rb, opengl-modules.rb, opengl-color.rb: New files.
166
+ * tests/test-opengl-app.rb: New file.
167
+ * samples/opengl2-draw.rb, opengl3-affine.rb,
168
+ opengl11-application.rb: New files.
169
+ * make.rb: New file. for make dist tarball.
170
+ * MANIFEST: New file.
171
+
172
+ 2005-04-07 Kouichirou Eto <2005 eto.com>
173
+
174
+ * cocoa-draw.rb, cocoa-event.rb, cocoa-media.rb: New
175
+ files. Splited from cocoa-app.rb
176
+ * tests/test-cocoa-app.rb: Do not test sound and movies.
177
+
178
+ 2005-04-06 Kouichirou Eto <2005 eto.com>
179
+
180
+ * cocoa-app.rb: Add "p" in movie method. Strange bug.
181
+ * cocoa-app.rb: Check global var.
182
+
183
+ 2005-04-06 Kouichirou Eto <2005 eto.com>
184
+
185
+ * cocoa-app.rb: Remove unused classes.
186
+ * cocoa-functions.rb: Refactoring.
187
+ * cocoa-notuse.rb: New file. To backup old classes.
188
+
189
+ 2005-04-06 Kouichirou Eto <2005 eto.com>
190
+
191
+ * test-cocoa-app.rb: New file.
192
+ * test-cocoa-basic.rb, test-cocoa-core.rb, test-cocoa-media.rb:
193
+ Removed.
194
+
195
+ 2005-04-06 Kouichirou Eto <2005 eto.com>
196
+
197
+ * cocoa-app.rb, cocoa-functions.rb, opengl-app.rb, opengl.rb,
198
+ opengl-draw.rb, opengl-functions.rb, sgl-functions.rb,
199
+ test-all.rb, Makefile: New files.
200
+ * cocoa-win.rb, sgl-core.rb, sgl-video.rb: Removed.
201
+ * cocoa.rb: Update to small stub library.
202
+ * sgl-color.rb: Add test code.
203
+ * sgl.rb: Branch two methods.
204
+ * sample/cocoa*.rb: New files.
205
+ * sample/opengl*.rb: New files.
206
+
207
+ 2005-04-05 Kouichirou Eto <2005 eto.com>
208
+
209
+ * README.en.txt, README.ja.txt: Update.
210
+ * README.txt: Removed.
211
+
212
+ 2005-01-28 Kouichirou Eto <2005 eto.com>
213
+
214
+ * cocoa.rb: Refactoring. Make @block as hash object.
215
+ * tests/test-cocoaapp.rb: add test for movie overlay,
216
+ move view, affine translat.
217
+
218
+ 2005-01-25 Kouichirou Eto <2005 eto.com>
219
+
220
+ * cocoa.rb: Refactoring.
221
+ * cocoa.rb: CocoaReceiver new class
222
+
223
+ 2005-01-21 Kouichirou Eto <2005 eto.com>
224
+
225
+ * cocoa.rb: Refactoring.
226
+
227
+ 2005-01-19 Kouichirou Eto <2005 eto.com>
228
+
229
+ * change directory name from t to samples and tests.
230
+
231
+ 2005-01-05 Kouichirou Eto <2005 eto.com>
232
+
233
+ * change test file name scheme.
234
+
data/Manifest.txt CHANGED
@@ -1,16 +1,110 @@
1
+ ChangeLog
1
2
  History.txt
2
3
  License.txt
3
4
  Manifest.txt
4
5
  README.txt
5
6
  Rakefile
7
+ examples/cocoa1-basic.rb
8
+ examples/cocoa10-transparent.rb
9
+ examples/cocoa11-application.rb
10
+ examples/cocoa2-draw.rb
11
+ examples/cocoa3-affine.rb
12
+ examples/cocoa4-font.rb
13
+ examples/cocoa5-image.rb
14
+ examples/cocoa6-sound.rb
15
+ examples/cocoa7-movie.rb
16
+ examples/cocoa8-movieoverlay.rb
17
+ examples/cocoa9-streaming.rb
18
+ examples/opengl1-basic.rb
19
+ examples/opengl11-application.rb
20
+ examples/opengl2-draw.rb
21
+ examples/opengl3-affine.rb
22
+ examples/sample1.rb
23
+ examples/sample10.rb
24
+ examples/sample11.rb
25
+ examples/sample11a.rb
26
+ examples/sample12.rb
27
+ examples/sample12a.rb
28
+ examples/sample13.rb
29
+ examples/sample15.rb
30
+ examples/sample16.rb
31
+ examples/sample16a.rb
32
+ examples/sample6.rb
33
+ examples/sample7.rb
34
+ examples/sample9.rb
35
+ examples/sgl-sound1.rb
36
+ examples/sgl-sound2.rb
37
+ examples/sine.ogg
38
+ examples/testgl.rb
6
39
  lib/sgl.rb
40
+ lib/sgl/bass-api.rb
41
+ lib/sgl/bass-sample.rb
42
+ lib/sgl/bass.rb
43
+ lib/sgl/cocoa-app.rb
44
+ lib/sgl/cocoa-color.rb
45
+ lib/sgl/cocoa-draw.rb
46
+ lib/sgl/cocoa-event.rb
47
+ lib/sgl/cocoa-media.rb
48
+ lib/sgl/cocoa-notuse.rb
49
+ lib/sgl/cocoa-window.rb
50
+ lib/sgl/cocoa.rb
51
+ lib/sgl/notuse-objs.rb
52
+ lib/sgl/opengl-app.rb
53
+ lib/sgl/opengl-color.rb
54
+ lib/sgl/opengl-draw.rb
55
+ lib/sgl/opengl-event.rb
56
+ lib/sgl/opengl-modules.rb
57
+ lib/sgl/opengl-window.rb
58
+ lib/sgl/opengl.rb
59
+ lib/sgl/sgl-basic.rb
60
+ lib/sgl/sgl-button.rb
61
+ lib/sgl/sgl-client.rb
62
+ lib/sgl/sgl-color.rb
63
+ lib/sgl/sgl-connect.rb
64
+ lib/sgl/sgl-objlib.rb
65
+ lib/sgl/sgl-objs.rb
66
+ lib/sgl/sgl-server.rb
67
+ lib/sgl/sgl-sound.rb
68
+ lib/sgl/sgl-spring.rb
69
+ lib/sgl/sgl-timer.rb
70
+ lib/sgl/sgl.rb
7
71
  lib/sgl/version.rb
72
+ scripts/makemanifest.rb
8
73
  scripts/txt2html
9
74
  setup.rb
75
+ test/test_bass.rb
76
+ test/test_cocoa_app.rb
10
77
  test/test_helper.rb
78
+ test/test_module_ruby16.rb
79
+ test/test_opengl_app.rb
80
+ test/test_opengl_basic.rb
81
+ test/test_opengl_fullscreen.rb
82
+ test/test_opengl_novice.rb
11
83
  test/test_sgl.rb
84
+ test/test_sound.rb
85
+ website/challenge1.html
86
+ website/challenge1.txt
87
+ website/challenge2.html
88
+ website/challenge2.txt
89
+ website/challenge3.html
90
+ website/challenge3.txt
91
+ website/cocoa.html
92
+ website/cocoa.txt
93
+ website/description.html
94
+ website/description.txt
95
+ website/exercise1.html
96
+ website/exercise1.txt
97
+ website/exercise2.html
98
+ website/exercise2.txt
99
+ website/exhibition.html
100
+ website/exhibition.txt
101
+ website/howto.html
102
+ website/howto.txt
12
103
  website/index.html
13
104
  website/index.txt
14
105
  website/javascripts/rounded_corners_lite.inc.js
106
+ website/sound.html
107
+ website/sound.txt
108
+ website/stylesheets/grade.png
15
109
  website/stylesheets/screen.css
16
110
  website/template.rhtml
data/Rakefile CHANGED
@@ -13,7 +13,7 @@ include FileUtils
13
13
  require File.join(File.dirname(__FILE__), 'lib', 'sgl', 'version')
14
14
 
15
15
  AUTHOR = 'Kouichirou Eto'
16
- EMAIL = "eto@rubyforge.org.please.do.not.send.spam.example.com"
16
+ EMAIL = "eto at rubyforge dot org"
17
17
  DESCRIPTION = '"sgl: simple generic library" enables you to create a program with graphics and sound easily.'
18
18
  GEM_NAME = 'sgl'
19
19
 
@@ -155,8 +155,10 @@ task :install_gem => [:clean, :package] do
155
155
  end
156
156
  end
157
157
 
158
+ task :clean => [:chmod]
159
+
158
160
  desc 'Change mode to erase executable bits.'
159
- task :chmod => [:clean] do
161
+ task :chmod do
160
162
  sh "chmod 644 Rakefile ChangeLog"
161
163
  sh "chmod 644 *.txt */*.txt"
162
164
  sh "chmod 644 */*.html"
@@ -169,14 +171,23 @@ end
169
171
 
170
172
  task :replace do
171
173
  require "qp"
172
- Dir.glob("*/*/*.rb").each {|file|
174
+ Dir.glob("*/*/*.rb */*.rb").each {|file|
173
175
  str = open(file) {|f| f.read }
174
- if /\$test/ =~ str
175
- str.gsub!(/\$test/) { '$__test_sgl__' }
176
+ if /2004\-2005/ =~ str
177
+ str.gsub!(/2004\-2005/) { '2004-2007' }
176
178
  qp file, str.length
177
179
  open(file, "wb") {|f| f.print str }
178
180
  end
179
181
  }
180
182
  end
181
183
 
184
+ desc 'Create Manifest.txt file.'
185
+ task :manifest => [:chmod, :clean] do
186
+ ruby "scripts/makemanifest.rb"
187
+ end
188
+
189
+ # Add tasks to gem
190
+ task :gem => [:manifest]
191
+ #task :gem => [:website_generate]
192
+
182
193
  #task :default => :test
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ # Copyright (C) 2004-2007 Kouichirou Eto, All rights reserved.
3
+
4
+ require "sgl/cocoa"
5
+
6
+ def setup
7
+ window 100, 100
8
+ end
9
+
10
+ def display
11
+ line 0, 0, 100, 100
12
+ end
13
+
14
+ mainloop
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env ruby
2
+ # Copyright (C) 2004-2007 Kouichirou Eto, All rights reserved.
3
+
4
+ require "sgl/cocoa"
5
+
6
+ def setup
7
+ $windowBorder = 0
8
+ $windowShadow = 0
9
+ window 700, 700
10
+ backgroundHSV 66, 100, 20, 100
11
+ end
12
+
13
+ def display
14
+ x, y = mouseX, mouseY
15
+ colorHSV 0, 50, 100
16
+ backgroundHSV 66, 100, 20, y/7
17
+ lineWidth 3
18
+ line 0, 0, x, y
19
+ line 700, 0, x, y
20
+ line 0, 700, x, y
21
+ line 700, 700, x, y
22
+ colorHSV 0, 100, 100
23
+ rect x-10, y-10, x+10, y+10
24
+ end
25
+
26
+ mainloop
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+ # Copyright (C) 2004-2007 Kouichirou Eto, All rights reserved.
3
+
4
+ require "sgl/cocoa-app"
5
+
6
+ app = SGL::Application.new
7
+ app.set_setup {
8
+ app.window(100, 100)
9
+ }
10
+ app.set_display {
11
+ app.line(0, 0, 100, 100)
12
+ }
13
+ app.mainloop
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env ruby
2
+ # Copyright (C) 2004-2007 Kouichirou Eto, All rights reserved.
3
+
4
+ require "sgl/cocoa"
5
+
6
+ def setup
7
+ window 300, 300
8
+ backgroundHSV 66, 100, 20
9
+ end
10
+
11
+ def display
12
+ x, y = mouseX, mouseY
13
+ colorHSV 0, 50, 100
14
+ lineWidth 3
15
+ line 0, 0, x, y
16
+ line 300, 0, x, y
17
+ line 0, 300, x, y
18
+ line 300, 300, x, y
19
+ colorHSV 0, 100, 100
20
+ rect x-10, y-10, x+10, y+10
21
+ end
22
+
23
+ mainloop
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # Copyright (C) 2004-2007 Kouichirou Eto, All rights reserved.
3
+
4
+ require "sgl/cocoa"
5
+
6
+ def setup
7
+ window 700, 700
8
+ backgroundHSV 66, 100, 20
9
+ $font1 = font("Helvetica", 25)
10
+ end
11
+
12
+ def display
13
+ x, y = mouseX, mouseY
14
+ colorHSV 0, 50, 100
15
+ lineWidth 3
16
+ line 0, 0, x, y
17
+ line 700, 0, x, y
18
+ line 0, 700, x, y
19
+ line 700, 700, x, y
20
+ colorHSV 0, 100, 100
21
+
22
+ translate x, y
23
+ rotateZ y
24
+ colorHSV y, 100, 100
25
+ $font1.text(10, 10, "hello")
26
+ rect -10, -10, +10, +10
27
+ end
28
+
29
+ mainloop
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env ruby
2
+ # Copyright (C) 2004-2007 Kouichirou Eto, All rights reserved.
3
+
4
+ require "sgl/cocoa"
5
+
6
+ def setup
7
+ window 700, 700
8
+ backgroundHSV 66, 100, 20
9
+ $font1 = font("Helvetica")
10
+ $font2 = font("GothicMB101Pro-Ultra")
11
+ # $font.show_all
12
+ # $font.show_fixed
13
+ end
14
+
15
+ def display
16
+ x, y = mouseX, mouseY
17
+ colorHSV 0, 50, 100, y/3
18
+ $font1.size = x
19
+ $font1.text(x, y, "hello")
20
+ $font2.size = y
21
+ $font2.text(x-50, y-50, "����")
22
+ end
23
+
24
+ mainloop
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env ruby
2
+ # Copyright (C) 2004-2007 Kouichirou Eto, All rights reserved.
3
+
4
+ require "sgl/cocoa"
5
+
6
+ def setup
7
+ $windowShadow = 0
8
+ window 700, 700
9
+ backgroundHSV 66, 100, 20
10
+ $image = image("../media/image-heart.psd")
11
+ end
12
+
13
+ def display
14
+ x, y = mouseX, mouseY
15
+ colorHSV 0, 50, 100, y/5
16
+ backgroundHSV 66, 100, 20, 300-x/2
17
+ $image.rect(100, 100, 200, 200)
18
+ $image.rect(0, 0, x, y)
19
+ $image.rect(x, y, x+100, y+100)
20
+ end
21
+
22
+ mainloop
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env ruby
2
+ # Copyright (C) 2004-2007 Kouichirou Eto, All rights reserved.
3
+
4
+ require "sgl/cocoa"
5
+
6
+ def setup
7
+ window 700, 700
8
+ backgroundHSV 66, 100, 20
9
+ $sound = sound("../media/Pop.aiff")
10
+ end
11
+
12
+ def onMouseDown(x, y)
13
+ if 100 < x && x < 120 && 100 < y && y < 120
14
+ $sound.play
15
+ end
16
+ end
17
+
18
+ def display
19
+ x, y = mouseX, mouseY
20
+ color 100, 0, 0
21
+ rect 100, 100, 120, 120
22
+ end
23
+
24
+ mainloop
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env ruby
2
+ # Copyright (C) 2004-2007 Kouichirou Eto, All rights reserved.
3
+
4
+ require "sgl/cocoa"
5
+
6
+ def setup
7
+ $windowShadow = 0
8
+ window 700, 700
9
+ backgroundHSV 66, 100, 20
10
+ $movie = movie("/Applications/iDVD 3/Tutorial/Media/Background Movie.mov")
11
+ $movie.loop = 1
12
+ end
13
+
14
+ def onMouseDown(x, y)
15
+ if 100 < x && x < 120 && 100 < y && y < 120
16
+ #p x
17
+ $movie.play
18
+ end
19
+
20
+ if 150 < x && x < 170 && 100 < y && y < 120
21
+ $movie.stop
22
+ end
23
+ end
24
+
25
+ def display
26
+ x, y = mouseX, mouseY
27
+ backgroundHSV 66, 100, 20, y/2
28
+
29
+ $movie.rect 100, 200, 500, 500
30
+ $movie.rate = x-350
31
+ $movie.volume = y/7
32
+
33
+ colorHSV 0, 100, 100
34
+ rect 100, 100, 120, 120
35
+
36
+ colorHSV 33, 100, 100
37
+ rect 150, 100, 170, 120
38
+ end
39
+
40
+ mainloop
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env ruby
2
+ # Copyright (C) 2004-2007 Kouichirou Eto, All rights reserved.
3
+
4
+ require "sgl/cocoa"
5
+
6
+ def setup
7
+ $windowShadow = 0
8
+ # $windowBackground = 0
9
+ window 900, 700
10
+ backgroundHSV 66, 100, 20
11
+ $movie = movie("/Applications/iDVD 3/Tutorial/Media/Background Movie.mov")
12
+ $movie.loop = 1
13
+ end
14
+
15
+ def onMouseDown(x, y)
16
+ if 100 < x && x < 120 && 100 < y && y < 120
17
+ $movie.play
18
+ end
19
+ if 150 < x && x < 170 && 100 < y && y < 120
20
+ $movie.stop
21
+ end
22
+ end
23
+
24
+ def display
25
+ x, y = mouseX, mouseY
26
+ backgroundHSV 66, 100, 20, y/2
27
+ $movie.frame 100, 200, 640, 480
28
+ $movie.rate = x-350
29
+ $movie.volume = y/7
30
+ colorHSV 0, 100, 100
31
+ rect 100, 100, 120, 120
32
+ colorHSV 33, 100, 100
33
+ rect 150, 100, 170, 120
34
+ end
35
+
36
+ def displayOverlay
37
+ x, y = mouseX, mouseY
38
+ colorHSV 66, 100, 100, 50
39
+ circle x, y, 20
40
+ end
41
+
42
+ mainloop
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env ruby
2
+ # Copyright (C) 2004-2007 Kouichirou Eto, All rights reserved.
3
+
4
+ require "sgl/cocoa"
5
+
6
+ def setup
7
+ # $windowShadow = 0
8
+ # $windowBackground = 0
9
+ # $windowDelay = 1
10
+ # $windowDelay = 10
11
+ window 900, 700
12
+ backgroundHSV 66, 100, 20
13
+ $bgh = 0
14
+ # $movie1 = movie("../media/tower1.mov")
15
+ $movie1 = movie("../media/sample1.mov")
16
+ $movie1.frame(100, 100, 320, 240)
17
+ $movie1.play
18
+ # $movie2 = movie("../media/powerbook1.mov")
19
+ # $movie2.frame 500, 100, 320, 240
20
+ # $movie2.play
21
+ # $movie3 = movie("../media/imstudio.mov")
22
+ # $movie3.frame 100, 400, 320, 240
23
+ # $movie3.play
24
+ end
25
+
26
+ def display
27
+ x, y = mouseX, mouseY
28
+ backgroundHSV $bgh, 100, 20, y/2
29
+ $bgh = $bgh + 1
30
+ if 100 < $bgh then $bgh = 0; end
31
+ colorHSV 0, 100, 100
32
+ rect 100, 50, 120, 70
33
+ circle x, y, 20
34
+ $movie1.frame(x, y, 320, 240)
35
+ end
36
+
37
+ def nudisplayOverlay
38
+ end
39
+
40
+ mainloop