dxopal 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +5 -0
  3. data/.ignore +5 -0
  4. data/.nojekyll +4 -0
  5. data/CHANGELOG.md +90 -0
  6. data/DEVELOPMENT.md +57 -0
  7. data/Gemfile +2 -0
  8. data/Gemfile.lock +39 -0
  9. data/README.md +22 -0
  10. data/Rakefile +66 -0
  11. data/TODO.md +278 -0
  12. data/build/dxopal.js +46590 -0
  13. data/build/dxopal.min.js +1 -0
  14. data/config.ru +39 -0
  15. data/doc/api/DXOpal.html +129 -0
  16. data/doc/api/DXOpal/Font.html +485 -0
  17. data/doc/api/DXOpal/Image.html +2533 -0
  18. data/doc/api/DXOpal/Input.html +1086 -0
  19. data/doc/api/DXOpal/Input/MouseCodes.html +146 -0
  20. data/doc/api/DXOpal/RemoteResource.html +641 -0
  21. data/doc/api/DXOpal/Sound.html +568 -0
  22. data/doc/api/DXOpal/SoundEffect.html +444 -0
  23. data/doc/api/DXOpal/SoundEffect/WaveTypes.html +130 -0
  24. data/doc/api/DXOpal/Sprite.html +1419 -0
  25. data/doc/api/DXOpal/Window.html +1915 -0
  26. data/doc/api/_index.html +228 -0
  27. data/doc/api/class_list.html +51 -0
  28. data/doc/api/css/common.css +1 -0
  29. data/doc/api/css/full_list.css +58 -0
  30. data/doc/api/css/style.css +492 -0
  31. data/doc/api/file.CHANGELOG.html +162 -0
  32. data/doc/api/file.README.html +124 -0
  33. data/doc/api/file_list.html +61 -0
  34. data/doc/api/frames.html +17 -0
  35. data/doc/api/index.html +124 -0
  36. data/doc/api/js/app.js +248 -0
  37. data/doc/api/js/full_list.js +216 -0
  38. data/doc/api/js/jquery.js +4 -0
  39. data/doc/api/method_list.html +939 -0
  40. data/doc/api/top-level-namespace.html +110 -0
  41. data/doc/en/index.html +93 -0
  42. data/doc/ja/index.html +92 -0
  43. data/dxopal.gemspec +29 -0
  44. data/exe/dxopal +44 -0
  45. data/index.html +56 -0
  46. data/opal/dxopal.rb +54 -0
  47. data/opal/dxopal/constants/colors.rb +16 -0
  48. data/opal/dxopal/font.rb +20 -0
  49. data/opal/dxopal/image.rb +301 -0
  50. data/opal/dxopal/input.rb +170 -0
  51. data/opal/dxopal/input/key_codes.rb +168 -0
  52. data/opal/dxopal/remote_resource.rb +65 -0
  53. data/opal/dxopal/sound.rb +53 -0
  54. data/opal/dxopal/sound_effect.rb +84 -0
  55. data/opal/dxopal/sprite.rb +94 -0
  56. data/opal/dxopal/sprite/collision_area.rb +288 -0
  57. data/opal/dxopal/sprite/collision_check.rb +106 -0
  58. data/opal/dxopal/sprite/collision_checker.rb +169 -0
  59. data/opal/dxopal/sprite/physics.rb +82 -0
  60. data/opal/dxopal/version.rb +3 -0
  61. data/opal/dxopal/window.rb +173 -0
  62. data/template/index.html +13 -0
  63. data/template/main.rb +9 -0
  64. metadata +191 -0
