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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/DEVELOPMENT.md +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +23 -25
- data/README.md +7 -3
- data/Rakefile +8 -15
- data/build/dxopal.js +57670 -40007
- data/build/dxopal.min.js +1 -1
- data/config.ru +1 -1
- data/doc/api/DXOpal/Constants/Colors.html +172 -0
- data/doc/api/DXOpal/Constants.html +115 -0
- data/doc/api/DXOpal/Font.html +72 -18
- data/doc/api/DXOpal/Image.html +902 -409
- data/doc/api/DXOpal/Input/KeyCodes.html +986 -0
- data/doc/api/DXOpal/Input/MouseCodes.html +8 -8
- data/doc/api/DXOpal/Input/Touch.html +834 -0
- data/doc/api/DXOpal/Input.html +833 -104
- data/doc/api/DXOpal/RemoteResource.html +170 -41
- data/doc/api/DXOpal/Sound.html +33 -27
- data/doc/api/DXOpal/SoundEffect/WaveTypes.html +8 -8
- data/doc/api/DXOpal/SoundEffect.html +13 -15
- data/doc/api/DXOpal/Sprite/CollisionArea/Base.html +649 -0
- data/doc/api/DXOpal/Sprite/CollisionArea/Circle.html +656 -0
- data/doc/api/DXOpal/Sprite/CollisionArea/Point.html +448 -0
- data/doc/api/DXOpal/Sprite/CollisionArea/Rect.html +549 -0
- data/doc/api/DXOpal/Sprite/CollisionArea/Triangle.html +423 -0
- data/doc/api/DXOpal/Sprite/CollisionArea.html +126 -0
- data/doc/api/DXOpal/Sprite/CollisionCheck/ClassMethods.html +268 -0
- data/doc/api/DXOpal/Sprite/CollisionCheck.html +926 -0
- data/doc/api/DXOpal/Sprite/Physics.html +426 -0
- data/doc/api/DXOpal/Sprite.html +522 -45
- data/doc/api/DXOpal/Window.html +245 -156
- data/doc/api/DXOpal.html +11 -11
- data/doc/api/Kernel.html +131 -0
- data/doc/api/_index.html +277 -5
- data/doc/api/class_list.html +1 -1
- data/doc/api/css/style.css +1 -0
- data/doc/api/file.README.html +23 -22
- data/doc/api/frames.html +10 -5
- data/doc/api/index.html +23 -22
- data/doc/api/method_list.html +1608 -0
- data/doc/api/top-level-namespace.html +155 -4
- data/lib/dxopal/input.rb +9 -4
- data/lib/dxopal/remote_resource.rb +33 -1
- data/lib/dxopal/sound.rb +5 -2
- data/lib/dxopal/version.rb +1 -1
- data/lib/dxopal/window.rb +6 -3
- data/lib/dxopal.rb +1 -0
- metadata +21 -8
@@ -0,0 +1,426 @@
|
|
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
|
+
Module: DXOpal::Sprite::Physics
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.36
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../../css/style.css" type="text/css" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../../css/common.css" type="text/css" />
|
16
|
+
|
17
|
+
<script type="text/javascript">
|
18
|
+
pathId = "DXOpal::Sprite::Physics";
|
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 (P)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../../DXOpal.html" title="DXOpal (module)">DXOpal</a></span></span> » <span class='title'><span class='object_link'><a href="../Sprite.html" title="DXOpal::Sprite (class)">Sprite</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">Physics</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>Module: DXOpal::Sprite::Physics
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
<dl>
|
78
|
+
<dt>Included in:</dt>
|
79
|
+
<dd><span class='object_link'><a href="../Sprite.html" title="DXOpal::Sprite (class)">DXOpal::Sprite</a></span></dd>
|
80
|
+
</dl>
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
<dl>
|
85
|
+
<dt>Defined in:</dt>
|
86
|
+
<dd>lib/dxopal/sprite/physics.rb</dd>
|
87
|
+
</dl>
|
88
|
+
|
89
|
+
</div>
|
90
|
+
|
91
|
+
<h2>Overview</h2><div class="docstring">
|
92
|
+
<div class="discussion">
|
93
|
+
|
94
|
+
<p>Experimental Matter.js (physics engine) support</p>
|
95
|
+
|
96
|
+
<p>You need to load matter.js in advance to using these features.</p>
|
97
|
+
|
98
|
+
|
99
|
+
</div>
|
100
|
+
</div>
|
101
|
+
<div class="tags">
|
102
|
+
|
103
|
+
|
104
|
+
</div>
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
|
109
|
+
<ul class="summary">
|
110
|
+
|
111
|
+
<li class="public ">
|
112
|
+
<span class="summary_signature">
|
113
|
+
|
114
|
+
<a href="#_matter_body-instance_method" title="#_matter_body (instance method)">#<strong>_matter_body</strong> ⇒ Object </a>
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
</span>
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
<span class="note title readonly">readonly</span>
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
<span class="summary_desc"><div class='inline'>
|
134
|
+
<p>Returns the value of attribute _matter_body.</p>
|
135
|
+
</div></span>
|
136
|
+
|
137
|
+
</li>
|
138
|
+
|
139
|
+
|
140
|
+
</ul>
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
<h2>
|
147
|
+
Instance Method Summary
|
148
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
149
|
+
</h2>
|
150
|
+
|
151
|
+
<ul class="summary">
|
152
|
+
|
153
|
+
<li class="public ">
|
154
|
+
<span class="summary_signature">
|
155
|
+
|
156
|
+
<a href="#_move_matter_body-instance_method" title="#_move_matter_body (instance method)">#<strong>_move_matter_body</strong> ⇒ Object </a>
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
</span>
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
171
|
+
|
172
|
+
</li>
|
173
|
+
|
174
|
+
|
175
|
+
<li class="public ">
|
176
|
+
<span class="summary_signature">
|
177
|
+
|
178
|
+
<a href="#_move_to_matter_body-instance_method" title="#_move_to_matter_body (instance method)">#<strong>_move_to_matter_body</strong>(mx, my) ⇒ Object </a>
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
</span>
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
193
|
+
|
194
|
+
</li>
|
195
|
+
|
196
|
+
|
197
|
+
<li class="public ">
|
198
|
+
<span class="summary_signature">
|
199
|
+
|
200
|
+
<a href="#physical_body=-instance_method" title="#physical_body= (instance method)">#<strong>physical_body=</strong>(ary) ⇒ Object </a>
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
</span>
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
<span class="summary_desc"><div class='inline'>
|
215
|
+
<p>Create Matter Body and register it to the World - type: :rectangle, etc.</p>
|
216
|
+
</div></span>
|
217
|
+
|
218
|
+
</li>
|
219
|
+
|
220
|
+
|
221
|
+
</ul>
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
<div id="instance_attr_details" class="attr_details">
|
226
|
+
<h2>Instance Attribute Details</h2>
|
227
|
+
|
228
|
+
|
229
|
+
<span id=""></span>
|
230
|
+
<div class="method_details first">
|
231
|
+
<h3 class="signature first" id="_matter_body-instance_method">
|
232
|
+
|
233
|
+
#<strong>_matter_body</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
</h3><div class="docstring">
|
240
|
+
<div class="discussion">
|
241
|
+
|
242
|
+
<p>Returns the value of attribute _matter_body.</p>
|
243
|
+
|
244
|
+
|
245
|
+
</div>
|
246
|
+
</div>
|
247
|
+
<div class="tags">
|
248
|
+
|
249
|
+
|
250
|
+
</div><table class="source_code">
|
251
|
+
<tr>
|
252
|
+
<td>
|
253
|
+
<pre class="lines">
|
254
|
+
|
255
|
+
|
256
|
+
25
|
257
|
+
26
|
258
|
+
27</pre>
|
259
|
+
</td>
|
260
|
+
<td>
|
261
|
+
<pre class="code"><span class="info file"># File 'lib/dxopal/sprite/physics.rb', line 25</span>
|
262
|
+
|
263
|
+
<span class='kw'>def</span> <span class='id identifier rubyid__matter_body'>_matter_body</span>
|
264
|
+
<span class='ivar'>@_matter_body</span>
|
265
|
+
<span class='kw'>end</span></pre>
|
266
|
+
</td>
|
267
|
+
</tr>
|
268
|
+
</table>
|
269
|
+
</div>
|
270
|
+
|
271
|
+
</div>
|
272
|
+
|
273
|
+
|
274
|
+
<div id="instance_method_details" class="method_details_list">
|
275
|
+
<h2>Instance Method Details</h2>
|
276
|
+
|
277
|
+
|
278
|
+
<div class="method_details first">
|
279
|
+
<h3 class="signature first" id="_move_matter_body-instance_method">
|
280
|
+
|
281
|
+
#<strong>_move_matter_body</strong> ⇒ <tt>Object</tt>
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
</h3><table class="source_code">
|
288
|
+
<tr>
|
289
|
+
<td>
|
290
|
+
<pre class="lines">
|
291
|
+
|
292
|
+
|
293
|
+
27
|
294
|
+
28
|
295
|
+
29
|
296
|
+
30
|
297
|
+
31</pre>
|
298
|
+
</td>
|
299
|
+
<td>
|
300
|
+
<pre class="code"><span class="info file"># File 'lib/dxopal/sprite/physics.rb', line 27</span>
|
301
|
+
|
302
|
+
<span class='kw'>def</span> <span class='id identifier rubyid__move_matter_body'>_move_matter_body</span>
|
303
|
+
<span class='comment'># TODO: support non-default center_x, center_y
|
304
|
+
</span> <span class='backtick'>`</span><span class='tstring_content'>Matter.Body.setPosition(</span><span class='embexpr_beg'>#{</span><span class='ivar'>@_matter_body</span><span class='embexpr_end'>}</span><span class='tstring_content'>,
|
305
|
+
Matter.Vector.create(</span><span class='embexpr_beg'>#{</span><span class='ivar'>@x</span><span class='op'>+</span><span class='ivar'>@center_x</span><span class='embexpr_end'>}</span><span class='tstring_content'>, </span><span class='embexpr_beg'>#{</span><span class='ivar'>@y</span><span class='op'>+</span><span class='ivar'>@center_y</span><span class='embexpr_end'>}</span><span class='tstring_content'>))</span><span class='tstring_end'>`</span></span>
|
306
|
+
<span class='kw'>end</span></pre>
|
307
|
+
</td>
|
308
|
+
</tr>
|
309
|
+
</table>
|
310
|
+
</div>
|
311
|
+
|
312
|
+
<div class="method_details ">
|
313
|
+
<h3 class="signature " id="_move_to_matter_body-instance_method">
|
314
|
+
|
315
|
+
#<strong>_move_to_matter_body</strong>(mx, my) ⇒ <tt>Object</tt>
|
316
|
+
|
317
|
+
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
</h3><table class="source_code">
|
322
|
+
<tr>
|
323
|
+
<td>
|
324
|
+
<pre class="lines">
|
325
|
+
|
326
|
+
|
327
|
+
33
|
328
|
+
34
|
329
|
+
35
|
330
|
+
36</pre>
|
331
|
+
</td>
|
332
|
+
<td>
|
333
|
+
<pre class="code"><span class="info file"># File 'lib/dxopal/sprite/physics.rb', line 33</span>
|
334
|
+
|
335
|
+
<span class='kw'>def</span> <span class='id identifier rubyid__move_to_matter_body'>_move_to_matter_body</span><span class='lparen'>(</span><span class='id identifier rubyid_mx'>mx</span><span class='comma'>,</span> <span class='id identifier rubyid_my'>my</span><span class='rparen'>)</span>
|
336
|
+
<span class='ivar'>@x</span> <span class='op'>=</span> <span class='id identifier rubyid_mx'>mx</span> <span class='op'>-</span> <span class='ivar'>@center_x</span>
|
337
|
+
<span class='ivar'>@y</span> <span class='op'>=</span> <span class='id identifier rubyid_my'>my</span> <span class='op'>-</span> <span class='ivar'>@center_y</span>
|
338
|
+
<span class='kw'>end</span></pre>
|
339
|
+
</td>
|
340
|
+
</tr>
|
341
|
+
</table>
|
342
|
+
</div>
|
343
|
+
|
344
|
+
<div class="method_details ">
|
345
|
+
<h3 class="signature " id="physical_body=-instance_method">
|
346
|
+
|
347
|
+
#<strong>physical_body=</strong>(ary) ⇒ <tt>Object</tt>
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
|
352
|
+
|
353
|
+
</h3><div class="docstring">
|
354
|
+
<div class="discussion">
|
355
|
+
|
356
|
+
<p>Create Matter Body and register it to the World</p>
|
357
|
+
<ul><li>
|
358
|
+
<p>type: :rectangle, etc.</p>
|
359
|
+
</li></ul>
|
360
|
+
|
361
|
+
|
362
|
+
</div>
|
363
|
+
</div>
|
364
|
+
<div class="tags">
|
365
|
+
|
366
|
+
|
367
|
+
</div><table class="source_code">
|
368
|
+
<tr>
|
369
|
+
<td>
|
370
|
+
<pre class="lines">
|
371
|
+
|
372
|
+
|
373
|
+
9
|
374
|
+
10
|
375
|
+
11
|
376
|
+
12
|
377
|
+
13
|
378
|
+
14
|
379
|
+
15
|
380
|
+
16
|
381
|
+
17
|
382
|
+
18
|
383
|
+
19
|
384
|
+
20
|
385
|
+
21
|
386
|
+
22
|
387
|
+
23
|
388
|
+
24</pre>
|
389
|
+
</td>
|
390
|
+
<td>
|
391
|
+
<pre class="code"><span class="info file"># File 'lib/dxopal/sprite/physics.rb', line 9</span>
|
392
|
+
|
393
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_physical_body='>physical_body=</span><span class='lparen'>(</span><span class='id identifier rubyid_ary'>ary</span><span class='rparen'>)</span>
|
394
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Call Sprite#initialize before calling physical_body=</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_x'>x</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
395
|
+
<span class='id identifier rubyid_type'>type</span> <span class='op'>=</span> <span class='id identifier rubyid_ary'>ary</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span>
|
396
|
+
<span class='kw'>case</span> <span class='id identifier rubyid_type'>type</span>
|
397
|
+
<span class='kw'>when</span> <span class='symbol'>:rectangle</span>
|
398
|
+
<span class='id identifier rubyid__'>_</span><span class='comma'>,</span> <span class='id identifier rubyid_width'>width</span><span class='comma'>,</span> <span class='id identifier rubyid_height'>height</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='op'>*</span><span class='id identifier rubyid_ary'>ary</span>
|
399
|
+
<span class='id identifier rubyid_x'>x</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_x'>x</span> <span class='op'>+</span> <span class='id identifier rubyid_width'>width</span><span class='op'>/</span><span class='int'>2</span>
|
400
|
+
<span class='id identifier rubyid_y'>y</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_y'>y</span> <span class='op'>+</span> <span class='id identifier rubyid_height'>height</span><span class='op'>/</span><span class='int'>2</span>
|
401
|
+
<span class='id identifier rubyid_info'>info</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='id identifier rubyid_width'>width</span><span class='comma'>,</span> <span class='id identifier rubyid_height'>height</span><span class='rbracket'>]</span>
|
402
|
+
<span class='backtick'>`</span><span class='tstring_content'>opts.angle = opts.angle || </span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_angle'>angle</span> <span class='op'>*</span> <span class='const'>Math</span><span class='op'>::</span><span class='const'>PI</span> <span class='op'>/</span> <span class='int'>180</span><span class='embexpr_end'>}</span><span class='tstring_end'>`</span></span>
|
403
|
+
<span class='ivar'>@_matter_body</span> <span class='op'>=</span> <span class='backtick'>`</span><span class='tstring_content'>Matter.Bodies[type](x, y, width, height, opts)</span><span class='tstring_end'>`</span></span>
|
404
|
+
<span class='kw'>else</span>
|
405
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>type </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'> is unknown or not supported yet</span><span class='tstring_end'>"</span></span>
|
406
|
+
<span class='kw'>end</span>
|
407
|
+
<span class='const'><span class='object_link'><a href="../Sprite.html" title="DXOpal::Sprite (class)">Sprite</a></span></span><span class='period'>.</span><span class='id identifier rubyid__add_matter_body'><span class='object_link'><a href="../Sprite.html#_add_matter_body-class_method" title="DXOpal::Sprite._add_matter_body (method)">_add_matter_body</a></span></span><span class='lparen'>(</span><span class='ivar'>@_matter_body</span><span class='comma'>,</span> <span class='id identifier rubyid_type'>type</span><span class='comma'>,</span> <span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_info'>info</span><span class='rparen'>)</span>
|
408
|
+
<span class='kw'>end</span></pre>
|
409
|
+
</td>
|
410
|
+
</tr>
|
411
|
+
</table>
|
412
|
+
</div>
|
413
|
+
|
414
|
+
</div>
|
415
|
+
|
416
|
+
</div>
|
417
|
+
|
418
|
+
<div id="footer">
|
419
|
+
Generated on Tue Jul 9 22:42:34 2024 by
|
420
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
421
|
+
0.9.36 (ruby-3.2.2).
|
422
|
+
</div>
|
423
|
+
|
424
|
+
</div>
|
425
|
+
</body>
|
426
|
+
</html>
|