dxopal 1.5.1 → 1.6.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 (50) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -0
  3. data/DEVELOPMENT.md +4 -4
  4. data/Gemfile +1 -1
  5. data/Gemfile.lock +23 -25
  6. data/README.md +7 -3
  7. data/Rakefile +8 -15
  8. data/build/dxopal.js +57670 -40007
  9. data/build/dxopal.min.js +1 -1
  10. data/config.ru +1 -1
  11. data/doc/api/DXOpal/Constants/Colors.html +172 -0
  12. data/doc/api/DXOpal/Constants.html +115 -0
  13. data/doc/api/DXOpal/Font.html +72 -18
  14. data/doc/api/DXOpal/Image.html +902 -409
  15. data/doc/api/DXOpal/Input/KeyCodes.html +986 -0
  16. data/doc/api/DXOpal/Input/MouseCodes.html +8 -8
  17. data/doc/api/DXOpal/Input/Touch.html +834 -0
  18. data/doc/api/DXOpal/Input.html +833 -104
  19. data/doc/api/DXOpal/RemoteResource.html +170 -41
  20. data/doc/api/DXOpal/Sound.html +33 -27
  21. data/doc/api/DXOpal/SoundEffect/WaveTypes.html +8 -8
  22. data/doc/api/DXOpal/SoundEffect.html +13 -15
  23. data/doc/api/DXOpal/Sprite/CollisionArea/Base.html +649 -0
  24. data/doc/api/DXOpal/Sprite/CollisionArea/Circle.html +656 -0
  25. data/doc/api/DXOpal/Sprite/CollisionArea/Point.html +448 -0
  26. data/doc/api/DXOpal/Sprite/CollisionArea/Rect.html +549 -0
  27. data/doc/api/DXOpal/Sprite/CollisionArea/Triangle.html +423 -0
  28. data/doc/api/DXOpal/Sprite/CollisionArea.html +126 -0
  29. data/doc/api/DXOpal/Sprite/CollisionCheck/ClassMethods.html +268 -0
  30. data/doc/api/DXOpal/Sprite/CollisionCheck.html +926 -0
  31. data/doc/api/DXOpal/Sprite/Physics.html +426 -0
  32. data/doc/api/DXOpal/Sprite.html +522 -45
  33. data/doc/api/DXOpal/Window.html +245 -156
  34. data/doc/api/DXOpal.html +11 -11
  35. data/doc/api/Kernel.html +131 -0
  36. data/doc/api/_index.html +277 -5
  37. data/doc/api/class_list.html +1 -1
  38. data/doc/api/css/style.css +1 -0
  39. data/doc/api/file.README.html +23 -22
  40. data/doc/api/frames.html +10 -5
  41. data/doc/api/index.html +23 -22
  42. data/doc/api/method_list.html +1608 -0
  43. data/doc/api/top-level-namespace.html +155 -4
  44. data/lib/dxopal/input.rb +9 -4
  45. data/lib/dxopal/remote_resource.rb +33 -1
  46. data/lib/dxopal/sound.rb +5 -2
  47. data/lib/dxopal/version.rb +1 -1
  48. data/lib/dxopal/window.rb +6 -3
  49. data/lib/dxopal.rb +1 -0
  50. metadata +21 -8
@@ -6,15 +6,15 @@
6
6
  <title>
7
7
  Class: DXOpal::Sprite
8
8
 
9
- &mdash; Documentation by YARD 0.9.16
9
+ &mdash; Documentation by YARD 0.9.36
10
10
 
11
11
  </title>
12
12
 
13
- <link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" />
14
14
 
15
- <link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" />
16
16
 
17
- <script type="text/javascript" charset="utf-8">
17
+ <script type="text/javascript">
18
18
  pathId = "DXOpal::Sprite";
19
19
  relpath = '../';
20
20
  </script>
@@ -87,14 +87,14 @@
87
87
 
88
88
  <dl>
89
89
  <dt>Extended by:</dt>
90
- <dd>CollisionCheck::ClassMethods</dd>
90
+ <dd><span class='object_link'><a href="Sprite/CollisionCheck/ClassMethods.html" title="DXOpal::Sprite::CollisionCheck::ClassMethods (module)">CollisionCheck::ClassMethods</a></span></dd>
91
91
  </dl>
92
92
 
93
93
 
94
94
 
95
95
  <dl>
96
96
  <dt>Includes:</dt>
97
- <dd>CollisionCheck, Physics</dd>
97
+ <dd><span class='object_link'><a href="Sprite/CollisionCheck.html" title="DXOpal::Sprite::CollisionCheck (module)">CollisionCheck</a></span>, <span class='object_link'><a href="Sprite/Physics.html" title="DXOpal::Sprite::Physics (module)">Physics</a></span></dd>
98
98
  </dl>
99
99
 
100
100
 
@@ -104,11 +104,23 @@
104
104
 
105
105
  <dl>
106
106
  <dt>Defined in:</dt>
107
- <dd>opal/dxopal/sprite.rb</dd>
107
+ <dd>lib/dxopal/sprite.rb<span class="defines">,<br />
108
+ lib/dxopal/sprite/collision_area.rb,<br /> lib/dxopal/sprite/collision_check.rb,<br /> lib/dxopal/sprite/physics.rb</span>
109
+ </dd>
108
110
  </dl>
109
111
 
110
112
  </div>
111
113
 
114
+ <h2>Defined Under Namespace</h2>
115
+ <p class="children">
116
+
117
+
118
+ <strong class="modules">Modules:</strong> <span class='object_link'><a href="Sprite/CollisionArea.html" title="DXOpal::Sprite::CollisionArea (module)">CollisionArea</a></span>, <span class='object_link'><a href="Sprite/CollisionCheck.html" title="DXOpal::Sprite::CollisionCheck (module)">CollisionCheck</a></span>, <span class='object_link'><a href="Sprite/Physics.html" title="DXOpal::Sprite::Physics (module)">Physics</a></span>
119
+
120
+
121
+
122
+
123
+ </p>
112
124
 
