dxopal 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +25 -0
  3. data/DEVELOPMENT.md +3 -1
  4. data/Gemfile.lock +14 -6
  5. data/README.md +2 -2
  6. data/Rakefile +12 -11
  7. data/TODO.md +2 -2
  8. data/build/dxopal.js +35121 -29081
  9. data/build/dxopal.min.js +1 -1
  10. data/config.ru +6 -5
  11. data/doc/api/DXOpal.html +4 -4
  12. data/doc/api/DXOpal/Font.html +30 -19
  13. data/doc/api/DXOpal/Image.html +417 -242
  14. data/doc/api/DXOpal/Input.html +402 -102
  15. data/doc/api/DXOpal/Input/MouseCodes.html +3 -3
  16. data/doc/api/DXOpal/RemoteResource.html +29 -27
  17. data/doc/api/DXOpal/Sound.html +3 -3
  18. data/doc/api/DXOpal/SoundEffect.html +14 -10
  19. data/doc/api/DXOpal/SoundEffect/WaveTypes.html +3 -3
  20. data/doc/api/DXOpal/Sprite.html +3 -3
  21. data/doc/api/DXOpal/Window.html +238 -132
  22. data/doc/api/_index.html +4 -7
  23. data/doc/api/css/style.css +7 -0
  24. data/doc/api/file.README.html +6 -36
  25. data/doc/api/file_list.html +0 -5
  26. data/doc/api/frames.html +1 -1
  27. data/doc/api/index.html +6 -36
  28. data/doc/api/method_list.html +113 -57
  29. data/doc/api/top-level-namespace.html +3 -3
  30. data/doc/en/index.html +12 -0
  31. data/doc/ja/index.html +9 -0
  32. data/dxopal.gemspec +3 -2
  33. data/exe/dxopal +4 -2
  34. data/index.html +2 -0
  35. data/opal/dxopal.rb +42 -0
  36. data/opal/dxopal/font.rb +2 -0
  37. data/opal/dxopal/image.rb +30 -3
  38. data/opal/dxopal/input/key_codes.rb +0 -3
  39. data/opal/dxopal/remote_resource.rb +2 -0
  40. data/opal/dxopal/sound_effect.rb +3 -0
  41. data/opal/dxopal/sprite/collision_check.rb +27 -7
  42. data/opal/dxopal/sprite/collision_checker.rb +2 -0
  43. data/opal/dxopal/sprite/physics.rb +6 -2
  44. data/opal/dxopal/version.rb +1 -1
  45. data/opal/dxopal/window.rb +13 -4
  46. data/template/index.html +4 -1
  47. metadata +20 -6
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Module: DXOpal::Input
8
8
 
9
- &mdash; Documentation by YARD 0.9.9
9
+ &mdash; Documentation by YARD 0.9.12
10
10
 
11
11
  </title>
12
12
 
@@ -94,6 +94,55 @@
94
94
 
95
95
  </p>
96
96
 
97
+ <h2>Constant Summary</h2>
98
+ <dl class="constants">
99
+
100
+ <dt id="ON_KEYDOWN_-constant" class="">ON_KEYDOWN_ =
101
+ <div class="docstring">
102
+ <div class="discussion">
103
+
104
+ <p>(private) JS keydown event handler</p>
105
+
106
+
107
+ </div>
108
+ </div>
109
+ <div class="tags">
110
+
111
+
112
+ </div>
113
+ </dt>
114
+ <dd><pre class="code"><span class='backtick'>%x{</span><span class='tstring_content'>
115
+ function(ev){
116
+ </span><span class='embexpr_beg'>#{</span><span class='const'>Input</span><span class='period'>.</span><span class='id identifier rubyid__pressing_keys'><span class='object_link'><a href="#_pressing_keys-class_method" title="DXOpal::Input._pressing_keys (method)">_pressing_keys</a></span></span><span class='embexpr_end'>}</span><span class='tstring_content'>[ev.keyCode] = </span><span class='embexpr_beg'>#{</span><span class='cvar'>@@tick</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
117
+ ev.preventDefault();
118
+ ev.stopPropagation();
119
+ }
120
+ </span><span class='tstring_end'>}</span></span></pre></dd>
121
+
122
+ <dt id="ON_KEYUP_-constant" class="">ON_KEYUP_ =
123
+ <div class="docstring">
124
+ <div class="discussion">
125
+
126
+ <p>(private) JS keyup event handler</p>
127
+
128
+
129
+ </div>
130
+ </div>
131
+ <div class="tags">
132
+
133
+
134
+ </div>
135
+ </dt>
136
+ <dd><pre class="code"><span class='backtick'>%x{</span><span class='tstring_content'>
137
+ function(ev){
138
+ </span><span class='embexpr_beg'>#{</span><span class='const'>Input</span><span class='period'>.</span><span class='id identifier rubyid__pressing_keys'><span class='object_link'><a href="#_pressing_keys-class_method" title="DXOpal::Input._pressing_keys (method)">_pressing_keys</a></span></span><span class='embexpr_end'>}</span><span class='tstring_content'>[ev.keyCode] = -</span><span class='embexpr_beg'>#{</span><span class='cvar'>@@tick</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
139
+ ev.preventDefault();
140
+ ev.stopPropagation();
141
+ }
142
+ </span><span class='tstring_end'>}</span></span></pre></dd>
143
+
144
+ </dl>
145
+
97
146
 
