sgl 0.4.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. data/ChangeLog +254 -234
  2. data/History.txt +6 -0
  3. data/Manifest.txt +10 -0
  4. data/Rakefile +27 -7
  5. data/examples/cocoa1-basic.rb +14 -14
  6. data/examples/cocoa10-transparent.rb +26 -26
  7. data/examples/cocoa11-application.rb +13 -13
  8. data/examples/cocoa2-draw.rb +23 -23
  9. data/examples/cocoa3-affine.rb +29 -29
  10. data/examples/cocoa4-font.rb +24 -24
  11. data/examples/cocoa5-image.rb +22 -22
  12. data/examples/cocoa6-sound.rb +24 -24
  13. data/examples/cocoa7-movie.rb +40 -40
  14. data/examples/cocoa8-movieoverlay.rb +42 -42
  15. data/examples/cocoa9-streaming.rb +40 -40
  16. data/examples/opengl1-basic.rb +14 -14
  17. data/examples/opengl11-application.rb +13 -13
  18. data/examples/opengl2-draw.rb +23 -23
  19. data/examples/opengl3-affine.rb +29 -29
  20. data/examples/sample1.rb +11 -11
  21. data/examples/sample10.rb +16 -16
  22. data/examples/sample11.rb +22 -22
  23. data/examples/sample11a.rb +33 -33
  24. data/examples/sample12.rb +30 -30
  25. data/examples/sample12a.rb +35 -35
  26. data/examples/sample13.rb +116 -116
  27. data/examples/sample15.rb +24 -24
  28. data/examples/sample16.rb +31 -31
  29. data/examples/sample16a.rb +35 -35
  30. data/examples/sample6.rb +18 -18
  31. data/examples/sample7.rb +16 -16
  32. data/examples/sample9.rb +20 -20
  33. data/examples/testgl.rb +169 -169
  34. data/lib/sgl/bass.rb +46 -46
  35. data/lib/sgl/cocoa-app.rb +43 -43
  36. data/lib/sgl/cocoa-color.rb +65 -65
  37. data/lib/sgl/cocoa-draw.rb +72 -72
  38. data/lib/sgl/cocoa-event.rb +229 -229
  39. data/lib/sgl/cocoa-media.rb +144 -144
  40. data/lib/sgl/cocoa-notuse.rb +493 -493
  41. data/lib/sgl/cocoa-window.rb +203 -203
  42. data/lib/sgl/cocoa.rb +8 -8
  43. data/lib/sgl/opengl-app.rb +38 -38
  44. data/lib/sgl/opengl-color.rb +44 -44
  45. data/lib/sgl/opengl-draw.rb +260 -260
  46. data/lib/sgl/opengl-event.rb +325 -325
  47. data/lib/sgl/opengl-modules.rb +22 -22
  48. data/lib/sgl/opengl-window.rb +224 -224
  49. data/lib/sgl/opengl.rb +7 -7
  50. data/lib/sgl/sgl-button.rb +135 -135
  51. data/lib/sgl/sgl-client.rb +21 -21
  52. data/lib/sgl/sgl-color.rb +68 -82
  53. data/lib/sgl/sgl-connect.rb +9 -9
  54. data/lib/sgl/sgl-server.rb +58 -58
  55. data/lib/sgl/sgl-spring.rb +216 -216
  56. data/lib/sgl/version.rb +2 -2
  57. data/scripts/lib-txt2html.rb +130 -0
  58. data/scripts/txt2html +2 -63
  59. data/spec/sgl_spec.rb +13 -0
  60. data/spec/spec.opts +1 -0
  61. data/spec/spec_helper.rb +1 -0
  62. data/test/test_cocoa_app.rb +291 -291
  63. data/test/test_module_ruby16.rb +30 -30
  64. data/test/test_opengl_app.rb +147 -147
  65. data/test/test_opengl_basic.rb +22 -22
  66. data/test/test_opengl_fullscreen.rb +23 -23
  67. data/test/test_opengl_novice.rb +35 -35
  68. data/website/challenge1.html +91 -91
  69. data/website/challenge1.txt +3 -3
  70. data/website/challenge2.html +143 -144
  71. data/website/challenge2.txt +13 -14
  72. data/website/challenge3.html +66 -63
  73. data/website/challenge3.txt +7 -7
  74. data/website/cocoa.html +85 -88
  75. data/website/cocoa.txt +2 -4
  76. data/website/description.html +138 -138
  77. data/website/description.txt +1 -1
  78. data/website/exercise1.html +262 -264
  79. data/website/exercise1.txt +58 -53
  80. data/website/exercise2.html +241 -683
  81. data/website/exercise2.txt +11 -427
  82. data/website/exercise3.html +206 -0
  83. data/website/exercise3.txt +155 -0
  84. data/website/exercise4.html +198 -0
  85. data/website/exercise4.txt +151 -0
  86. data/website/exercise5.html +162 -0
  87. data/website/exercise5.txt +113 -0
  88. data/website/exhibition.html +84 -84
  89. data/website/howto.html +146 -134
  90. data/website/howto.txt +9 -0
  91. data/website/index.html +178 -178
  92. data/website/index.txt +20 -19
  93. data/website/sound.html +141 -141
  94. metadata +16 -3