113
125
 
114
126
 
@@ -191,8 +203,7 @@
191
203
 
192
204
 
193
205
  <span class="summary_desc"><div class='inline'>
194
- <p>Set blend type (Any of :alpha(default), :add) (:none, :add2 and :sub are
195
- not implemented yet; Pull request is welcome).</p>
206
+ <p>Set blend type (Any of :alpha(default), :add) (:none, :add2 and :sub are not implemented yet; Pull request is welcome).</p>
196
207
  </div></span>
197
208
 
198
209
  </li>
@@ -219,7 +230,7 @@ not implemented yet; Pull request is welcome).</p>
219
230
 
220
231
 
221
232
  <span class="summary_desc"><div class='inline'>
222
- <p>Set rotation center (default: center of `image`).</p>
233
+ <p>Set rotation center (default: center of image`).</p>
223
234
  </div></span>
224
235
 
225
236
  </li>
@@ -246,7 +257,7 @@ not implemented yet; Pull request is welcome).</p>
246
257
 
247
258
 
248
259
  <span class="summary_desc"><div class='inline'>
249
- <p>Set rotation center (default: center of `image`).</p>
260
+ <p>Set rotation center (default: center of image`).</p>
250
261
  </div></span>
251
262
 
252
263
  </li>
@@ -418,6 +429,16 @@ not implemented yet; Pull request is welcome).</p>
418
429
 
419
430
 
420
431
 
432
+
433
+
434
+ <h3 class="inherited">Attributes included from <span class='object_link'><a href="Sprite/Physics.html" title="DXOpal::Sprite::Physics (module)">Physics</a></span></h3>
435
+ <p class="inherited"><span class='object_link'><a href="Sprite/Physics.html#_matter_body-instance_method" title="DXOpal::Sprite::Physics#_matter_body (method)">#_matter_body</a></span></p>
436
+
437
+
438
+
439
+ <h3 class="inherited">Attributes included from <span class='object_link'><a href="Sprite/CollisionCheck.html" title="DXOpal::Sprite::CollisionCheck (module)">CollisionCheck</a></span></h3>
440
+ <p class="inherited"><span class='object_link'><a href="Sprite/CollisionCheck.html#_collision_area-instance_method" title="DXOpal::Sprite::CollisionCheck#_collision_area (method)">#_collision_area</a></span>, <span class='object_link'><a href="Sprite/CollisionCheck.html#collision-instance_method" title="DXOpal::Sprite::CollisionCheck#collision (method)">#collision</a></span>, <span class='object_link'><a href="Sprite/CollisionCheck.html#collision_enable-instance_method" title="DXOpal::Sprite::CollisionCheck#collision_enable (method)">#collision_enable</a></span>, <span class='object_link'><a href="Sprite/CollisionCheck.html#collision_sync-instance_method" title="DXOpal::Sprite::CollisionCheck#collision_sync (method)">#collision_sync</a></span></p>
441
+
421
442
 
422
443
 
423
444
  <h2>
@@ -430,6 +451,100 @@ not implemented yet; Pull request is welcome).</p>
430
451
  <li class="public ">
431
452
  <span class="summary_signature">
432
453
 
454
+ <a href="#_add_matter_body-class_method" title="_add_matter_body (class method)">.<strong>_add_matter_body</strong>(body, type, sprite, info) &#x21d2; Object </a>
455
+
456
+
457
+
458
+ </span>
459
+
460
+
461
+
462
+
463
+
464
+
465
+
466
+
467
+
468
+ <span class="summary_desc"><div class='inline'></div></span>
469
+
470
+ </li>
471
+
472
+
473
+ <li class="public ">
474
+ <span class="summary_signature">
475
+
476
+ <a href="#_matter_engine-class_method" title="_matter_engine (class method)">.<strong>_matter_engine</strong> &#x21d2; Object </a>
477
+
478
+
479
+
480
+ </span>
481
+
482
+
483
+
484
+
485
+
486
+
487
+
488
+
489
+
490
+ <span class="summary_desc"><div class='inline'>
491
+ <p>(internal) Matter.Engine instance.</p>
492
+ </div></span>
493
+
494
+ </li>
495
+
496
+
497
+ <li class="public ">
498
+ <span class="summary_signature">
499
+
500
+ <a href="#_matter_runner-class_method" title="_matter_runner (class method)">.<strong>_matter_runner</strong> &#x21d2; Object </a>
501
+
502
+
503
+
504
+ </span>
505
+
506
+
507
+
508
+
509
+
510
+
511
+
512
+
513
+
514
+ <span class="summary_desc"><div class='inline'>
515
+ <p>(internal) Matter.Runner instance.</p>
516
+ </div></span>
517
+
518
+ </li>
519
+
520
+
521
+ <li class="public ">
522
+ <span class="summary_signature">
523
+
524
+ <a href="#_matter_sprites-class_method" title="_matter_sprites (class method)">.<strong>_matter_sprites</strong> &#x21d2; Object </a>
525
+
526
+
527
+
528
+ </span>
529
+
530
+
531
+
532
+
533
+
534
+
535
+
536
+
537
+
538
+ <span class="summary_desc"><div class='inline'>
539
+ <p>(internal).</p>
540
+ </div></span>
541
+
542
+ </li>
543
+
544
+
545
+ <li class="public ">
546
+ <span class="summary_signature">
547
+
433
548
  <a href="#clean-class_method" title="clean (class method)">.<strong>clean</strong>(sprites) &#x21d2; Object </a>
434
549
 
435
550
 
@@ -472,6 +587,54 @@ not implemented yet; Pull request is welcome).</p>
472
587
  <p>Draw each of the given sprites (unless it is vanished).</p>
473
588
  </div></span>
474
589
 