98
147
 
99
148
 
@@ -129,6 +178,30 @@
129
178
  <p>Internal setup for Input class.</p>
130
179
  </div></span>
131
180
 
181
+ </li>
182
+
183
+
184
+ <li class="public ">
185
+ <span class="summary_signature">
186
+
187
+ <a href="#_init_mouse_events-class_method" title="_init_mouse_events (class method)">.<strong>_init_mouse_events</strong> &#x21d2; Object </a>
188
+
189
+
190
+
191
+ </span>
192
+
193
+
194
+
195
+
196
+
197
+
198
+
199
+
200
+
201
+ <span class="summary_desc"><div class='inline'>
202
+ <p>(internal) initialize mouse events.</p>
203
+ </div></span>
204
+
132
205
  </li>
133
206
 
134
207
 
@@ -153,6 +226,28 @@
153
226
  <p>Called on every frame from Window.</p>
154
227
  </div></span>
155
228
 
229
+ </li>
230
+
231
+
232
+ <li class="public ">
233
+ <span class="summary_signature">
234
+
235
+ <a href="#_pressing_keys-class_method" title="_pressing_keys (class method)">.<strong>_pressing_keys</strong> &#x21d2; Object </a>
236
+
237
+
238
+
239
+ </span>
240
+
241
+
242
+
243
+
244
+
245
+
246
+
247
+
248
+
249
+ <span class="summary_desc"><div class='inline'></div></span>
250
+
156
251
  </li>
157
252
 
158
253
 
@@ -225,6 +320,54 @@
225
320
  <p>Return true if the key is just released.</p>
226
321
  </div></span>
227
322
 
323
+ </li>
324
+
325
+
326
+ <li class="public ">
327
+ <span class="summary_signature">
328
+
329
+ <a href="#keyevent_target-class_method" title="keyevent_target (class method)">.<strong>keyevent_target</strong> &#x21d2; Object </a>
330
+
331
+
332
+
333
+ </span>
334
+
335
+
336
+
337
+
338
+
339
+
340
+
341
+
342
+
343
+ <span class="summary_desc"><div class='inline'>
344
+ <p>Return DOM element set by `keyevent_target=`.</p>
345
+ </div></span>
346
+
347
+ </li>
348
+
349
+
350
+ <li class="public ">
351
+ <span class="summary_signature">
352
+
353
+ <a href="#keyevent_target=-class_method" title="keyevent_target= (class method)">.<strong>keyevent_target=</strong>(target) &#x21d2; Object </a>
354
+
355
+
356
+
357
+ </span>
358
+
359
+
360
+
361
+
362
+
363
+
364
+
365
+
366
+
367
+ <span class="summary_desc"><div class='inline'>
368
+ <p>Set DOM element to receive keydown/keyup event.</p>
369
+ </div></span>
370
+
228
371
  </li>
229
372
 
230
373
 
@@ -434,8 +577,6 @@ canvas.</p>
434
577
  <pre class="lines">
435
578
 
436
579
 
437
- 13
438
- 14
439
580
  15
440
581
  16
441
582
  17
@@ -448,62 +589,87 @@ canvas.</p>
448
589
  24
449
590
  25
450
591
  26
451
- 27
452
- 28
453
- 29
454
- 30
455
- 31
456
- 32
457
- 33
458
- 34
459
- 35
460
- 36
461
- 37
462
- 38
463
- 39
464
- 40
465
- 41
466
- 42
467
- 43
468
- 44
469
- 45
470
- 46
471
- 47
472
- 48
473
- 49
474
- 50
475
- 51
476
- 52
477
- 53
478
- 54
479
- 55
480
- 56
481
- 57</pre>
592
+ 27</pre>
482
593
  </td>
483
594
  <td>