@@ -0,0 +1,568 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Class: DXOpal::Sound
8
+
9
+ &mdash; Documentation by YARD 0.9.9
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ pathId = "DXOpal::Sound";
19
+ relpath = '../';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="../class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="../_index.html">Index (S)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../DXOpal.html" title="DXOpal (module)">DXOpal</a></span></span>
41
+ &raquo;
42
+ <span class="title">Sound</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="../class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Class: DXOpal::Sound
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+ <dl>
70
+ <dt>Inherits:</dt>
71
+ <dd>
72
+ <span class="inheritName"><span class='object_link'><a href="RemoteResource.html" title="DXOpal::RemoteResource (class)">RemoteResource</a></span></span>
73
+
74
+ <ul class="fullTree">
75
+ <li>Object</li>
76
+
77
+ <li class="next"><span class='object_link'><a href="RemoteResource.html" title="DXOpal::RemoteResource (class)">RemoteResource</a></span></li>
78
+
79
+ <li class="next">DXOpal::Sound</li>
80
+
81
+ </ul>
82
+ <a href="#" class="inheritanceTree">show all</a>
83
+
84
+ </dd>
85
+ </dl>
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+ <dl>
98
+ <dt>Defined in:</dt>
99
+ <dd>opal/dxopal/sound.rb</dd>
100
+ </dl>
101
+
102
+ </div>
103
+
104
+ <div id="subclasses">
105
+ <h2>Direct Known Subclasses</h2>
106
+ <p class="children"><span class='object_link'><a href="SoundEffect.html" title="DXOpal::SoundEffect (class)">SoundEffect</a></span></p>
107
+ </div>
108
+
109
+
110
+
111
+
112
+ <h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
113
+ <ul class="summary">
114
+
115
+ <li class="public ">
116
+ <span class="summary_signature">
117
+
118
+ <a href="#decoded-instance_method" title="#decoded (instance method)">#<strong>decoded</strong> &#x21d2; Object </a>
119
+
120
+
121
+
122
+ </span>
123
+
124
+
125
+
126
+
127
+
128
+
129
+
130
+
131
+
132
+
133
+
134
+
135
+ <span class="summary_desc"><div class='inline'>
136
+ <p>Returns the value of attribute decoded.</p>
137
+ </div></span>
138
+
139
+ </li>
140
+
141
+
142
+ </ul>
143
+
144
+
145
+
146
+
147
+
148
+ <h2>
149
+ Class Method Summary
150
+ <small><a href="#" class="summary_toggle">collapse</a></small>
151
+ </h2>
152
+
153
+ <ul class="summary">
154
+
155
+ <li class="public ">
156
+ <span class="summary_signature">
157
+
158
+ <a href="#_load-class_method" title="_load (class method)">.<strong>_load</strong>(path_or_url) &#x21d2; Object </a>
159
+
160
+
161
+
162
+ </span>
163
+
164
+
165
+
166
+
167
+
168
+
169
+
170
+
171
+
172
+ <span class="summary_desc"><div class='inline'>
173
+ <p>Load remote sound (called via Window.load_resources).</p>
174
+ </div></span>
175
+
176
+ </li>
177
+
178
+
179
+ <li class="public ">
180
+ <span class="summary_signature">
181
+
182
+ <a href="#audio_context-class_method" title="audio_context (class method)">.<strong>audio_context</strong> &#x21d2; Object </a>
183
+
184
+
185
+
186
+ </span>
187
+
188
+
189
+
190
+
191
+
192
+
193
+
194
+
195
+
196
+ <span class="summary_desc"><div class='inline'>
197
+ <p>Return AudioContext.</p>
198
+ </div></span>
199
+
200
+ </li>
201
+
202
+
203
+ </ul>
204
+
205
+ <h2>
206
+ Instance Method Summary
207
+ <small><a href="#" class="summary_toggle">collapse</a></small>
208
+ </h2>
209
+
210
+ <ul class="summary">
211
+
212
+ <li class="public ">
213
+ <span class="summary_signature">
214
+
215
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(path_or_url) &#x21d2; Sound </a>
216
+
217
+
218
+
219
+ </span>
220
+
221
+
222
+ <span class="note title constructor">constructor</span>
223
+
224
+
225
+
226
+
227
+
228
+
229
+
230
+
231
+ <span class="summary_desc"><div class='inline'>
232
+ <p>A new instance of Sound.</p>
233
+ </div></span>
234
+
235
+ </li>
236
+
237
+
238
+ <li class="public ">
239
+ <span class="summary_signature">
240
+
241
+ <a href="#play-instance_method" title="#play (instance method)">#<strong>play</strong> &#x21d2; Object </a>
242
+
243
+
244
+
245
+ </span>
246
+
247
+
248
+
249
+
250
+
251
+
252
+
253
+
254
+
255
+ <span class="summary_desc"><div class='inline'>
256
+ <p>Play this sound once.</p>
257
+ </div></span>
258
+
259
+ </li>
260
+
261
+
262
+ </ul>
263
+
264
+
265
+
266
+
267
+
268
+
269
+
270
+
271
+
272
+
273
+
274
+ <h3 class="inherited">Methods inherited from <span class='object_link'><a href="RemoteResource.html" title="DXOpal::RemoteResource (class)">RemoteResource</a></span></h3>
275
+ <p class="inherited"><span class='object_link'><a href="RemoteResource.html#[]-class_method" title="DXOpal::RemoteResource.[] (method)">[]</a></span>, <span class='object_link'><a href="RemoteResource.html#_klass_name-class_method" title="DXOpal::RemoteResource._klass_name (method)">_klass_name</a></span>, <span class='object_link'><a href="RemoteResource.html#_load_resources-class_method" title="DXOpal::RemoteResource._load_resources (method)">_load_resources</a></span>, <span class='object_link'><a href="RemoteResource.html#add_class-class_method" title="DXOpal::RemoteResource.add_class (method)">add_class</a></span>, <span class='object_link'><a href="RemoteResource.html#register-class_method" title="DXOpal::RemoteResource.register (method)">register</a></span></p>
276
+ <div id="constructor_details" class="method_details_list">
277
+ <h2>Constructor Details</h2>
278
+
279
+ <div class="method_details first">
280
+ <h3 class="signature first" id="initialize-instance_method">
281
+
282
+ #<strong>initialize</strong>(path_or_url) &#x21d2; <tt><span class='object_link'><a href="" title="DXOpal::Sound (class)">Sound</a></span></tt>
283
+
284
+
285
+
286
+
287
+
288
+ </h3><div class="docstring">
289
+ <div class="discussion">
290
+
291
+ <p>Returns a new instance of Sound</p>
292
+
293
+
294
+ </div>
295
+ </div>
296
+ <div class="tags">
297
+
298
+
299
+ </div><table class="source_code">
300
+ <tr>
301
+ <td>
302
+ <pre class="lines">
303
+
304
+
305
+ 36
306
+ 37
307
+ 38</pre>
308
+ </td>
309
+ <td>
310
+ <pre class="code"><span class="info file"># File 'opal/dxopal/sound.rb', line 36</span>
311
+
312
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_path_or_url'>path_or_url</span><span class='rparen'>)</span>
313
+ <span class='ivar'>@path_or_url</span> <span class='op'>=</span> <span class='id identifier rubyid_path_or_url'>path_or_url</span> <span class='comment'># Used in error message
314
+ </span><span class='kw'>end</span></pre>
315
+ </td>
316
+ </tr>
317
+ </table>
318
+ </div>
319
+
320
+ </div>
321
+
322
+ <div id="instance_attr_details" class="attr_details">
323
+ <h2>Instance Attribute Details</h2>
324
+
325
+
326
+ <span id="decoded=-instance_method"></span>
327
+ <div class="method_details first">
328
+ <h3 class="signature first" id="decoded-instance_method">
329
+
330
+ #<strong>decoded</strong> &#x21d2; <tt>Object</tt>
331
+
332
+
333
+
334
+
335
+
336
+ </h3><div class="docstring">
337
+ <div class="discussion">
338
+
339
+ <p>Returns the value of attribute decoded</p>
340
+
341
+
342
+ </div>
343
+ </div>
344
+ <div class="tags">
345
+
346
+
347
+ </div><table class="source_code">
348
+ <tr>
349
+ <td>
350
+ <pre class="lines">
351
+
352
+
353
+ 39
354
+ 40
355
+ 41</pre>
356
+ </td>
357
+ <td>
358
+ <pre class="code"><span class="info file"># File 'opal/dxopal/sound.rb', line 39</span>
359
+
360
+ <span class='kw'>def</span> <span class='id identifier rubyid_decoded'>decoded</span>
361
+ <span class='ivar'>@decoded</span>
362
+ <span class='kw'>end</span></pre>
363
+ </td>
364
+ </tr>
365
+ </table>
366
+ </div>
367
+
368
+ </div>
369
+
370
+
371
+ <div id="class_method_details" class="method_details_list">
372
+ <h2>Class Method Details</h2>
373
+
374
+
375
+ <div class="method_details first">
376
+ <h3 class="signature first" id="_load-class_method">
377
+
378
+ .<strong>_load</strong>(path_or_url) &#x21d2; <tt>Object</tt>
379
+
380
+
381
+
382
+
383
+
384
+ </h3><div class="docstring">
385
+ <div class="discussion">
386
+
387
+ <p>Load remote sound (called via Window.load_resources)</p>
388
+
389
+
390
+ </div>
391
+ </div>
392
+ <div class="tags">
393
+
394
+
395
+ </div><table class="source_code">
396
+ <tr>
397
+ <td>
398
+ <pre class="lines">
399
+
400
+
401
+ 15
402
+ 16
403
+ 17
404
+ 18
405
+ 19
406
+ 20
407
+ 21
408
+ 22
409
+ 23
410
+ 24
411
+ 25
412
+ 26
413
+ 27
414
+ 28
415
+ 29
416
+ 30
417
+ 31
418
+ 32
419
+ 33
420
+ 34</pre>
421
+ </td>
422
+ <td>
423
+ <pre class="code"><span class="info file"># File 'opal/dxopal/sound.rb', line 15</span>
424
+
425
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid__load'>_load</span><span class='lparen'>(</span><span class='id identifier rubyid_path_or_url'>path_or_url</span><span class='rparen'>)</span>
426
+ <span class='id identifier rubyid_snd'>snd</span> <span class='op'>=</span> <span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_path_or_url'>path_or_url</span><span class='rparen'>)</span>
427
+ <span class='id identifier rubyid_snd_promise'>snd_promise</span> <span class='op'>=</span> <span class='backtick'>%x{</span><span class='tstring_content'>
428
+ new Promise(function(resolve, reject) {
429
+ var request = new XMLHttpRequest();
430
+ request.open(&#39;GET&#39;, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_path_or_url'>path_or_url</span><span class='embexpr_end'>}</span><span class='tstring_content'>, true);
431
+ request.responseType = &#39;arraybuffer&#39;;
432
+ request.onload = function() {
433
+ var audioData = request.response;
434
+ var context = </span><span class='embexpr_beg'>#{</span><span class='const'><span class='object_link'><a href="" title="DXOpal::Sound (class)">Sound</a></span></span><span class='period'>.</span><span class='id identifier rubyid_audio_context'><span class='object_link'><a href="#audio_context-class_method" title="DXOpal::Sound.audio_context (method)">audio_context</a></span></span><span class='embexpr_end'>}</span><span class='tstring_content'>;
435
+ context.decodeAudioData(audioData, function(decoded) {
436
+ snd[&#39;$decoded=&#39;](decoded);
437
+ resolve();
438
+ });
439
+ };
440
+ request.send();
441
+ });
442
+ </span><span class='tstring_end'>}</span></span>
443
+ <span class='kw'>return</span> <span class='id identifier rubyid_snd'>snd</span><span class='comma'>,</span> <span class='id identifier rubyid_snd_promise'>snd_promise</span>
444
+ <span class='kw'>end</span></pre>
445
+ </td>
446
+ </tr>
447
+ </table>
448
+ </div>
449
+
450
+ <div class="method_details ">
451
+ <h3 class="signature " id="audio_context-class_method">
452
+
453
+ .<strong>audio_context</strong> &#x21d2; <tt>Object</tt>
454
+
455
+
456
+
457
+
458
+
459
+ </h3><div class="docstring">
460
+ <div class="discussion">
461
+
462
+ <p>Return AudioContext</p>
463
+
464
+
465
+ </div>
466
+ </div>
467
+ <div class="tags">
468
+
469
+
470
+ </div><table class="source_code">
471
+ <tr>
472
+ <td>
473
+ <pre class="lines">
474
+
475
+
476
+ 8
477
+ 9
478
+ 10
479
+ 11
480
+ 12</pre>
481
+ </td>
482
+ <td>
483
+ <pre class="code"><span class="info file"># File 'opal/dxopal/sound.rb', line 8</span>
484
+
485
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_audio_context'>audio_context</span>
486
+ <span class='cvar'>@@audio_context</span> <span class='op'>||=</span> <span class='backtick'>%x{</span><span class='tstring_content'>
487
+ new (window.AudioContext||window.webkitAudioContext)
488
+ </span><span class='tstring_end'>}</span></span>
489
+ <span class='kw'>end</span></pre>
490
+ </td>
491
+ </tr>
492
+ </table>
493
+ </div>
494
+
495
+ </div>
496
+
497
+ <div id="instance_method_details" class="method_details_list">
498
+ <h2>Instance Method Details</h2>
499
+
500
+
501
+ <div class="method_details first">
502
+ <h3 class="signature first" id="play-instance_method">
503
+
504
+ #<strong>play</strong> &#x21d2; <tt>Object</tt>
505
+
506
+
507
+
508
+
509
+
510
+ </h3><div class="docstring">
511
+ <div class="discussion">
512
+
513
+ <p>Play this sound once</p>
514
+
515
+
516
+ </div>
517
+ </div>
518
+ <div class="tags">
519
+
520
+
521
+ </div><table class="source_code">
522
+ <tr>
523
+ <td>
524
+ <pre class="lines">
525
+
526
+
527
+ 42
528
+ 43
529
+ 44
530
+ 45
531
+ 46
532
+ 47
533
+ 48
534
+ 49
535
+ 50
536
+ 51</pre>
537
+ </td>
538
+ <td>
539
+ <pre class="code"><span class="info file"># File 'opal/dxopal/sound.rb', line 42</span>
540
+
541
+ <span class='kw'>def</span> <span class='id identifier rubyid_play'>play</span>
542
+ <span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Sound </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_path_or_url'>path_or_url</span><span class='embexpr_end'>}</span><span class='tstring_content'> is not loaded yet</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='ivar'>@decoded</span>
543
+ <span class='backtick'>%x{</span><span class='tstring_content'>
544
+ var context = </span><span class='embexpr_beg'>#{</span><span class='const'><span class='object_link'><a href="" title="DXOpal::Sound (class)">Sound</a></span></span><span class='period'>.</span><span class='id identifier rubyid_audio_context'><span class='object_link'><a href="#audio_context-class_method" title="DXOpal::Sound.audio_context (method)">audio_context</a></span></span><span class='embexpr_end'>}</span><span class='tstring_content'>;
545
+ var source = context.createBufferSource();
546
+ source.buffer = </span><span class='embexpr_beg'>#{</span><span class='ivar'>@decoded</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
547
+ source.connect(context.destination);
548
+ source.start(0);
549
+ </span><span class='tstring_end'>}</span></span>
550
+ <span class='kw'>end</span></pre>
551
+ </td>
552
+ </tr>
553
+ </table>
554
+ </div>
555
+
556
+ </div>
557
+
558
+ </div>
559
+
560
+ <div id="footer">
561
+ Generated on Tue Oct 17 13:56:28 2017 by
562
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
563
+ 0.9.9 (ruby-2.4.2).
564
+ </div>
565
+
566
+ </div>
567
+ </body>
568
+ </html>