dxopal 1.5.1 → 1.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/Gemfile +2 -1
- data/Gemfile.lock +20 -20
- data/README.md +3 -3
- data/Rakefile +2 -14
- data/build/dxopal.js +26114 -18554
- data/build/dxopal.min.js +1 -1
- data/doc/api/DXOpal.html +10 -10
- data/doc/api/DXOpal/Constants.html +115 -0
- data/doc/api/DXOpal/Constants/Colors.html +172 -0
- data/doc/api/DXOpal/Font.html +71 -17
- data/doc/api/DXOpal/Image.html +891 -398
- data/doc/api/DXOpal/Input.html +814 -91
- data/doc/api/DXOpal/Input/KeyCodes.html +986 -0
- data/doc/api/DXOpal/Input/MouseCodes.html +7 -7
- data/doc/api/DXOpal/Input/Touch.html +834 -0
- data/doc/api/DXOpal/RemoteResource.html +16 -18
- data/doc/api/DXOpal/Sound.html +15 -15
- data/doc/api/DXOpal/SoundEffect.html +11 -13
- data/doc/api/DXOpal/SoundEffect/WaveTypes.html +7 -7
- data/doc/api/DXOpal/Sprite.html +517 -40
- data/doc/api/DXOpal/Sprite/CollisionArea.html +126 -0
- 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/CollisionCheck.html +926 -0
- data/doc/api/DXOpal/Sprite/CollisionCheck/ClassMethods.html +268 -0
- data/doc/api/DXOpal/Sprite/Physics.html +426 -0
- data/doc/api/DXOpal/Window.html +235 -152
- data/doc/api/Kernel.html +131 -0
- data/doc/api/_index.html +276 -4
- data/doc/api/class_list.html +1 -1
- data/doc/api/css/style.css +1 -0
- data/doc/api/file.README.html +6 -8
- data/doc/api/frames.html +1 -1
- data/doc/api/index.html +6 -8
- data/doc/api/method_list.html +1600 -0
- data/doc/api/top-level-namespace.html +154 -3
- data/lib/dxopal/input.rb +4 -2
- data/lib/dxopal/version.rb +1 -1
- metadata +21 -8
@@ -0,0 +1,126 @@
|
|
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::CollisionArea
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.26
|
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::CollisionArea";
|
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 (C)</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">CollisionArea</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::CollisionArea
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<dl>
|
80
|
+
<dt>Defined in:</dt>
|
81
|
+
<dd>lib/dxopal/sprite/collision_area.rb</dd>
|
82
|
+
</dl>
|
83
|
+
|
84
|
+
</div>
|
85
|
+
|
86
|
+
<h2>Overview</h2><div class="docstring">
|
87
|
+
<div class="discussion">
|
88
|
+
|
89
|
+
<p>Methods of Sprite related to collision checking</p>
|
90
|
+
|
91
|
+
|
92
|
+
</div>
|
93
|
+
</div>
|
94
|
+
<div class="tags">
|
95
|
+
|
96
|
+
|
97
|
+
</div><h2>Defined Under Namespace</h2>
|
98
|
+
<p class="children">
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="CollisionArea/Base.html" title="DXOpal::Sprite::CollisionArea::Base (class)">Base</a></span>, <span class='object_link'><a href="CollisionArea/Circle.html" title="DXOpal::Sprite::CollisionArea::Circle (class)">Circle</a></span>, <span class='object_link'><a href="CollisionArea/Point.html" title="DXOpal::Sprite::CollisionArea::Point (class)">Point</a></span>, <span class='object_link'><a href="CollisionArea/Rect.html" title="DXOpal::Sprite::CollisionArea::Rect (class)">Rect</a></span>, <span class='object_link'><a href="CollisionArea/Triangle.html" title="DXOpal::Sprite::CollisionArea::Triangle (class)">Triangle</a></span>
|
104
|
+
|
105
|
+
|
106
|
+
</p>
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
</div>
|
117
|
+
|
118
|
+
<div id="footer">
|
119
|
+
Generated on Tue Dec 29 11:37:23 2020 by
|
120
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
121
|
+
0.9.26 (ruby-2.7.0).
|
122
|
+
</div>
|
123
|
+
|
124
|
+
</div>
|
125
|
+
</body>
|
126
|
+
</html>
|
@@ -0,0 +1,649 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
Class: DXOpal::Sprite::CollisionArea::Base
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.26
|
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::CollisionArea::Base";
|
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 (B)</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> » <span class='title'><span class='object_link'><a href="../CollisionArea.html" title="DXOpal::Sprite::CollisionArea (module)">CollisionArea</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">Base</span>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div id="search">
|
47
|
+
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
49
|
+
href="../../../class_list.html">
|
50
|
+
|
51
|
+
<svg width="24" height="24">
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
+
</svg>
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div id="content"><h1>Class: DXOpal::Sprite::CollisionArea::Base
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
<dl>
|
70
|
+
<dt>Inherits:</dt>
|
71
|
+
<dd>
|
72
|
+
<span class="inheritName">Object</span>
|
73
|
+
|
74
|
+
<ul class="fullTree">
|
75
|
+
<li>Object</li>
|
76
|
+
|
77
|
+
<li class="next">DXOpal::Sprite::CollisionArea::Base</li>
|
78
|
+
|
79
|
+
</ul>
|
80
|
+
<a href="#" class="inheritanceTree">show all</a>
|
81
|
+
|
82
|
+
</dd>
|
83
|
+
</dl>
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
<dl>
|
96
|
+
<dt>Defined in:</dt>
|
97
|
+
<dd>lib/dxopal/sprite/collision_area.rb</dd>
|
98
|
+
</dl>
|
99
|
+
|
100
|
+
</div>
|
101
|
+
|
102
|
+
<div id="subclasses">
|
103
|
+
<h2>Direct Known Subclasses</h2>
|
104
|
+
<p class="children"><span class='object_link'><a href="Circle.html" title="DXOpal::Sprite::CollisionArea::Circle (class)">Circle</a></span>, <span class='object_link'><a href="Point.html" title="DXOpal::Sprite::CollisionArea::Point (class)">Point</a></span>, <span class='object_link'><a href="Rect.html" title="DXOpal::Sprite::CollisionArea::Rect (class)">Rect</a></span>, <span class='object_link'><a href="Triangle.html" title="DXOpal::Sprite::CollisionArea::Triangle (class)">Triangle</a></span></p>
|
105
|
+
</div>
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
|
111
|
+
<ul class="summary">
|
112
|
+
|
113
|
+
<li class="public ">
|
114
|
+
<span class="summary_signature">
|
115
|
+
|
116
|
+
<a href="#sprite-instance_method" title="#sprite (instance method)">#<strong>sprite</strong> ⇒ Object </a>
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
</span>
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
<span class="note title readonly">readonly</span>
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
<span class="summary_desc"><div class='inline'>
|
136
|
+
<p>Sprite corresponds to this hitarea.</p>
|
137
|
+
</div></span>
|
138
|
+
|
139
|
+
</li>
|
140
|
+
|
141
|
+
|
142
|
+
</ul>
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
<h2>
|
149
|
+
Instance Method Summary
|
150
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
151
|
+
</h2>
|
152
|
+
|
153
|
+
<ul class="summary">
|
154
|
+
|
155
|
+
<li class="public ">
|
156
|
+
<span class="summary_signature">
|
157
|
+
|
158
|
+
<a href="#aabb-instance_method" title="#aabb (instance method)">#<strong>aabb</strong>(poss) ⇒ Object </a>
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
</span>
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
173
|
+
|
174
|
+
</li>
|
175
|
+
|
176
|
+
|
177
|
+
<li class="public ">
|
178
|
+
<span class="summary_signature">
|
179
|
+
|
180
|
+
<a href="#absolute-instance_method" title="#absolute (instance method)">#<strong>absolute</strong>(poss) ⇒ Object </a>
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
</span>
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
195
|
+
|
196
|
+
</li>
|
197
|
+
|
198
|
+
|
199
|
+
<li class="public ">
|
200
|
+
<span class="summary_signature">
|
201
|
+
|
202
|
+
<a href="#absolute1-instance_method" title="#absolute1 (instance method)">#<strong>absolute1</strong>(pos) ⇒ Object </a>
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
</span>
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
217
|
+
|
218
|
+
</li>
|
219
|
+
|
220
|
+
|
221
|
+
<li class="public ">
|
222
|
+
<span class="summary_signature">
|
223
|
+
|
224
|
+
<a href="#transback-instance_method" title="#transback (instance method)">#<strong>transback</strong>(poss, sprite) ⇒ Object </a>
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
</span>
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
239
|
+
|
240
|
+
</li>
|
241
|
+
|
242
|
+
|
243
|
+
<li class="public ">
|
244
|
+
<span class="summary_signature">
|
245
|
+
|
246
|
+
<a href="#transback1-instance_method" title="#transback1 (instance method)">#<strong>transback1</strong>(pos, sprite) ⇒ Object </a>
|
247
|
+
|
248
|
+
|
249
|
+
|
250
|
+
</span>
|
251
|
+
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
261
|
+
|
262
|
+
</li>
|
263
|
+
|
264
|
+
|
265
|
+
<li class="public ">
|
266
|
+
<span class="summary_signature">
|
267
|
+
|
268
|
+
<a href="#type-instance_method" title="#type (instance method)">#<strong>type</strong> ⇒ Object </a>
|
269
|
+
|
270
|
+
|
271
|
+
|
272
|
+
</span>
|
273
|
+
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
|
282
|
+
<span class="summary_desc"><div class='inline'>
|
283
|
+
<p>Return a string like “Point”, “Rect”, etc.</p>
|
284
|
+
</div></span>
|
285
|
+
|
286
|
+
</li>
|
287
|
+
|
288
|
+
|
289
|
+
</ul>
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
<div id="instance_attr_details" class="attr_details">
|
294
|
+
<h2>Instance Attribute Details</h2>
|
295
|
+
|
296
|
+
|
297
|
+
<span id=""></span>
|
298
|
+
<div class="method_details first">
|
299
|
+
<h3 class="signature first" id="sprite-instance_method">
|
300
|
+
|
301
|
+
#<strong>sprite</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
|
306
|
+
|
307
|
+
</h3><div class="docstring">
|
308
|
+
<div class="discussion">
|
309
|
+
|
310
|
+
<p>Sprite corresponds to this hitarea</p>
|
311
|
+
|
312
|
+
|
313
|
+
</div>
|
314
|
+
</div>
|
315
|
+
<div class="tags">
|
316
|
+
|
317
|
+
|
318
|
+
</div><table class="source_code">
|
319
|
+
<tr>
|
320
|
+
<td>
|
321
|
+
<pre class="lines">
|
322
|
+
|
323
|
+
|
324
|
+
9
|
325
|
+
10
|
326
|
+
11</pre>
|
327
|
+
</td>
|
328
|
+
<td>
|
329
|
+
<pre class="code"><span class="info file"># File 'lib/dxopal/sprite/collision_area.rb', line 9</span>
|
330
|
+
|
331
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_sprite'>sprite</span>
|
332
|
+
<span class='ivar'>@sprite</span>
|
333
|
+
<span class='kw'>end</span></pre>
|
334
|
+
</td>
|
335
|
+
</tr>
|
336
|
+
</table>
|
337
|
+
</div>
|
338
|
+
|
339
|
+
</div>
|
340
|
+
|
341
|
+
|
342
|
+
<div id="instance_method_details" class="method_details_list">
|
343
|
+
<h2>Instance Method Details</h2>
|
344
|
+
|
345
|
+
|
346
|
+
<div class="method_details first">
|
347
|
+
<h3 class="signature first" id="aabb-instance_method">
|
348
|
+
|
349
|
+
#<strong>aabb</strong>(poss) ⇒ <tt>Object</tt>
|
350
|
+
|
351
|
+
|
352
|
+
|
353
|
+
|
354
|
+
|
355
|
+
</h3><table class="source_code">
|
356
|
+
<tr>
|
357
|
+
<td>
|
358
|
+
<pre class="lines">
|
359
|
+
|
360
|
+
|
361
|
+
73
|
362
|
+
74
|
363
|
+
75
|
364
|
+
76
|
365
|
+
77
|
366
|
+
78
|
367
|
+
79
|
368
|
+
80
|
369
|
+
81
|
370
|
+
82
|
371
|
+
83
|
372
|
+
84
|
373
|
+
85</pre>
|
374
|
+
</td>
|
375
|
+
<td>
|
376
|
+
<pre class="code"><span class="info file"># File 'lib/dxopal/sprite/collision_area.rb', line 73</span>
|
377
|
+
|
378
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_aabb'>aabb</span><span class='lparen'>(</span><span class='id identifier rubyid_poss'>poss</span><span class='rparen'>)</span>
|
379
|
+
<span class='id identifier rubyid_x1'>x1</span> <span class='op'>=</span> <span class='id identifier rubyid_y1'>y1</span> <span class='op'>=</span> <span class='const'>Float</span><span class='op'>::</span><span class='const'>INFINITY</span>
|
380
|
+
<span class='id identifier rubyid_x2'>x2</span> <span class='op'>=</span> <span class='id identifier rubyid_y2'>y2</span> <span class='op'>=</span> <span class='op'>-</span><span class='const'>Float</span><span class='op'>::</span><span class='const'>INFINITY</span>
|
381
|
+
<span class='backtick'>%x{</span><span class='tstring_content'>
|
382
|
+
for(var i=0; i<poss.length; i++) {
|
383
|
+
if (poss[i][0] < x1) x1 = poss[i][0];
|
384
|
+
if (poss[i][1] < y1) y1 = poss[i][1];
|
385
|
+
if (poss[i][0] > x2) x2 = poss[i][0];
|
386
|
+
if (poss[i][1] > y2) y2 = poss[i][1];
|
387
|
+
}
|
388
|
+
</span><span class='tstring_end'>}</span></span>
|
389
|
+
<span class='kw'>return</span> <span class='lbracket'>[</span><span class='lbracket'>[</span><span class='id identifier rubyid_x1'>x1</span><span class='comma'>,</span> <span class='id identifier rubyid_y1'>y1</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='id identifier rubyid_x2'>x2</span><span class='comma'>,</span> <span class='id identifier rubyid_y2'>y2</span><span class='rbracket'>]</span><span class='rbracket'>]</span>
|
390
|
+
<span class='kw'>end</span></pre>
|
391
|
+
</td>
|
392
|
+
</tr>
|
393
|
+
</table>
|
394
|
+
</div>
|
395
|
+
|
396
|
+
<div class="method_details ">
|
397
|
+
<h3 class="signature " id="absolute-instance_method">
|
398
|
+
|
399
|
+
#<strong>absolute</strong>(poss) ⇒ <tt>Object</tt>
|
400
|
+
|
401
|
+
|
402
|
+
|
403
|
+
|
404
|
+
|
405
|
+
</h3><table class="source_code">
|
406
|
+
<tr>
|
407
|
+
<td>
|
408
|
+
<pre class="lines">
|
409
|
+
|
410
|
+
|
411
|
+
17
|
412
|
+
18
|
413
|
+
19
|
414
|
+
20
|
415
|
+
21
|
416
|
+
22
|
417
|
+
23
|
418
|
+
24
|
419
|
+
25
|
420
|
+
26
|
421
|
+
27
|
422
|
+
28
|
423
|
+
29
|
424
|
+
30
|
425
|
+
31
|
426
|
+
32
|
427
|
+
33
|
428
|
+
34
|
429
|
+
35
|
430
|
+
36
|
431
|
+
37
|
432
|
+
38
|
433
|
+
39
|
434
|
+
40</pre>
|
435
|
+
</td>
|
436
|
+
<td>
|
437
|
+
<pre class="code"><span class="info file"># File 'lib/dxopal/sprite/collision_area.rb', line 17</span>
|
438
|
+
|
439
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_absolute'>absolute</span><span class='lparen'>(</span><span class='id identifier rubyid_poss'>poss</span><span class='rparen'>)</span>
|
440
|
+
<span class='id identifier rubyid_ox'>ox</span> <span class='op'>=</span> <span class='ivar'>@sprite</span><span class='period'>.</span><span class='id identifier rubyid_x'>x</span>
|
441
|
+
<span class='id identifier rubyid_oy'>oy</span> <span class='op'>=</span> <span class='ivar'>@sprite</span><span class='period'>.</span><span class='id identifier rubyid_y'>y</span>
|
442
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_poss'>poss</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span><span class='op'>|</span><span class='lparen'>(</span><span class='id identifier rubyid_x'>x</span><span class='comma'>,</span> <span class='id identifier rubyid_y'>y</span><span class='rparen'>)</span><span class='op'>|</span> <span class='lbracket'>[</span><span class='id identifier rubyid_x'>x</span><span class='op'>+</span><span class='id identifier rubyid_ox'>ox</span><span class='comma'>,</span> <span class='id identifier rubyid_y'>y</span><span class='op'>+</span><span class='id identifier rubyid_oy'>oy</span><span class='rbracket'>]</span><span class='rbrace'>}</span> <span class='kw'>if</span> <span class='op'>!</span><span class='ivar'>@sprite</span><span class='period'>.</span><span class='id identifier rubyid_collision_sync'>collision_sync</span>
|
443
|
+
<span class='id identifier rubyid_angle'>angle</span> <span class='op'>=</span> <span class='ivar'>@sprite</span><span class='period'>.</span><span class='id identifier rubyid_angle'>angle</span>
|
444
|
+
<span class='id identifier rubyid_cx'>cx</span> <span class='op'>=</span> <span class='ivar'>@sprite</span><span class='period'>.</span><span class='id identifier rubyid_center_x'>center_x</span>
|
445
|
+
<span class='id identifier rubyid_cy'>cy</span> <span class='op'>=</span> <span class='ivar'>@sprite</span><span class='period'>.</span><span class='id identifier rubyid_center_y'>center_y</span>
|
446
|
+
<span class='id identifier rubyid_sx'>sx</span> <span class='op'>=</span> <span class='ivar'>@sprite</span><span class='period'>.</span><span class='id identifier rubyid_scale_x'>scale_x</span>
|
447
|
+
<span class='id identifier rubyid_sy'>sy</span> <span class='op'>=</span> <span class='ivar'>@sprite</span><span class='period'>.</span><span class='id identifier rubyid_scale_y'>scale_y</span>
|
448
|
+
|
449
|
+
<span class='id identifier rubyid_ret'>ret</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
450
|
+
<span class='backtick'>%x{</span><span class='tstring_content'>
|
451
|
+
var rad = Math.PI / 180.0 * angle;
|
452
|
+
var sin = Math.sin(rad);
|
453
|
+
var cos = Math.cos(rad);
|
454
|
+
poss.forEach(function(pos){
|
455
|
+
var x = pos[0], y = pos[1];
|
456
|
+
x2 = (x - cx) * sx * cos - (y - cy) * sy * sin + cx + ox;
|
457
|
+
y2 = (x - cx) * sx * sin + (y - cy) * sy * cos + cy + oy;
|
458
|
+
ret.push([x2, y2]);
|
459
|
+
});
|
460
|
+
</span><span class='tstring_end'>}</span></span>
|
461
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_ret'>ret</span>
|
462
|
+
<span class='kw'>end</span></pre>
|
463
|
+
</td>
|
464
|
+
</tr>
|
465
|
+
</table>
|
466
|
+
</div>
|
467
|
+
|
468
|
+
<div class="method_details ">
|
469
|
+
<h3 class="signature " id="absolute1-instance_method">
|
470
|
+
|
471
|
+
#<strong>absolute1</strong>(pos) ⇒ <tt>Object</tt>
|
472
|
+
|
473
|
+
|
474
|
+
|
475
|
+
|
476
|
+
|
477
|
+
</h3><table class="source_code">
|
478
|
+
<tr>
|
479
|
+
<td>
|
480
|
+
<pre class="lines">
|
481
|
+
|
482
|
+
|
483
|
+
42
|
484
|
+
43
|
485
|
+
44</pre>
|
486
|
+
</td>
|
487
|
+
<td>
|
488
|
+
<pre class="code"><span class="info file"># File 'lib/dxopal/sprite/collision_area.rb', line 42</span>
|
489
|
+
|
490
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_absolute1'>absolute1</span><span class='lparen'>(</span><span class='id identifier rubyid_pos'>pos</span><span class='rparen'>)</span>
|
491
|
+
<span class='id identifier rubyid_absolute'>absolute</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='id identifier rubyid_pos'>pos</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
|
492
|
+
<span class='kw'>end</span></pre>
|
493
|
+
</td>
|
494
|
+
</tr>
|
495
|
+
</table>
|
496
|
+
</div>
|
497
|
+
|
498
|
+
<div class="method_details ">
|
499
|
+
<h3 class="signature " id="transback-instance_method">
|
500
|
+
|
501
|
+
#<strong>transback</strong>(poss, sprite) ⇒ <tt>Object</tt>
|
502
|
+
|
503
|
+
|
504
|
+
|
505
|
+
|
506
|
+
|
507
|
+
</h3><table class="source_code">
|
508
|
+
<tr>
|
509
|
+
<td>
|
510
|
+
<pre class="lines">
|
511
|
+
|
512
|
+
|
513
|
+
46
|
514
|
+
47
|
515
|
+
48
|
516
|
+
49
|
517
|
+
50
|
518
|
+
51
|
519
|
+
52
|
520
|
+
53
|
521
|
+
54
|
522
|
+
55
|
523
|
+
56
|
524
|
+
57
|
525
|
+
58
|
526
|
+
59
|
527
|
+
60
|
528
|
+
61
|
529
|
+
62
|
530
|
+
63
|
531
|
+
64
|
532
|
+
65
|
533
|
+
66
|
534
|
+
67</pre>
|
535
|
+
</td>
|
536
|
+
<td>
|
537
|
+
<pre class="code"><span class="info file"># File 'lib/dxopal/sprite/collision_area.rb', line 46</span>
|
538
|
+
|
539
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_transback'>transback</span><span class='lparen'>(</span><span class='id identifier rubyid_poss'>poss</span><span class='comma'>,</span> <span class='id identifier rubyid_sprite'>sprite</span><span class='rparen'>)</span>
|
540
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_poss'>poss</span> <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_sprite'>sprite</span><span class='period'>.</span><span class='id identifier rubyid_collision_sync'>collision_sync</span>
|
541
|
+
<span class='id identifier rubyid_angle'>angle</span> <span class='op'>=</span> <span class='id identifier rubyid_sprite'>sprite</span><span class='period'>.</span><span class='id identifier rubyid_angle'>angle</span>
|
542
|
+
<span class='id identifier rubyid_cx'>cx</span> <span class='op'>=</span> <span class='id identifier rubyid_sprite'>sprite</span><span class='period'>.</span><span class='id identifier rubyid_x'>x</span> <span class='op'>+</span> <span class='id identifier rubyid_sprite'>sprite</span><span class='period'>.</span><span class='id identifier rubyid_center_x'>center_x</span>
|
543
|
+
<span class='id identifier rubyid_cy'>cy</span> <span class='op'>=</span> <span class='id identifier rubyid_sprite'>sprite</span><span class='period'>.</span><span class='id identifier rubyid_y'>y</span> <span class='op'>+</span> <span class='id identifier rubyid_sprite'>sprite</span><span class='period'>.</span><span class='id identifier rubyid_center_y'>center_y</span>
|
544
|
+
<span class='id identifier rubyid_sx'>sx</span> <span class='op'>=</span> <span class='id identifier rubyid_sprite'>sprite</span><span class='period'>.</span><span class='id identifier rubyid_scale_x'>scale_x</span>
|
545
|
+
<span class='id identifier rubyid_sy'>sy</span> <span class='op'>=</span> <span class='id identifier rubyid_sprite'>sprite</span><span class='period'>.</span><span class='id identifier rubyid_scale_y'>scale_y</span>
|
546
|
+
|
547
|
+
<span class='id identifier rubyid_ret'>ret</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
548
|
+
<span class='backtick'>%x{</span><span class='tstring_content'>
|
549
|
+
var rad = Math.PI / 180.0 * -angle;
|
550
|
+
var sin = Math.sin(rad);
|
551
|
+
var cos = Math.cos(rad);
|
552
|
+
poss.forEach(function(pos){
|
553
|
+
var x = pos[0], y = pos[1];
|
554
|
+
x2 = ((x - cx) * cos - (y - cy) * sin) / sx + cx;
|
555
|
+
y2 = ((x - cx) * sin + (y - cy) * cos) / sy + cy;
|
556
|
+
ret.push([x2, y2]);
|
557
|
+
});
|
558
|
+
</span><span class='tstring_end'>}</span></span>
|
559
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_ret'>ret</span>
|
560
|
+
<span class='kw'>end</span></pre>
|
561
|
+
</td>
|
562
|
+
</tr>
|
563
|
+
</table>
|
564
|
+
</div>
|
565
|
+
|
566
|
+
<div class="method_details ">
|
567
|
+
<h3 class="signature " id="transback1-instance_method">
|
568
|
+
|
569
|
+
#<strong>transback1</strong>(pos, sprite) ⇒ <tt>Object</tt>
|
570
|
+
|
571
|
+
|
572
|
+
|
573
|
+
|
574
|
+
|
575
|
+
</h3><table class="source_code">
|
576
|
+
<tr>
|
577
|
+
<td>
|
578
|
+
<pre class="lines">
|
579
|
+
|
580
|
+
|
581
|
+
69
|
582
|
+
70
|
583
|
+
71</pre>
|
584
|
+
</td>
|
585
|
+
<td>
|
586
|
+
<pre class="code"><span class="info file"># File 'lib/dxopal/sprite/collision_area.rb', line 69</span>
|
587
|
+
|
588
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_transback1'>transback1</span><span class='lparen'>(</span><span class='id identifier rubyid_pos'>pos</span><span class='comma'>,</span> <span class='id identifier rubyid_sprite'>sprite</span><span class='rparen'>)</span>
|
589
|
+
<span class='id identifier rubyid_transback'>transback</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='id identifier rubyid_pos'>pos</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_sprite'>sprite</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
|
590
|
+
<span class='kw'>end</span></pre>
|
591
|
+
</td>
|
592
|
+
</tr>
|
593
|
+
</table>
|
594
|
+
</div>
|
595
|
+
|
596
|
+
<div class="method_details ">
|
597
|
+
<h3 class="signature " id="type-instance_method">
|
598
|
+
|
599
|
+
#<strong>type</strong> ⇒ <tt>Object</tt>
|
600
|
+
|
601
|
+
|
602
|
+
|
603
|
+
|
604
|
+
|
605
|
+
</h3><div class="docstring">
|
606
|
+
<div class="discussion">
|
607
|
+
|
608
|
+
<p>Return a string like “Point”, “Rect”, etc. Used for type checking in `collides?` (because Opal's Class#is_a? is not very fast)</p>
|
609
|
+
|
610
|
+
|
611
|
+
</div>
|
612
|
+
</div>
|
613
|
+
<div class="tags">
|
614
|
+
|
615
|
+
|
616
|
+
</div><table class="source_code">
|
617
|
+
<tr>
|
618
|
+
<td>
|
619
|
+
<pre class="lines">
|
620
|
+
|
621
|
+
|
622
|
+
13
|
623
|
+
14
|
624
|
+
15</pre>
|
625
|
+
</td>
|
626
|
+
<td>
|
627
|
+
<pre class="code"><span class="info file"># File 'lib/dxopal/sprite/collision_area.rb', line 13</span>
|
628
|
+
|
629
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_type'>type</span>
|
630
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>override me</span><span class='tstring_end'>"</span></span>
|
631
|
+
<span class='kw'>end</span></pre>
|
632
|
+
</td>
|
633
|
+
</tr>
|
634
|
+
</table>
|
635
|
+
</div>
|
636
|
+
|
637
|
+
</div>
|
638
|
+
|
639
|
+
</div>
|
640
|
+
|
641
|
+
<div id="footer">
|
642
|
+
Generated on Tue Dec 29 11:37:25 2020 by
|
643
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
644
|
+
0.9.26 (ruby-2.7.0).
|
645
|
+
</div>
|
646
|
+
|
647
|
+
</div>
|
648
|
+
</body>
|
649
|
+
</html>
|