484
- <pre class="code"><span class="info file"># File 'opal/dxopal/input.rb', line 13</span>
595
+ <pre class="code"><span class="info file"># File 'opal/dxopal/input.rb', line 15</span>
485
596
 
486
597
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid__init'>_init</span><span class='lparen'>(</span><span class='id identifier rubyid_canvas'>canvas</span><span class='rparen'>)</span>
487
598
  <span class='cvar'>@@tick</span> <span class='op'>=</span> <span class='int'>0</span>
488
- <span class='cvar'>@@pressing_keys</span> <span class='op'>=</span> <span class='id identifier rubyid_pressing_keys'>pressing_keys</span> <span class='op'>=</span> <span class='backtick'>`</span><span class='tstring_content'>new Object()</span><span class='tstring_end'>`</span></span>
599
+ <span class='cvar'>@@pressing_keys</span> <span class='op'>=</span> <span class='backtick'>`</span><span class='tstring_content'>new Object()</span><span class='tstring_end'>`</span></span>
489
600
  <span class='cvar'>@@mouse_info</span> <span class='op'>=</span> <span class='backtick'>`</span><span class='tstring_content'>{x: 0, y: 0}</span><span class='tstring_end'>`</span></span>
490
- <span class='cvar'>@@pressing_mouse_buttons</span> <span class='op'>=</span> <span class='id identifier rubyid_pressing_mouse_buttons'>pressing_mouse_buttons</span> <span class='op'>=</span> <span class='backtick'>`</span><span class='tstring_content'>new Object()</span><span class='tstring_end'>`</span></span>
601
+ <span class='cvar'>@@pressing_mouse_buttons</span> <span class='op'>=</span> <span class='backtick'>`</span><span class='tstring_content'>new Object()</span><span class='tstring_end'>`</span></span>
491
602
 
492
603
  <span class='id identifier rubyid_rect'>rect</span> <span class='op'>=</span> <span class='backtick'>`</span><span class='tstring_content'>canvas.getBoundingClientRect()</span><span class='tstring_end'>`</span></span>
493
604
  <span class='cvar'>@@canvas_x</span> <span class='op'>=</span> <span class='backtick'>`</span><span class='tstring_content'>rect.left + window.pageXOffset</span><span class='tstring_end'>`</span></span>
494
605
  <span class='cvar'>@@canvas_y</span> <span class='op'>=</span> <span class='backtick'>`</span><span class='tstring_content'>rect.top + window.pageYOffset</span><span class='tstring_end'>`</span></span>
495
606
 