data/examples/sample11.rb CHANGED
@@ -1,22 +1,22 @@
1
- require "sgl"
2
-
3
- def setup
4
- window -200, -200, 200, 200
5
- background 100
6
- $x = 0
7
- $y = 0
8
- end
9
-
10
- def display
11
- x = mouseX
12
- y = mouseY
13
- speed = 20.0
14
- vx = (x - $x)/speed
15
- vy = (y - $y)/speed
16
- $x = $x + vx
17
- $y = $y + vy
18
- color 100, 0, 0
19
- circle($x, $y, 50, POLYGON)
20
- end
21
-
22
- mainloop
1
+ require "sgl"
2
+
3
+ def setup
4
+ window -200, -200, 200, 200
5
+ background 100
6
+ $x = 0
7
+ $y = 0
8
+ end
9
+
10
+ def display
11
+ x = mouseX
12
+ y = mouseY
13
+ speed = 20.0
14
+ vx = (x - $x)/speed
15
+ vy = (y - $y)/speed
16
+ $x = $x + vx
17
+ $y = $y + vy
18
+ color 100, 0, 0
19
+ circle($x, $y, 50, POLYGON)
20
+ end
21
+
22
+ mainloop
@@ -1,33 +1,33 @@
1
- require "sgl"
2
-
3
- def setup
4
- window -200, -200, 200, 200
5
- background 0
6
- $x1 = 0
7
- $y1 = 0
8
- $x2 = 0
9
- $y2 = 0
10
- end
11
-
12
- def display
13
- x = mouseX
14
- y = mouseY
15
-
16
- speed = 20.0
17
- vx = (x - $x1)/speed
18
- vy = (y - $y1)/speed
19
- $x1 = $x1 + vx
20
- $y1 = $y1 + vy
21
- color (200+$x1)/4, 0, 0
22
- circle($x1, $y1, 50, POLYGON) ## polygon�͓h��‚Ԃ�
23
-
24
- speed = 10.0
25
- vx = (x - $x2)/speed
26
- vy = (y - $y2)/speed
27
- $x2 = $x2 + vx
28
- $y2 = $y2 + vy
29
- color 0,(200+$y2)/4,0
30
- circle($x2+30,$y2+30,80)
31
- end
32
-
33
- mainloop
1
+ require "sgl"
2
+
3
+ def setup
4
+ window -200, -200, 200, 200
5
+ background 0
6
+ $x1 = 0
7
+ $y1 = 0
8
+ $x2 = 0
9
+ $y2 = 0
10
+ end
11
+
12
+ def display
13
+ x = mouseX
14
+ y = mouseY
15
+
16
+ speed = 20.0
17
+ vx = (x - $x1)/speed
18
+ vy = (y - $y1)/speed
19
+ $x1 = $x1 + vx
20
+ $y1 = $y1 + vy
21
+ color (200+$x1)/4, 0, 0
22
+ circle($x1, $y1, 50, POLYGON) ## polygon�͓h��‚Ԃ�
23
+
24
+ speed = 10.0
25
+ vx = (x - $x2)/speed
26
+ vy = (y - $y2)/speed
27
+ $x2 = $x2 + vx
28
+ $y2 = $y2 + vy
29
+ color 0,(200+$y2)/4,0
30
+ circle($x2+30,$y2+30,80)
31
+ end
32
+
33
+ mainloop
data/examples/sample12.rb CHANGED
@@ -1,30 +1,30 @@
1
- require "sgl"
2
-
3
- def setup
4
- window -200, -200, 200, 200
5
- background 100
6
- $pos = [] # ���g����̔z���p�ӂ���D
7
- for a in 0..10 # �z��̗v�f���ꂼ��ɂ‚��ČJ��Ԃ��D
8
- $pos[a] = 0 # ���g�ɑS��0�����Ă����D
9
- end
10
- $index = 0 # ���ݔz��̂ǂ��̕������w���Ă��邩�������ϐ��D
11
- end
12
-
13
- def display
14
- $pos[$index] = mouseX # �z���$index�̎����Ƃ���Ƀ}�E�X��x���W������D
15
-
16
- for a in 0..10 # �z��̗v�f���ꂼ��ɂ‚��ČJ��Ԃ��D
17
- x = $pos[a]
18
- color 0
19
- line x, -100, x, 100 # �c����`���D
20
- end
21
-
22
- $index = $index + 1 # ���݂�����$index�����̒l�̂Ƃ���ɃZ�b�g����D
23
- if 10 < $index # $index���z��̑傫�����z������0�ɃZ�b�g����D
24
- $index = 0
25
- end
26
-
27
- p $pos # $pos�Ƃ����z��̒��g��\������D
28
- end
29
-
30
- mainloop
1
+ require "sgl"
2
+
3
+ def setup
4
+ window -200, -200, 200, 200
5
+ background 100
6
+ $pos = [] # ���g����̔z���p�ӂ���D
7
+ for a in 0..10 # �z��̗v�f���ꂼ��ɂ‚��ČJ��Ԃ��D
8
+ $pos[a] = 0 # ���g�ɑS��0�����Ă����D
9
+ end
10
+ $index = 0 # ���ݔz��̂ǂ��̕������w���Ă��邩�������ϐ��D
11
+ end
12
+
13
+ def display
14
+ $pos[$index] = mouseX # �z���$index�̎����Ƃ���Ƀ}�E�X��x���W������D
15
+
16
+ for a in 0..10 # �z��̗v�f���ꂼ��ɂ‚��ČJ��Ԃ��D
17
+ x = $pos[a]
18
+ color 0
19
+ line x, -100, x, 100 # �c����`���D
20
+ end
21
+
22
+ $index = $index + 1 # ���݂�����$index�����̒l�̂Ƃ���ɃZ�b�g����D
23
+ if 10 < $index # $index���z��̑傫�����z������0�ɃZ�b�g����D
24
+ $index = 0
25
+ end
26
+
27
+ p $pos # $pos�Ƃ����z��̒��g��\������D
28
+ end
29
+
30
+ mainloop
@@ -1,35 +1,35 @@
1
- require "sgl"
2
-
3
- def setup
4
- window -200, -200, 200, 200
5
- background 100
6
- $xpos = [] # ���g����̔z���x���W�Cy���W�ɂ‚��ėp�ӂ���D
7
- $ypos = []
8
- for a in 0..20 # �z��̗v�f���ꂼ��ɂ‚��ČJ��Ԃ��D
9
- $xpos[a] = 0
10
- $ypos[a] = 0
11
- end
12
- $index = 0 # ���ݔz��̂ǂ��̕������w���Ă��邩�������D
13
- end
14
-
15
- def display
16
- $xpos[$index] = mouseX # �Y��
17
- $ypos[$index] = mouseY
18
-
19
- for a in 0..20 # �z��̗v�f���ꂼ��ɂ‚��ČJ��Ԃ��D
20
- x = $xpos[a]
21
- y = $ypos[a]
22
- colorHSV 0, 100, 100, 20
23
- circle x, y, 50, POLYGON
24
- end
25
-
26
- $index = $index + 1 # ���݂�����$index�����̒l�̂Ƃ���ɃZ�b�g����D
27
- if 20 < $index # $index���z��̑傫�����z������0�ɃZ�b�g����
28
- $index = 0
29
- end
30
-
31
- p $xpos
32
- p $ypos
33
- end
34
-
35
- mainloop
1
+ require "sgl"
2
+
3
+ def setup
4
+ window -200, -200, 200, 200
5
+ background 100
6
+ $xpos = [] # ���g����̔z���x���W�Cy���W�ɂ‚��ėp�ӂ���D
7
+ $ypos = []
8
+ for a in 0..20 # �z��̗v�f���ꂼ��ɂ‚��ČJ��Ԃ��D
9
+ $xpos[a] = 0
10
+ $ypos[a] = 0
11
+ end
12
+ $index = 0 # ���ݔz��̂ǂ��̕������w���Ă��邩�������D
13
+ end
14
+
15
+ def display
16
+ $xpos[$index] = mouseX # �Y��
17
+ $ypos[$index] = mouseY
18
+
19
+ for a in 0..20 # �z��̗v�f���ꂼ��ɂ‚��ČJ��Ԃ��D
20
+ x = $xpos[a]
21
+ y = $ypos[a]
22
+ colorHSV 0, 100, 100, 20
23
+ circle x, y, 50, POLYGON
24
+ end
25
+
26
+ $index = $index + 1 # ���݂�����$index�����̒l�̂Ƃ���ɃZ�b�g����D
27
+ if 20 < $index # $index���z��̑傫�����z������0�ɃZ�b�g����
28
+ $index = 0
29
+ end
30
+
31
+ p $xpos
32
+ p $ypos
33
+ end
34
+
35
+ mainloop
data/examples/sample13.rb CHANGED
@@ -1,116 +1,116 @@
1
- require "sgl"
2
-
3
- def setup
4
- window -250, -250, 250, 250
5
- background 100
6
- $a = 0
7
- end
8
-
9
- def display
10
- x = mouseX
11
- y = mouseY
12
-
13
- color 50, 50, 50
14
- rect 190, -190, 200, -240
15
- rect 230, -190, 240, -240
16
- color 100, 0, 0
17
- rect 200, -200, 230, -230
18
-
19
- line x, y, x-5, y
20
-
21
- color 0
22
- circle 150, 150, 5
23
- circle 0, -105, 4
24
- circle -100, 0, 3
25
- circle -150, 80, 2
26
- line 150, 155, 150, 250
27
- line 0, -108, 0, -250
28
- line -100, -2, -100, -250
29
- line -150, 81, -150, 250
30
-
31
- if $a == 0
32
- color 100, 0, 0
33
- line x, y, 215, -200
34
- else
35
- color 100, 0, 0
36
- line 150, 150, 215, -200
37
- end
38
-
39
- # 1�̌�
40
- if $a == 0 && 145 <= x && 155 >= x && 145 <= y && 155 >= y
41
- $a = 1
42
- end
43
-
44
- if $a == 1
45
- color 100, 0, 0
46
- line x, y, 150, 150
47
- elsif $a > 1
48
- line 0, -105, 150, 150
49
- end
50
-
51
- # 2�̌�
52
- if $a == 1 && -5 <= x && 5 >= x && -110 <= y && -100 >= y
53
- $a = 2
54
- end
55
-
56
- if $a == 2
57
- color 100, 0, 0
58
- line x, y, 0, -105
59
- elsif $a > 2
60
- line -100, 0, 0, -105
61
- end
62
-
63
- # 3�̌�
64
- if $a == 2 && -103 <= x && -98 >= x && -3 <= y && 2 >= y
65
- $a = 3
66
- end
67
-
68
- if $a == 3
69
- color 100, 0, 0
70
- line x, y, -100, 0
71
- elsif $a > 3
72
- line -150, 80, -100, 0
73
- end
74
-
75
- # 4�̌�
76
- if $a == 3 && -152 <= x && -148 >= x && 78 <= y && 82 >= y
77
- $a = 4
78
- end
79
-
80
- if $a == 4
81
- color 100, 0, 0
82
- line x, y, -150, 80
83
- end
84
-
85
- # �S�[���n�_
86
- if $a == 4 && -250 <= x && -180 >= x
87
- $a = 5
88
- end
89
-
90
- if $a == 5
91
- background 70, 80, 100
92
- color 100, 80, 80
93
- circle -100, 0, 50, POLYGON
94
- color 80, 80, 100
95
- circle -100, 0, 30, POLYGON
96
- color 100, 80, 80
97
- rect 50, 50, 70, -50
98
-
99
- beginObj(POLYGON)
100
- vertex 70, -7
101
- vertex 112, 35
102
- vertex 138, 35
103
- vertex 70, -33
104
- endObj
105
- beginObj(POLYGON)
106
- vertex 103, 0
107
- vertex 140, -50
108
- vertex 115, -50
109
- vertex 85, -9
110
- endObj
111
- end
112
- end
113
-
114
- mainloop
115
-
116
- # �傫��������n�߂Ȃ��ƒʂ�܂���
1
+ require "sgl"
2
+
3
+ def setup
4
+ window -250, -250, 250, 250
5
+ background 100
6
+ $a = 0
7
+ end
8
+
9
+ def display
10
+ x = mouseX
11
+ y = mouseY
12
+
13
+ color 50, 50, 50
14
+ rect 190, -190, 200, -240
15
+ rect 230, -190, 240, -240
16
+ color 100, 0, 0
17
+ rect 200, -200, 230, -230
18
+
19
+ line x, y, x-5, y
20
+
21
+ color 0
22
+ circle 150, 150, 5
23
+ circle 0, -105, 4
24
+ circle -100, 0, 3
25
+ circle -150, 80, 2
26
+ line 150, 155, 150, 250
27
+ line 0, -108, 0, -250
28
+ line -100, -2, -100, -250
29
+ line -150, 81, -150, 250
30
+
31
+ if $a == 0
32
+ color 100, 0, 0
33
+ line x, y, 215, -200
34
+ else
35
+ color 100, 0, 0
36
+ line 150, 150, 215, -200
37
+ end
38
+
39
+ # 1�̌�
40
+ if $a == 0 && 145 <= x && 155 >= x && 145 <= y && 155 >= y
41
+ $a = 1
42
+ end
43
+
44
+ if $a == 1
45
+ color 100, 0, 0
46
+ line x, y, 150, 150
47
+ elsif $a > 1
48
+ line 0, -105, 150, 150
49
+ end
50
+
51
+ # 2�̌�
52
+ if $a == 1 && -5 <= x && 5 >= x && -110 <= y && -100 >= y
53
+ $a = 2
54
+ end
55
+
56
+ if $a == 2
57
+ color 100, 0, 0
58
+ line x, y, 0, -105
59
+ elsif $a > 2
60
+ line -100, 0, 0, -105
61
+ end
62
+
63
+ # 3�̌�
64
+ if $a == 2 && -103 <= x && -98 >= x && -3 <= y && 2 >= y
65
+ $a = 3
66
+ end
67
+
68
+ if $a == 3
69
+ color 100, 0, 0
70
+ line x, y, -100, 0
71
+ elsif $a > 3
72
+ line -150, 80, -100, 0
73
+ end
74
+
75
+ # 4�̌�
76
+ if $a == 3 && -152 <= x && -148 >= x && 78 <= y && 82 >= y
77
+ $a = 4
78
+ end
79
+
80
+ if $a == 4
81
+ color 100, 0, 0
82
+ line x, y, -150, 80
83
+ end
84
+
85
+ # �S�[���n�_
86
+ if $a == 4 && -250 <= x && -180 >= x
87
+ $a = 5
88
+ end
89
+
90
+ if $a == 5
91
+ background 70, 80, 100
92
+ color 100, 80, 80
93
+ circle -100, 0, 50, POLYGON
94
+ color 80, 80, 100
95
+ circle -100, 0, 30, POLYGON
96
+ color 100, 80, 80
97
+ rect 50, 50, 70, -50
98
+
99
+ beginObj(POLYGON)
100
+ vertex 70, -7
101
+ vertex 112, 35
102
+ vertex 138, 35
103
+ vertex 70, -33
104
+ endObj
105
+ beginObj(POLYGON)
106
+ vertex 103, 0
107
+ vertex 140, -50
108
+ vertex 115, -50
109
+ vertex 85, -9
110
+ endObj
111
+ end
112
+ end
113
+
114
+ mainloop
115
+
116
+ # �傫��������n�߂Ȃ��ƒʂ�܂���