590
+ </li>
591
+
592
+
593
+ <li class="public ">
594
+ <span class="summary_signature">
595
+
596
+ <a href="#matter_enabled%3F-class_method" title="matter_enabled? (class method)">.<strong>matter_enabled?</strong> &#x21d2; Boolean </a>
597
+
598
+
599
+
600
+ </span>
601
+
602
+
603
+
604
+
605
+
606
+
607
+
608
+
609
+
610
+ <span class="summary_desc"><div class='inline'>
611
+ <p>Return true if ‘physical_body=` is ever called.</p>
612
+ </div></span>
613
+
614
+ </li>
615
+
616
+
617
+ <li class="public ">
618
+ <span class="summary_signature">
619
+
620
+ <a href="#matter_tick-class_method" title="matter_tick (class method)">.<strong>matter_tick</strong>(time) &#x21d2; Object </a>
621
+
622
+
623
+
624
+ </span>
625
+
626
+
627
+
628
+
629
+
630
+
631
+
632
+
633
+
634
+ <span class="summary_desc"><div class='inline'>
635
+ <p>Call Matter.Runner.tick - time: time given by requestAnimationFrame.</p>
636
+ </div></span>
637
+
475
638
  </li>
476
639
 
477
640
 
@@ -652,7 +815,37 @@ not implemented yet; Pull request is welcome).</p>
652
815
 
653
816
 
654
817
 
655
- <div id="constructor_details" class="method_details_list">
818
+
819
+
820
+
821
+
822
+
823
+
824
+ <h3 class="inherited">Methods included from <span class='object_link'><a href="Sprite/CollisionCheck/ClassMethods.html" title="DXOpal::Sprite::CollisionCheck::ClassMethods (module)">CollisionCheck::ClassMethods</a></span></h3>
825
+ <p class="inherited"><span class='object_link'><a href="Sprite/CollisionCheck/ClassMethods.html#check-instance_method" title="DXOpal::Sprite::CollisionCheck::ClassMethods#check (method)">check</a></span></p>
826
+
827
+
828
+
829
+
830
+
831
+
832
+
833
+
834
+
835
+ <h3 class="inherited">Methods included from <span class='object_link'><a href="Sprite/Physics.html" title="DXOpal::Sprite::Physics (module)">Physics</a></span></h3>
836
+ <p class="inherited"><span class='object_link'><a href="Sprite/Physics.html#_move_matter_body-instance_method" title="DXOpal::Sprite::Physics#_move_matter_body (method)">#_move_matter_body</a></span>, <span class='object_link'><a href="Sprite/Physics.html#_move_to_matter_body-instance_method" title="DXOpal::Sprite::Physics#_move_to_matter_body (method)">#_move_to_matter_body</a></span>, <span class='object_link'><a href="Sprite/Physics.html#physical_body=-instance_method" title="DXOpal::Sprite::Physics#physical_body= (method)">#physical_body=</a></span></p>
837
+
838
+
839
+
840
+
841
+
842
+
843
+
844
+
845
+
846
+ <h3 class="inherited">Methods included from <span class='object_link'><a href="Sprite/CollisionCheck.html" title="DXOpal::Sprite::CollisionCheck (module)">CollisionCheck</a></span></h3>
847
+ <p class="inherited"><span class='object_link'><a href="Sprite/CollisionCheck.html#===-instance_method" title="DXOpal::Sprite::CollisionCheck#=== (method)">#===</a></span>, <span class='object_link'><a href="Sprite/CollisionCheck.html#_collidable%3F-instance_method" title="DXOpal::Sprite::CollisionCheck#_collidable? (method)">#_collidable?</a></span>, <span class='object_link'><a href="Sprite/CollisionCheck.html#_collides%3F-instance_method" title="DXOpal::Sprite::CollisionCheck#_collides? (method)">#_collides?</a></span>, <span class='object_link'><a href="Sprite/CollisionCheck.html#_init_collision_info-instance_method" title="DXOpal::Sprite::CollisionCheck#_init_collision_info (method)">#_init_collision_info</a></span>, <span class='object_link'><a href="Sprite/CollisionCheck.html#check-instance_method" title="DXOpal::Sprite::CollisionCheck#check (method)">#check</a></span>, <span class='object_link'><a href="Sprite/CollisionCheck.html#hit-instance_method" title="DXOpal::Sprite::CollisionCheck#hit (method)">#hit</a></span>, <span class='object_link'><a href="Sprite/CollisionCheck.html#shot-instance_method" title="DXOpal::Sprite::CollisionCheck#shot (method)">#shot</a></span></p>
848
+ <div id="constructor_details" class="method_details_list">
656
849
  <h2>Constructor Details</h2>
657
850
 
658
851
  <div class="method_details first">
@@ -667,7 +860,7 @@ not implemented yet; Pull request is welcome).</p>
667
860
  </h3><div class="docstring">
668
861
  <div class="discussion">
669
862
 
670
- <p>Returns a new instance of Sprite</p>
863
+ <p>Returns a new instance of Sprite.</p>
671
864
 
672
865
 
673
866
  </div>
@@ -697,7 +890,7 @@ not implemented yet; Pull request is welcome).</p>
697
890
  47</pre>
698
891
  </td>
699
892
  <td>
700
- <pre class="code"><span class="info file"># File 'opal/dxopal/sprite.rb', line 34</span>
893
+ <pre class="code"><span class="info file"># File 'lib/dxopal/sprite.rb', line 34</span>
701
894
 
702
895
  <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_x'>x</span><span class='op'>=</span><span class='int'>0</span><span class='comma'>,</span> <span class='id identifier rubyid_y'>y</span><span class='op'>=</span><span class='int'>0</span><span class='comma'>,</span> <span class='id identifier rubyid_image'>image</span><span class='op'>=</span><span class='kw'>nil</span><span class='rparen'>)</span>
703
896
  <span class='ivar'>@x</span><span class='comma'>,</span> <span class='ivar'>@y</span><span class='comma'>,</span> <span class='ivar'>@image</span> <span class='op'>=</span> <span class='id identifier rubyid_x'>x</span><span class='comma'>,</span> <span class='id identifier rubyid_y'>y</span><span class='comma'>,</span> <span class='id identifier rubyid_image'>image</span>
@@ -756,7 +949,7 @@ not implemented yet; Pull request is welcome).</p>
756
949
  59</pre>
757
950
  </td>
758
951
  <td>
759
- <pre class="code"><span class="info file"># File 'opal/dxopal/sprite.rb', line 57</span>
952
+ <pre class="code"><span class="info file"># File 'lib/dxopal/sprite.rb', line 57</span>
760
953
 
761
954
  <span class='kw'>def</span> <span class='id identifier rubyid_alpha'>alpha</span>
762
955
  <span class='ivar'>@alpha</span>
@@ -799,7 +992,7 @@ not implemented yet; Pull request is welcome).</p>
799
992
  53</pre>
800
993
  </td>
801
994
  <td>
802
- <pre class="code"><span class="info file"># File 'opal/dxopal/sprite.rb', line 51</span>
995
+ <pre class="code"><span class="info file"># File 'lib/dxopal/sprite.rb', line 51</span>
803
996
 
804
997
  <span class='kw'>def</span> <span class='id identifier rubyid_angle'>angle</span>
805
998
  <span class='ivar'>@angle</span>
@@ -823,8 +1016,7 @@ not implemented yet; Pull request is welcome).</p>
823
1016
  </h3><div class="docstring">
824
1017
  <div class="discussion">
825
1018
 
826
- <p>Set blend type (Any of :alpha(default), :add) (:none, :add2 and :sub are
827
- not implemented yet; Pull request is welcome)</p>
1019
+ <p>Set blend type (Any of :alpha(default), :add) (:none, :add2 and :sub are not implemented yet; Pull request is welcome)</p>
828
1020
 
829
1021
 
830
1022
  </div>
@@ -843,7 +1035,7 @@ not implemented yet; Pull request is welcome)</p>
843
1035
  62</pre>
844
1036
  </td>
845
1037
  <td>
846
- <pre class="code"><span class="info file"># File 'opal/dxopal/sprite.rb', line 60</span>
1038
+ <pre class="code"><span class="info file"># File 'lib/dxopal/sprite.rb', line 60</span>
847
1039
 
848
1040
  <span class='kw'>def</span> <span class='id identifier rubyid_blend'>blend</span>
849
1041
  <span class='ivar'>@blend</span>
@@ -867,7 +1059,7 @@ not implemented yet; Pull request is welcome)</p>
867
1059
  </h3><div class="docstring">
868
1060
  <div class="discussion">
869
1061
 
870
- <p>Set rotation center (default: center of `image`)</p>
1062
+ <p>Set rotation center (default: center of image`)</p>
871
1063
 