607
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid__init_mouse_events'>_init_mouse_events</span>
608
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_keyevent_target'>keyevent_target</span> <span class='op'>=</span> <span class='backtick'>`</span><span class='tstring_content'>window</span><span class='tstring_end'>`</span></span> <span class='kw'>unless</span> <span class='const'><span class='object_link'><a href="" title="DXOpal::Input (module)">Input</a></span></span><span class='period'>.</span><span class='id identifier rubyid_keyevent_target'><span class='object_link'><a href="#keyevent_target-class_method" title="DXOpal::Input.keyevent_target (method)">keyevent_target</a></span></span>
609
+ <span class='kw'>end</span></pre>
610
+ </td>
611
+ </tr>
612
+ </table>
613
+ </div>
614
+
615
+ <div class="method_details ">
616
+ <h3 class="signature " id="_init_mouse_events-class_method">
617
+
618
+ .<strong>_init_mouse_events</strong> &#x21d2; <tt>Object</tt>
619
+
620
+
621
+
622
+
623
+
624
+ </h3><div class="docstring">
625
+ <div class="discussion">
626
+
627
+ <p>(internal) initialize mouse events</p>
628
+
629
+
630
+ </div>
631
+ </div>
632
+ <div class="tags">
633
+
634
+
635
+ </div><table class="source_code">
636
+ <tr>
637
+ <td>
638
+ <pre class="lines">
639
+
640
+
641
+ 115
642
+ 116
643
+ 117
644
+ 118
645
+ 119
646
+ 120
647
+ 121
648
+ 122
649
+ 123
650
+ 124
651
+ 125
652
+ 126
653
+ 127
654
+ 128
655
+ 129
656
+ 130
657
+ 131
658
+ 132
659
+ 133
660
+ 134
661
+ 135
662
+ 136
663
+ 137
664
+ 138
665
+ 139
666
+ 140</pre>
667
+ </td>
668
+ <td>
669
+ <pre class="code"><span class="info file"># File 'opal/dxopal/input.rb', line 115</span>
670
+
671
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid__init_mouse_events'>_init_mouse_events</span>
496
672
  <span class='backtick'>%x{</span><span class='tstring_content'>
497
- document.addEventListener(&#39;keydown&#39;, function(ev){
498
- pressing_keys[ev.keyCode] = </span><span class='embexpr_beg'>#{</span><span class='cvar'>@@tick</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
499
- ev.preventDefault();
500
- ev.stopPropagation();
501
- });
502
- document.addEventListener(&#39;keyup&#39;, function(ev){
503
- pressing_keys[ev.keyCode] = -</span><span class='embexpr_beg'>#{</span><span class='cvar'>@@tick</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
504
- ev.preventDefault();
505
- ev.stopPropagation();
506
- });
507
673
  document.addEventListener(&#39;mousemove&#39;, function(ev){
508
674
  </span><span class='embexpr_beg'>#{</span><span class='cvar'>@@mouse_info</span><span class='embexpr_end'>}</span><span class='tstring_content'>.x = ev.pageX - </span><span class='embexpr_beg'>#{</span><span class='cvar'>@@canvas_x</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
509
675
  </span><span class='embexpr_beg'>#{</span><span class='cvar'>@@mouse_info</span><span class='embexpr_end'>}</span><span class='tstring_content'>.y = ev.pageY - </span><span class='embexpr_beg'>#{</span><span class='cvar'>@@canvas_y</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
@@ -513,7 +679,7 @@ canvas.</p>
513
679
  </span><span class='embexpr_beg'>#{</span><span class='cvar'>@@mouse_info</span><span class='embexpr_end'>}</span><span class='tstring_content'>.y = ev.pageY - </span><span class='embexpr_beg'>#{</span><span class='cvar'>@@canvas_y</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
514
680
  for (var k=1; k&lt;=16; k&lt;&lt;=1) {
515
681
  if (ev.buttons &amp; k) {
516
- pressing_mouse_buttons[k] = </span><span class='embexpr_beg'>#{</span><span class='cvar'>@@tick</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
682
+ </span><span class='embexpr_beg'>#{</span><span class='cvar'>@@pressing_mouse_buttons</span><span class='embexpr_end'>}</span><span class='tstring_content'>[k] = </span><span class='embexpr_beg'>#{</span><span class='cvar'>@@tick</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
517
683
  }
518
684
  }
519
685
  });
@@ -521,8 +687,8 @@ canvas.</p>
521
687
  </span><span class='embexpr_beg'>#{</span><span class='cvar'>@@mouse_info</span><span class='embexpr_end'>}</span><span class='tstring_content'>.x = ev.pageX - </span><span class='embexpr_beg'>#{</span><span class='cvar'>@@canvas_x</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
522
688
  </span><span class='embexpr_beg'>#{</span><span class='cvar'>@@mouse_info</span><span class='embexpr_end'>}</span><span class='tstring_content'>.y = ev.pageY - </span><span class='embexpr_beg'>#{</span><span class='cvar'>@@canvas_y</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
523
689
  for (var k=1; k&lt;=16; k&lt;&lt;=1) {
524
- if ((ev.buttons &amp; k) == 0 &amp;&amp; pressing_mouse_buttons[k]) {
525
- pressing_mouse_buttons[k] = -</span><span class='embexpr_beg'>#{</span><span class='cvar'>@@tick</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
690
+ if ((ev.buttons &amp; k) == 0 &amp;&amp; </span><span class='embexpr_beg'>#{</span><span class='cvar'>@@pressing_mouse_buttons</span><span class='embexpr_end'>}</span><span class='tstring_content'>[k]) {
691
+ </span><span class='embexpr_beg'>#{</span><span class='cvar'>@@pressing_mouse_buttons</span><span class='embexpr_end'>}</span><span class='tstring_content'>[k] = -</span><span class='embexpr_beg'>#{</span><span class='cvar'>@@tick</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
526
692
  }
527
693
  }
528
694
  });
@@ -559,12 +725,12 @@ canvas.</p>
559
725
  <pre class="lines">
560
726
 
561
727
 
562
- 60
563
- 61
564
- 62</pre>
728
+ 30
729
+ 31
730
+ 32</pre>
565
731
  </td>
566
732
  <td>
567
- <pre class="code"><span class="info file"># File 'opal/dxopal/input.rb', line 60</span>
733
+ <pre class="code"><span class="info file"># File 'opal/dxopal/input.rb', line 30</span>
568
734
 
569
735
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid__on_tick'>_on_tick</span>
570
736
  <span class='cvar'>@@tick</span> <span class='op'>+=</span> <span class='int'>1</span>
@@ -572,6 +738,32 @@ canvas.</p>
572
738
  </td>
573
739
  </tr>
574
740
  </table>
741
+ </div>
742
+
743
+ <div class="method_details ">
744
+ <h3 class="signature " id="_pressing_keys-class_method">
745
+
746
+ .<strong>_pressing_keys</strong> &#x21d2; <tt>Object</tt>
747
+
748
+
749
+
750
+
751
+
752
+ </h3><table class="source_code">
753
+ <tr>
754
+ <td>
755
+ <pre class="lines">
756
+
757
+
758
+ 12</pre>
759
+ </td>
760
+ <td>
761
+ <pre class="code"><span class="info file"># File 'opal/dxopal/input.rb', line 12</span>
762
+
763
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid__pressing_keys'>_pressing_keys</span><span class='semicolon'>;</span> <span class='cvar'>@@pressing_keys</span><span class='semicolon'>;</span> <span class='kw'>end</span></pre>
764
+ </td>
765
+ </tr>
766
+ </table>
575
767
  </div>
576
768
 
577
769
  <div class="method_details ">
@@ -613,12 +805,12 @@ canvas.</p>
613
805
  <pre class="lines">
614
806
 
615
807
 
616
- 81
617
- 82
618
- 83</pre>
808
+ 55
809
+ 56
810
+ 57</pre>
619
811
  </td>
620
812
  <td>
621
- <pre class="code"><span class="info file"># File 'opal/dxopal/input.rb', line 81</span>
813
+ <pre class="code"><span class="info file"># File 'opal/dxopal/input.rb', line 55</span>
622
814
 
623
815
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_key_down?'>key_down?</span><span class='lparen'>(</span><span class='id identifier rubyid_code'>code</span><span class='rparen'>)</span>
624
816
  <span class='kw'>return</span> <span class='backtick'>`</span><span class='embexpr_beg'>#{</span><span class='cvar'>@@pressing_keys</span><span class='embexpr_end'>}</span><span class='tstring_content'>[code] &gt; 0</span><span class='tstring_end'>`</span></span>
@@ -667,12 +859,12 @@ canvas.</p>
667
859
  <pre class="lines">
668
860
 
669
861
 
670
- 86
671
- 87
672
- 88</pre>
862
+ 60
863
+ 61
864
+ 62</pre>
673
865
  </td>
674
866
  <td>
675
- <pre class="code"><span class="info file"># File 'opal/dxopal/input.rb', line 86</span>
867
+ <pre class="code"><span class="info file"># File 'opal/dxopal/input.rb', line 60</span>
676
868
 
677
869
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_key_push?'>key_push?</span><span class='lparen'>(</span><span class='id identifier rubyid_code'>code</span><span class='rparen'>)</span>
678
870
  <span class='kw'>return</span> <span class='backtick'>`</span><span class='embexpr_beg'>#{</span><span class='cvar'>@@pressing_keys</span><span class='embexpr_end'>}</span><span class='tstring_content'>[code] == </span><span class='embexpr_beg'>#{</span><span class='cvar'>@@tick</span><span class='embexpr_end'>}</span><span class='tstring_content'>-1</span><span class='tstring_end'>`</span></span>
@@ -721,12 +913,12 @@ canvas.</p>
721
913
  <pre class="lines">
722
914
 
723
915
 
724
- 91
725
- 92
726
- 93</pre>
916
+ 65
917
+ 66
918
+ 67</pre>
727
919
  </td>
728
920
  <td>
729
- <pre class="code"><span class="info file"># File 'opal/dxopal/input.rb', line 91</span>
921
+ <pre class="code"><span class="info file"># File 'opal/dxopal/input.rb', line 65</span>
730
922
 
731
923
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_key_release?'>key_release?</span><span class='lparen'>(</span><span class='id identifier rubyid_code'>code</span><span class='rparen'>)</span>
732
924
  <span class='kw'>return</span> <span class='backtick'>`</span><span class='embexpr_beg'>#{</span><span class='cvar'>@@pressing_keys</span><span class='embexpr_end'>}</span><span class='tstring_content'>[code] == -(</span><span class='embexpr_beg'>#{</span><span class='cvar'>@@tick</span><span class='embexpr_end'>}</span><span class='tstring_content'>-1)</span><span class='tstring_end'>`</span></span>
@@ -734,6 +926,114 @@ canvas.</p>
734
926
  </td>
735
927
  </tr>
736
928
  </table>