872
1064
 
873
1065
  </div>
@@ -886,7 +1078,7 @@ not implemented yet; Pull request is welcome)</p>
886
1078
  57</pre>
887
1079
  </td>
888
1080
  <td>
889
- <pre class="code"><span class="info file"># File 'opal/dxopal/sprite.rb', line 55</span>
1081
+ <pre class="code"><span class="info file"># File 'lib/dxopal/sprite.rb', line 55</span>
890
1082
 
891
1083
  <span class='kw'>def</span> <span class='id identifier rubyid_center_x'>center_x</span>
892
1084
  <span class='ivar'>@center_x</span>
@@ -910,7 +1102,7 @@ not implemented yet; Pull request is welcome)</p>
910
1102
  </h3><div class="docstring">
911
1103
  <div class="discussion">
912
1104
 
913
- <p>Set rotation center (default: center of `image`)</p>
1105
+ <p>Set rotation center (default: center of image`)</p>
914
1106
 
915
1107
 
916
1108
  </div>
@@ -929,7 +1121,7 @@ not implemented yet; Pull request is welcome)</p>
929
1121
  57</pre>
930
1122
  </td>
931
1123
  <td>
932
- <pre class="code"><span class="info file"># File 'opal/dxopal/sprite.rb', line 55</span>
1124
+ <pre class="code"><span class="info file"># File 'lib/dxopal/sprite.rb', line 55</span>
933
1125
 
934
1126
  <span class='kw'>def</span> <span class='id identifier rubyid_center_y'>center_y</span>
935
1127
  <span class='ivar'>@center_y</span>
@@ -972,7 +1164,7 @@ not implemented yet; Pull request is welcome)</p>
972
1164
  55</pre>
973
1165
  </td>
974
1166
  <td>
975
- <pre class="code"><span class="info file"># File 'opal/dxopal/sprite.rb', line 53</span>
1167
+ <pre class="code"><span class="info file"># File 'lib/dxopal/sprite.rb', line 53</span>
976
1168
 
977
1169
  <span class='kw'>def</span> <span class='id identifier rubyid_scale_x'>scale_x</span>
978
1170
  <span class='ivar'>@scale_x</span>
@@ -1015,7 +1207,7 @@ not implemented yet; Pull request is welcome)</p>
1015
1207
  55</pre>
1016
1208
  </td>
1017
1209
  <td>
1018
- <pre class="code"><span class="info file"># File 'opal/dxopal/sprite.rb', line 53</span>
1210
+ <pre class="code"><span class="info file"># File 'lib/dxopal/sprite.rb', line 53</span>
1019
1211
 
1020
1212
  <span class='kw'>def</span> <span class='id identifier rubyid_scale_y'>scale_y</span>
1021
1213
  <span class='ivar'>@scale_y</span>
@@ -1039,7 +1231,7 @@ not implemented yet; Pull request is welcome)</p>
1039
1231
  </h3><div class="docstring">
1040
1232
  <div class="discussion">
1041
1233
 
1042
- <p>Returns the value of attribute visible</p>
1234
+ <p>Returns the value of attribute visible.</p>
1043
1235
 
1044
1236
 
1045
1237
  </div>
@@ -1058,7 +1250,7 @@ not implemented yet; Pull request is welcome)</p>
1058
1250
  50</pre>
1059
1251
  </td>
1060
1252
  <td>
1061
- <pre class="code"><span class="info file"># File 'opal/dxopal/sprite.rb', line 48</span>
1253
+ <pre class="code"><span class="info file"># File 'lib/dxopal/sprite.rb', line 48</span>
1062
1254
 
1063
1255
  <span class='kw'>def</span> <span class='id identifier rubyid_visible'>visible</span>
1064
1256
  <span class='ivar'>@visible</span>
@@ -1082,7 +1274,7 @@ not implemented yet; Pull request is welcome)</p>
1082
1274
  </h3><div class="docstring">
1083
1275
  <div class="discussion">
1084
1276
 
1085
- <p>Returns the value of attribute x</p>
1277
+ <p>Returns the value of attribute x.</p>
1086
1278
 
1087
1279
 
1088
1280
  </div>
@@ -1101,7 +1293,7 @@ not implemented yet; Pull request is welcome)</p>
1101
1293
  64</pre>
1102
1294
  </td>
1103
1295
  <td>
1104
- <pre class="code"><span class="info file"># File 'opal/dxopal/sprite.rb', line 62</span>
1296
+ <pre class="code"><span class="info file"># File 'lib/dxopal/sprite.rb', line 62</span>
1105
1297
 
1106
1298
  <span class='kw'>def</span> <span class='id identifier rubyid_x'>x</span>
1107
1299
  <span class='ivar'>@x</span>
@@ -1125,7 +1317,7 @@ not implemented yet; Pull request is welcome)</p>
1125
1317
  </h3><div class="docstring">
1126
1318
  <div class="discussion">
1127
1319
 
1128
- <p>Returns the value of attribute y</p>
1320
+ <p>Returns the value of attribute y.</p>
1129
1321
 
1130
1322
 
1131
1323
  </div>
@@ -1144,7 +1336,7 @@ not implemented yet; Pull request is welcome)</p>
1144
1336
  64</pre>
1145
1337
  </td>
1146
1338
  <td>
1147
- <pre class="code"><span class="info file"># File 'opal/dxopal/sprite.rb', line 62</span>
1339
+ <pre class="code"><span class="info file"># File 'lib/dxopal/sprite.rb', line 62</span>
1148
1340
 
1149
1341
  <span class='kw'>def</span> <span class='id identifier rubyid_y'>y</span>
1150
1342
  <span class='ivar'>@y</span>
@@ -1168,7 +1360,7 @@ not implemented yet; Pull request is welcome)</p>
1168
1360
  </h3><div class="docstring">
1169
1361
  <div class="discussion">
1170
1362
 
1171
- <p>Returns the value of attribute z</p>
1363
+ <p>Returns the value of attribute z.</p>
1172
1364
 
1173
1365
 
1174
1366
  </div>
@@ -1187,7 +1379,7 @@ not implemented yet; Pull request is welcome)</p>
1187
1379
  50</pre>
1188
1380
  </td>
1189
1381
  <td>
1190
- <pre class="code"><span class="info file"># File 'opal/dxopal/sprite.rb', line 48</span>
1382
+ <pre class="code"><span class="info file"># File 'lib/dxopal/sprite.rb', line 48</span>
1191
1383
 
1192
1384
  <span class='kw'>def</span> <span class='id identifier rubyid_z'>z</span>
1193
1385
  <span class='ivar'>@z</span>
@@ -1205,7 +1397,162 @@ not implemented yet; Pull request is welcome)</p>
1205
1397
 
1206
1398
 
1207
1399
  <div class="method_details first">
1208
- <h3 class="signature first" id="clean-class_method">
1400
+ <h3 class="signature first" id="_add_matter_body-class_method">
1401
+
1402
+ .<strong>_add_matter_body</strong>(body, type, sprite, info) &#x21d2; <tt>Object</tt>
1403
+
1404
+
1405
+
1406
+
1407
+
1408
+ </h3><table class="source_code">
1409
+ <tr>
1410
+ <td>
1411
+ <pre class="lines">
1412
+
1413
+
1414
+ 54
1415
+ 55
1416
+ 56
1417
+ 57</pre>
1418
+ </td>
1419
+ <td>
1420
+ <pre class="code"><span class="info file"># File 'lib/dxopal/sprite/physics.rb', line 54</span>
1421
+
1422
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid__add_matter_body'>_add_matter_body</span><span class='lparen'>(</span><span class='id identifier rubyid_body'>body</span><span class='comma'>,</span> <span class='id identifier rubyid_type'>type</span><span class='comma'>,</span> <span class='id identifier rubyid_sprite'>sprite</span><span class='comma'>,</span> <span class='id identifier rubyid_info'>info</span><span class='rparen'>)</span>
1423
+ <span class='id identifier rubyid__matter_sprites'>_matter_sprites</span><span class='lbracket'>[</span><span class='backtick'>`</span><span class='tstring_content'>body.id</span><span class='tstring_end'>`</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='id identifier rubyid_type'>type</span><span class='comma'>,</span> <span class='id identifier rubyid_sprite'>sprite</span><span class='comma'>,</span> <span class='id identifier rubyid_info'>info</span><span class='rbracket'>]</span>
1424
+ <span class='backtick'>`</span><span class='tstring_content'>Matter.World.addBody(</span><span class='embexpr_beg'>#{</span><span class='const'><span class='object_link'><a href="" title="DXOpal::Sprite (class)">Sprite</a></span></span><span class='period'>.</span><span class='id identifier rubyid__matter_engine'><span class='object_link'><a href="#_matter_engine-class_method" title="DXOpal::Sprite._matter_engine (method)">_matter_engine</a></span></span><span class='embexpr_end'>}</span><span class='tstring_content'>.world, body)</span><span class='tstring_end'>`</span></span>
1425
+ <span class='kw'>end</span></pre>
1426
+ </td>
1427
+ </tr>
1428
+ </table>
1429
+ </div>
1430
+
1431
+ <div class="method_details ">
1432
+ <h3 class="signature " id="_matter_engine-class_method">
1433
+
1434
+ .<strong>_matter_engine</strong> &#x21d2; <tt>Object</tt>
1435
+
1436
+
1437
+
1438
+
1439
+
1440
+ </h3><div class="docstring">
1441
+ <div class="discussion">
1442
+
1443
+ <p>(internal) Matter.Engine instance</p>
1444
+
1445
+
1446
+ </div>
1447
+ </div>
1448
+ <div class="tags">
1449
+
1450
+
1451
+ </div><table class="source_code">
1452
+ <tr>
1453
+ <td>
1454
+ <pre class="lines">
1455
+
1456
+
1457
+ 40
1458
+ 41
1459
+ 42</pre>
1460
+ </td>
1461
+ <td>
1462
+ <pre class="code"><span class="info file"># File 'lib/dxopal/sprite/physics.rb', line 40</span>
1463
+
1464
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid__matter_engine'>_matter_engine</span>
1465
+ <span class='ivar'>@matter_engine</span> <span class='op'>||=</span> <span class='backtick'>`</span><span class='tstring_content'>Matter.Engine.create()</span><span class='tstring_end'>`</span></span>
1466
+ <span class='kw'>end</span></pre>
1467
+ </td>
1468
+ </tr>
1469
+ </table>
1470
+ </div>
1471
+
1472
+ <div class="method_details ">
1473
+ <h3 class="signature " id="_matter_runner-class_method">
1474
+
1475
+ .<strong>_matter_runner</strong> &#x21d2; <tt>Object</tt>
1476
+
1477
+
1478
+
1479
+
1480
+
1481
+ </h3><div class="docstring">
1482
+ <div class="discussion">
1483
+
1484
+ <p>(internal) Matter.Runner instance</p>
1485
+
1486
+
1487
+ </div>
1488
+ </div>
1489
+ <div class="tags">
1490
+
1491
+
1492
+ </div><table class="source_code">
1493
+ <tr>
1494
+ <td>
1495
+ <pre class="lines">
1496
+
1497
+
1498
+ 45
1499
+ 46
1500
+ 47</pre>
1501
+ </td>
1502
+ <td>
1503
+ <pre class="code"><span class="info file"># File 'lib/dxopal/sprite/physics.rb', line 45</span>
1504
+
1505
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid__matter_runner'>_matter_runner</span>
1506
+ <span class='ivar'>@matter_runner</span> <span class='op'>||=</span> <span class='backtick'>`</span><span class='tstring_content'>Matter.Runner.create()</span><span class='tstring_end'>`</span></span>
1507
+ <span class='kw'>end</span></pre>
1508
+ </td>
1509
+ </tr>
1510
+ </table>
1511
+ </div>
1512
+
1513
+ <div class="method_details ">
1514
+ <h3 class="signature " id="_matter_sprites-class_method">
1515
+
1516
+ .<strong>_matter_sprites</strong> &#x21d2; <tt>Object</tt>
1517
+
1518
+
1519
+
1520
+
1521
+
1522
+ </h3><div class="docstring">
1523
+ <div class="discussion">
1524
+
1525
+ <p>(internal)</p>
1526
+
1527
+
1528
+ </div>
1529
+ </div>
1530
+ <div class="tags">
1531
+
1532
+
1533
+ </div><table class="source_code">
1534
+ <tr>
1535
+ <td>
1536
+ <pre class="lines">
1537
+
1538
+
1539
+ 50
1540
+ 51
1541
+ 52</pre>
1542
+ </td>
1543
+ <td>
1544
+ <pre class="code"><span class="info file"># File 'lib/dxopal/sprite/physics.rb', line 50</span>
1545
+
1546
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid__matter_sprites'>_matter_sprites</span>
1547
+ <span class='ivar'>@matter_bodies</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
1548
+ <span class='kw'>end</span></pre>
1549
+ </td>
1550
+ </tr>
1551
+ </table>
1552
+ </div>
1553
+
1554
+ <div class="method_details ">
1555
+ <h3 class="signature " id="clean-class_method">
1209
1556
 
1210
1557
  .<strong>clean</strong>(sprites) &#x21d2; <tt>Object</tt>
1211
1558
 
@@ -1237,7 +1584,7 @@ not implemented yet; Pull request is welcome)</p>
1237
1584
  24</pre>
1238
1585
  </td>
1239
1586
  <td>
1240
- <pre class="code"><span class="info file"># File 'opal/dxopal/sprite.rb', line 20</span>
1587
+ <pre class="code"><span class="info file"># File 'lib/dxopal/sprite.rb', line 20</span>
1241
1588
 
1242
1589
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_clean'>clean</span><span class='lparen'>(</span><span class='id identifier rubyid_sprites'>sprites</span><span class='rparen'>)</span>
1243
1590
  <span class='id identifier rubyid_sprites'>sprites</span><span class='period'>.</span><span class='id identifier rubyid_reject!'>reject!</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_sprite'>sprite</span><span class='op'>|</span>
@@ -1283,7 +1630,7 @@ not implemented yet; Pull request is welcome)</p>
1283
1630
  32</pre>