929
+ </div>
930
+
931
+ <div class="method_details ">
932
+ <h3 class="signature " id="keyevent_target-class_method">
933
+
934
+ .<strong>keyevent_target</strong> &#x21d2; <tt>Object</tt>
935
+
936
+
937
+
938
+
939
+
940
+ </h3><div class="docstring">
941
+ <div class="discussion">
942
+
943
+ <p>Return DOM element set by `keyevent_target=`</p>
944
+
945
+
946
+ </div>
947
+ </div>
948
+ <div class="tags">
949
+
950
+
951
+ </div><table class="source_code">
952
+ <tr>
953
+ <td>
954
+ <pre class="lines">
955
+
956
+
957
+ 108</pre>
958
+ </td>
959
+ <td>
960
+ <pre class="code"><span class="info file"># File 'opal/dxopal/input.rb', line 108</span>
961
+
962
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_keyevent_target'>keyevent_target</span><span class='semicolon'>;</span> <span class='cvar'>@@keyevent_target</span><span class='semicolon'>;</span> <span class='kw'>end</span></pre>
963
+ </td>
964
+ </tr>
965
+ </table>
966
+ </div>
967
+
968
+ <div class="method_details ">
969
+ <h3 class="signature " id="keyevent_target=-class_method">
970
+
971
+ .<strong>keyevent_target=</strong>(target) &#x21d2; <tt>Object</tt>
972
+
973
+
974
+
975
+
976
+
977
+ </h3><div class="docstring">
978
+ <div class="discussion">
979
+
980
+ <p>Set DOM element to receive keydown/keyup event</p>
981
+
982
+ <p>By default, `window` is set to this (i.e. all key events are stolen by
983
+ DXOpal.) If canvas element is set to this, only key events happend on
984
+ canvas are processed by DXOpal.</p>
985
+
986
+
987
+ </div>
988
+ </div>
989
+ <div class="tags">
990
+
991
+
992
+ </div><table class="source_code">
993
+ <tr>
994
+ <td>
995
+ <pre class="lines">
996
+
997
+
998
+ 90
999
+ 91
1000
+ 92
1001
+ 93
1002
+ 94
1003
+ 95
1004
+ 96
1005
+ 97
1006
+ 98
1007
+ 99
1008
+ 100
1009
+ 101
1010
+ 102
1011
+ 103
1012
+ 104
1013
+ 105</pre>
1014
+ </td>
1015
+ <td>
1016
+ <pre class="code"><span class="info file"># File 'opal/dxopal/input.rb', line 90</span>
1017
+
1018
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_keyevent_target='>keyevent_target=</span><span class='lparen'>(</span><span class='id identifier rubyid_target'>target</span><span class='rparen'>)</span>
1019
+ <span class='kw'>if</span> <span class='cvar'>@@keyevent_target</span>
1020
+ <span class='backtick'>%x{</span><span class='tstring_content'>
1021
+ </span><span class='embexpr_beg'>#{</span><span class='cvar'>@@keyevent_target</span><span class='embexpr_end'>}</span><span class='tstring_content'>.removeEventListener(&#39;keydown&#39;, </span><span class='embexpr_beg'>#{</span><span class='const'><span class='object_link'><a href="#ON_KEYDOWN_-constant" title="DXOpal::Input::ON_KEYDOWN_ (constant)">ON_KEYDOWN_</a></span></span><span class='embexpr_end'>}</span><span class='tstring_content'>);
1022
+ </span><span class='embexpr_beg'>#{</span><span class='cvar'>@@keyevent_target</span><span class='embexpr_end'>}</span><span class='tstring_content'>.removeEventListener(&#39;keyup&#39;, </span><span class='embexpr_beg'>#{</span><span class='const'><span class='object_link'><a href="#ON_KEYUP_-constant" title="DXOpal::Input::ON_KEYUP_ (constant)">ON_KEYUP_</a></span></span><span class='embexpr_end'>}</span><span class='tstring_content'>);
1023
+ </span><span class='tstring_end'>}</span></span>
1024
+ <span class='kw'>end</span>
1025
+ <span class='cvar'>@@keyevent_target</span> <span class='op'>=</span> <span class='id identifier rubyid_target'>target</span>
1026
+ <span class='backtick'>%x{</span><span class='tstring_content'>
1027
+ if (</span><span class='embexpr_beg'>#{</span><span class='cvar'>@@keyevent_target</span><span class='embexpr_end'>}</span><span class='tstring_content'>.tagName == &quot;CANVAS&quot;) {
1028
+ </span><span class='embexpr_beg'>#{</span><span class='cvar'>@@keyevent_target</span><span class='embexpr_end'>}</span><span class='tstring_content'>.setAttribute(&#39;tabindex&#39;, 0);
1029
+ }
1030
+ </span><span class='embexpr_beg'>#{</span><span class='cvar'>@@keyevent_target</span><span class='embexpr_end'>}</span><span class='tstring_content'>.addEventListener(&#39;keydown&#39;, </span><span class='embexpr_beg'>#{</span><span class='const'><span class='object_link'><a href="#ON_KEYDOWN_-constant" title="DXOpal::Input::ON_KEYDOWN_ (constant)">ON_KEYDOWN_</a></span></span><span class='embexpr_end'>}</span><span class='tstring_content'>);
1031
+ </span><span class='embexpr_beg'>#{</span><span class='cvar'>@@keyevent_target</span><span class='embexpr_end'>}</span><span class='tstring_content'>.addEventListener(&#39;keyup&#39;, </span><span class='embexpr_beg'>#{</span><span class='const'><span class='object_link'><a href="#ON_KEYUP_-constant" title="DXOpal::Input::ON_KEYUP_ (constant)">ON_KEYUP_</a></span></span><span class='embexpr_end'>}</span><span class='tstring_content'>);
1032
+ </span><span class='tstring_end'>}</span></span>
1033
+ <span class='kw'>end</span></pre>
1034
+ </td>
1035
+ </tr>
1036
+ </table>
737
1037
  </div>
738
1038
 
739
1039
  <div class="method_details ">
@@ -775,12 +1075,12 @@ canvas.</p>
775
1075
  <pre class="lines">
776
1076
 
777
1077
 
778
- 109
779
- 110
780
- 111</pre>
1078
+ 156
1079
+ 157
1080
+ 158</pre>
781
1081
  </td>
782
1082
  <td>
783
- <pre class="code"><span class="info file"># File 'opal/dxopal/input.rb', line 109</span>
1083
+ <pre class="code"><span class="info file"># File 'opal/dxopal/input.rb', line 156</span>
784
1084
 
785
1085
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_mouse_down?'>mouse_down?</span><span class='lparen'>(</span><span class='id identifier rubyid_mouse_code'>mouse_code</span><span class='rparen'>)</span>
786
1086
  <span class='kw'>return</span> <span class='backtick'>`</span><span class='embexpr_beg'>#{</span><span class='cvar'>@@pressing_mouse_buttons</span><span class='embexpr_end'>}</span><span class='tstring_content'>[mouse_code] &gt; 0</span><span class='tstring_end'>`</span></span>
@@ -829,12 +1129,12 @@ canvas.</p>
829
1129
  <pre class="lines">
830
1130
 
831
1131
 
832
- 114
833
- 115
834
- 116</pre>
1132
+ 161
1133
+ 162
1134
+ 163</pre>
835
1135
  </td>
836
1136
  <td>
837
- <pre class="code"><span class="info file"># File 'opal/dxopal/input.rb', line 114</span>
1137
+ <pre class="code"><span class="info file"># File 'opal/dxopal/input.rb', line 161</span>
838
1138
 
839
1139
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_mouse_push?'>mouse_push?</span><span class='lparen'>(</span><span class='id identifier rubyid_mouse_code'>mouse_code</span><span class='rparen'>)</span>
840
1140
  <span class='kw'>return</span> <span class='backtick'>`</span><span class='embexpr_beg'>#{</span><span class='cvar'>@@pressing_mouse_buttons</span><span class='embexpr_end'>}</span><span class='tstring_content'>[mouse_code] == -(</span><span class='embexpr_beg'>#{</span><span class='cvar'>@@tick</span><span class='embexpr_end'>}</span><span class='tstring_content'>-1)</span><span class='tstring_end'>`</span></span>
@@ -883,12 +1183,12 @@ canvas.</p>
883
1183
  <pre class="lines">
884
1184
 
885
1185
 
886
- 119
887
- 120
888
- 121</pre>
1186
+ 166
1187
+ 167
1188
+ 168</pre>
889
1189
  </td>
890
1190
  <td>
891
- <pre class="code"><span class="info file"># File 'opal/dxopal/input.rb', line 119</span>
1191
+ <pre class="code"><span class="info file"># File 'opal/dxopal/input.rb', line 166</span>
892
1192
 
893
1193
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_mouse_release?'>mouse_release?</span><span class='lparen'>(</span><span class='id identifier rubyid_mouse_code'>mouse_code</span><span class='rparen'>)</span>
894
1194
  <span class='kw'>return</span> <span class='backtick'>`</span><span class='embexpr_beg'>#{</span><span class='cvar'>@@pressing_mouse_buttons</span><span class='embexpr_end'>}</span><span class='tstring_content'>[mouse_code] == -(</span><span class='embexpr_beg'>#{</span><span class='cvar'>@@tick</span><span class='embexpr_end'>}</span><span class='tstring_content'>-1)</span><span class='tstring_end'>`</span></span>