1284
1631
  </td>
1285
1632
  <td>
1286
- <pre class="code"><span class="info file"># File 'opal/dxopal/sprite.rb', line 27</span>
1633
+ <pre class="code"><span class="info file"># File 'lib/dxopal/sprite.rb', line 27</span>
1287
1634
 
1288
1635
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_draw'>draw</span><span class='lparen'>(</span><span class='id identifier rubyid_sprites'>sprites</span><span class='rparen'>)</span>
1289
1636
  <span class='id identifier rubyid_sprites'>sprites</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span><span class='period'>.</span><span class='id identifier rubyid_sort_by'>sort_by</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:z</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_sprite'>sprite</span><span class='op'>|</span>
@@ -1294,6 +1641,136 @@ not implemented yet; Pull request is welcome)</p>
1294
1641
  </td>
1295
1642
  </tr>
1296
1643
  </table>
1644
+ </div>
1645
+
1646
+ <div class="method_details ">
1647
+ <h3 class="signature " id="matter_enabled?-class_method">
1648
+
1649
+ .<strong>matter_enabled?</strong> &#x21d2; <tt>Boolean</tt>
1650
+
1651
+
1652
+
1653
+
1654
+
1655
+ </h3><div class="docstring">
1656
+ <div class="discussion">
1657
+
1658
+ <p>Return true if ‘physical_body=` is ever called</p>
1659
+
1660
+
1661
+ </div>
1662
+ </div>
1663
+ <div class="tags">
1664
+
1665
+ <p class="tag_title">Returns:</p>
1666
+ <ul class="return">
1667
+
1668
+ <li>
1669
+
1670
+
1671
+ <span class='type'>(<tt>Boolean</tt>)</span>
1672
+
1673
+
1674
+
1675
+ </li>
1676
+
1677
+ </ul>
1678
+
1679
+ </div><table class="source_code">
1680
+ <tr>
1681
+ <td>
1682
+ <pre class="lines">
1683
+
1684
+
1685
+ 60
1686
+ 61
1687
+ 62
1688
+ 63
1689
+ 64</pre>
1690
+ </td>
1691
+ <td>
1692
+ <pre class="code"><span class="info file"># File 'lib/dxopal/sprite/physics.rb', line 60</span>
1693
+
1694
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_matter_enabled?'>matter_enabled?</span>
1695
+ <span class='comment'># Note: we cannot use `!!` here because @matter_engine may be a JS object,
1696
+ </span> <span class='comment'># which does not have Ruby&#39;s `!@` method
1697
+ </span> <span class='ivar'>@matter_engine</span> <span class='op'>?</span> <span class='kw'>true</span> <span class='op'>:</span> <span class='kw'>false</span>
1698
+ <span class='kw'>end</span></pre>
1699
+ </td>
1700
+ </tr>
1701
+ </table>
1702
+ </div>
1703
+
1704
+ <div class="method_details ">
1705
+ <h3 class="signature " id="matter_tick-class_method">
1706
+
1707
+ .<strong>matter_tick</strong>(time) &#x21d2; <tt>Object</tt>
1708
+
1709
+
1710
+
1711
+
1712
+
1713
+ </h3><div class="docstring">
1714
+ <div class="discussion">
1715
+
1716
+ <p>Call Matter.Runner.tick</p>
1717
+ <ul><li>
1718
+ <p>time: time given by requestAnimationFrame</p>
1719
+ </li></ul>
1720
+
1721
+
1722
+ </div>
1723
+ </div>
1724
+ <div class="tags">
1725
+
1726
+
1727
+ </div><table class="source_code">
1728
+ <tr>
1729
+ <td>
1730
+ <pre class="lines">
1731
+
1732
+
1733
+ 68
1734
+ 69
1735
+ 70
1736
+ 71
1737
+ 72
1738
+ 73
1739
+ 74
1740
+ 75
1741
+ 76
1742
+ 77
1743
+ 78
1744
+ 79
1745
+ 80
1746
+ 81
1747
+ 82
1748
+ 83
1749
+ 84</pre>
1750
+ </td>
1751
+ <td>
1752
+ <pre class="code"><span class="info file"># File 'lib/dxopal/sprite/physics.rb', line 68</span>
1753
+
1754
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_matter_tick'>matter_tick</span><span class='lparen'>(</span><span class='id identifier rubyid_time'>time</span><span class='rparen'>)</span>
1755
+ <span class='backtick'>%x{</span><span class='tstring_content'>
1756
+ Matter.Runner.tick(</span><span class='embexpr_beg'>#{</span><span class='const'><span class='object_link'><a href="" title="DXOpal::Sprite (class)">Sprite</a></span></span><span class='period'>.</span><span class='id identifier rubyid__matter_runner'><span class='object_link'><a href="#_matter_runner-class_method" title="DXOpal::Sprite._matter_runner (method)">_matter_runner</a></span></span><span class='embexpr_end'>}</span><span class='tstring_content'>, </span><span class='embexpr_beg'>#{</span><span class='const'><span class='object_link'><a href="" title="DXOpal::Sprite (class)">Sprite</a></span></span><span class='period'>.</span><span class='id identifier rubyid__matter_engine'><span class='object_link'><a href="#_matter_engine-class_method" title="DXOpal::Sprite._matter_engine (method)">_matter_engine</a></span></span><span class='embexpr_end'>}</span><span class='tstring_content'>, time);
1757
+ Matter.Composite.allBodies(</span><span class='embexpr_beg'>#{</span><span class='const'><span class='object_link'><a href="" title="DXOpal::Sprite (class)">Sprite</a></span></span><span class='period'>.</span><span class='id identifier rubyid__matter_engine'><span class='object_link'><a href="#_matter_engine-class_method" title="DXOpal::Sprite._matter_engine (method)">_matter_engine</a></span></span><span class='embexpr_end'>}</span><span class='tstring_content'>.world).forEach((body) =&gt; {
1758
+ var [type, sprite, info] = </span><span class='embexpr_beg'>#{</span><span class='const'><span class='object_link'><a href="" title="DXOpal::Sprite (class)">Sprite</a></span></span><span class='period'>.</span><span class='id identifier rubyid__matter_sprites'><span class='object_link'><a href="#_matter_sprites-class_method" title="DXOpal::Sprite._matter_sprites (method)">_matter_sprites</a></span></span><span class='lbracket'>[</span><span class='backtick'>`</span><span class='tstring_content'>body.id</span><span class='tstring_end'>`</span></span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
1759
+ switch(type) {
1760
+ case &quot;rectangle&quot;:
1761
+ var [width, height] = info;
1762
+ sprite[&#39;$_move_to_matter_body&#39;](body.position.x, body.position.y);
1763
+ sprite[&#39;$angle=&#39;](body.angle / Math.PI * 180);
1764
+ break;
1765
+ default:
1766
+ `</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>unknown type: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='embexpr_end'>}</span><span class='tstring_content'>`
1767
+ }
1768
+ });
1769
+ </span><span class='tstring_end'>}</span></span>
1770
+ <span class='kw'>end</span></pre>
1771
+ </td>
1772
+ </tr>
1773
+ </table>
1297
1774
  </div>
1298
1775
 
1299
1776
  <div class="method_details ">
@@ -1331,7 +1808,7 @@ not implemented yet; Pull request is welcome)</p>
1331
1808
  17</pre>
1332
1809
  </td>
1333
1810
  <td>
1334
- <pre class="code"><span class="info file"># File 'opal/dxopal/sprite.rb', line 11</span>
1811
+ <pre class="code"><span class="info file"># File 'lib/dxopal/sprite.rb', line 11</span>
1335
1812
 
1336
1813
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_update'>update</span><span class='lparen'>(</span><span class='id identifier rubyid_sprites'>sprites</span><span class='rparen'>)</span>
1337
1814
  <span class='id identifier rubyid_sprites'>sprites</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_sprite'>sprite</span><span class='op'>|</span>
@@ -1388,7 +1865,7 @@ not implemented yet; Pull request is welcome)</p>
1388
1865
  98</pre>
1389
1866
  </td>
1390
1867
  <td>
1391
- <pre class="code"><span class="info file"># File 'opal/dxopal/sprite.rb', line 90</span>
1868
+ <pre class="code"><span class="info file"># File 'lib/dxopal/sprite.rb', line 90</span>
1392
1869
 
1393
1870
  <span class='kw'>def</span> <span class='id identifier rubyid_draw'>draw</span>
1394
1871
  <span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>image not set to Sprite</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>if</span> <span class='ivar'>@image</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
@@ -1422,7 +1899,7 @@ not implemented yet; Pull request is welcome)</p>
1422
1899
  74</pre>
1423
1900
  </td>
1424
1901
  <td>
1425
- <pre class="code"><span class="info file"># File 'opal/dxopal/sprite.rb', line 74</span>
1902
+ <pre class="code"><span class="info file"># File 'lib/dxopal/sprite.rb', line 74</span>
1426
1903
 
1427
1904
  <span class='kw'>def</span> <span class='id identifier rubyid_image'>image</span><span class='semicolon'>;</span> <span class='ivar'>@image</span><span class='semicolon'>;</span> <span class='kw'>end</span></pre>
1428
1905
  </td>
@@ -1457,7 +1934,7 @@ not implemented yet; Pull request is welcome)</p>
1457
1934
  84</pre>
1458
1935
  </td>
1459
1936
  <td>
1460
- <pre class="code"><span class="info file"># File 'opal/dxopal/sprite.rb', line 75</span>
1937
+ <pre class="code"><span class="info file"># File 'lib/dxopal/sprite.rb', line 75</span>
1461
1938
 
1462
1939
  <span class='kw'>def</span> <span class='id identifier rubyid_image='>image=</span><span class='lparen'>(</span><span class='id identifier rubyid_img'>img</span><span class='rparen'>)</span>
1463
1940
  <span class='ivar'>@image</span> <span class='op'>=</span> <span class='id identifier rubyid_img'>img</span>
@@ -1492,7 +1969,7 @@ not implemented yet; Pull request is welcome)</p>
1492
1969
  86</pre>
1493
1970
  </td>
1494
1971
  <td>
1495
- <pre class="code"><span class="info file"># File 'opal/dxopal/sprite.rb', line 86</span>
1972
+ <pre class="code"><span class="info file"># File 'lib/dxopal/sprite.rb', line 86</span>
1496
1973
 
1497
1974
  <span class='kw'>def</span> <span class='id identifier rubyid_vanish'>vanish</span><span class='semicolon'>;</span> <span class='ivar'>@vanished</span> <span class='op'>=</span> <span class='kw'>true</span><span class='semicolon'>;</span> <span class='kw'>end</span></pre>
1498
1975
  </td>
@@ -1540,7 +2017,7 @@ not implemented yet; Pull request is welcome)</p>
1540
2017
  87</pre>
1541
2018
  </td>
1542
2019
  <td>
1543
- <pre class="code"><span class="info file"># File 'opal/dxopal/sprite.rb', line 87</span>
2020
+ <pre class="code"><span class="info file"># File 'lib/dxopal/sprite.rb', line 87</span>
1544
2021
 
1545
2022
  <span class='kw'>def</span> <span class='id identifier rubyid_vanished?'>vanished?</span><span class='semicolon'>;</span> <span class='ivar'>@vanished</span><span class='semicolon'>;</span> <span class='kw'>end</span></pre>
1546
2023
  </td>
@@ -1553,9 +2030,9 @@ not implemented yet; Pull request is welcome)</p>
1553
2030
  </div>
1554
2031
 
1555
2032
  <div id="footer">
1556
- Generated on Sat Sep 29 15:56:48 2018 by
1557
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1558
- 0.9.16 (ruby-2.5.1).
2033
+ Generated on Tue Jul 9 22:42:34 2024 by
2034
+ <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
2035
+ 0.9.36 (ruby-3.2.2).
1559
2036
  </div>
1560
2037
 
1561
2038
  </div>