@@ -928,12 +1228,12 @@ canvas.</p>
928
1228
  <pre class="lines">
929
1229
 
930
1230
 
931
- 97
932
- 98
933
- 99</pre>
1231
+ 144
1232
+ 145
1233
+ 146</pre>
934
1234
  </td>
935
1235
  <td>
936
- <pre class="code"><span class="info file"># File 'opal/dxopal/input.rb', line 97</span>
1236
+ <pre class="code"><span class="info file"># File 'opal/dxopal/input.rb', line 144</span>
937
1237
 
938
1238
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_mouse_x'>mouse_x</span>
939
1239
  <span class='kw'>return</span> <span class='backtick'>`</span><span class='embexpr_beg'>#{</span><span class='cvar'>@@mouse_info</span><span class='embexpr_end'>}</span><span class='tstring_content'>.x</span><span class='tstring_end'>`</span></span>
@@ -962,12 +1262,12 @@ canvas.</p>
962
1262
  <pre class="lines">
963
1263
 
964
1264
 
965
- 100
966
- 101
967
- 102</pre>
1265
+ 147
1266
+ 148
1267
+ 149</pre>
968
1268
  </td>
969
1269
  <td>
970
- <pre class="code"><span class="info file"># File 'opal/dxopal/input.rb', line 100</span>
1270
+ <pre class="code"><span class="info file"># File 'opal/dxopal/input.rb', line 147</span>
971
1271
 
972
1272
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_mouse_y'>mouse_y</span>
973
1273
  <span class='kw'>return</span> <span class='backtick'>`</span><span class='embexpr_beg'>#{</span><span class='cvar'>@@mouse_info</span><span class='embexpr_end'>}</span><span class='tstring_content'>.y</span><span class='tstring_end'>`</span></span>
@@ -1003,15 +1303,15 @@ canvas.</p>
1003
1303
  <pre class="lines">
1004
1304
 
1005
1305
 
1006
- 65
1007
- 66
1008
- 67
1009
- 68
1010
- 69
1011
- 70</pre>
1306
+ 35
1307
+ 36
1308
+ 37
1309
+ 38
1310
+ 39
1311
+ 40</pre>
1012
1312
  </td>
1013
1313
  <td>
1014
- <pre class="code"><span class="info file"># File 'opal/dxopal/input.rb', line 65</span>
1314
+ <pre class="code"><span class="info file"># File 'opal/dxopal/input.rb', line 35</span>
1015
1315
 
1016
1316
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_x'>x</span><span class='lparen'>(</span><span class='id identifier rubyid_pad_number'>pad_number</span><span class='op'>=</span><span class='int'>0</span><span class='rparen'>)</span>
1017
1317
  <span class='id identifier rubyid_ret'>ret</span> <span class='op'>=</span> <span class='int'>0</span>
@@ -1050,15 +1350,15 @@ canvas.</p>
1050
1350
  <pre class="lines">
1051
1351
 
1052
1352
 
1053
- 73
1054
- 74
1055
- 75
1056
- 76
1057
- 77
1058
- 78</pre>
1353
+ 43
1354
+ 44
1355
+ 45
1356
+ 46
1357
+ 47
1358
+ 48</pre>
1059
1359
  </td>
1060
1360
  <td>
1061
- <pre class="code"><span class="info file"># File 'opal/dxopal/input.rb', line 73</span>
1361
+ <pre class="code"><span class="info file"># File 'opal/dxopal/input.rb', line 43</span>
1062
1362
 
1063
1363
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_y'>y</span><span class='lparen'>(</span><span class='id identifier rubyid_pad_number'>pad_number</span><span class='op'>=</span><span class='int'>0</span><span class='rparen'>)</span>
1064
1364
  <span class='id identifier rubyid_ret'>ret</span> <span class='op'>=</span> <span class='int'>0</span>
@@ -1076,9 +1376,9 @@ canvas.</p>
1076
1376
  </div>
1077
1377
 
1078
1378
  <div id="footer">
1079
- Generated on Tue Oct 17 13:56:27 2017 by
1379
+ Generated on Mon Feb 5 16:56:41 2018 by
1080
1380
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1081
- 0.9.9 (ruby-2.4.2).
1381
+ 0.9.12 (ruby-2.4.2).
1082
1382
  </div>
1083
1383
 
1084
1384
  </div>