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,268 @@
|
|
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::CollisionCheck::ClassMethods
|
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::CollisionCheck::ClassMethods";
|
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> » <span class='title'><span class='object_link'><a href="../CollisionCheck.html" title="DXOpal::Sprite::CollisionCheck (module)">CollisionCheck</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">ClassMethods</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::CollisionCheck::ClassMethods
|
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/collision_check.rb</dd>
|
87
|
+
</dl>
|
88
|
+
|
89
|
+
</div>
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
<h2>
|
100
|
+
Instance Method Summary
|
101
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
102
|
+
</h2>
|
103
|
+
|
104
|
+
<ul class="summary">
|
105
|
+
|
106
|
+
<li class="public ">
|
107
|
+
<span class="summary_signature">
|
108
|
+
|
109
|
+
<a href="#check-instance_method" title="#check (instance method)">#<strong>check</strong>(offences, defences, shot = :shot, hit = :hit) ⇒ Object </a>
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
</span>
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
<span class="summary_desc"><div class='inline'>
|
124
|
+
<p>Run collision checking for set of sprites - offences: Sprite or [Sprite] - defences: Sprite or [Sprite] - shot: method name - hit: method name.</p>
|
125
|
+
</div></span>
|
126
|
+
|
127
|
+
</li>
|
128
|
+
|
129
|
+
|
130
|
+
</ul>
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
<div id="instance_method_details" class="method_details_list">
|
136
|
+
<h2>Instance Method Details</h2>
|
137
|
+
|
138
|
+
|
139
|
+
<div class="method_details first">
|
140
|
+
<h3 class="signature first" id="check-instance_method">
|
141
|
+
|
142
|
+
#<strong>check</strong>(offences, defences, shot = :shot, hit = :hit) ⇒ <tt>Object</tt>
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
</h3><div class="docstring">
|
149
|
+
<div class="discussion">
|
150
|
+
|
151
|
+
<p>Run collision checking for set of sprites</p>
|
152
|
+
<ul><li>
|
153
|
+
<p>offences: Sprite or [Sprite]</p>
|
154
|
+
</li><li>
|
155
|
+
<p>defences: Sprite or [Sprite]</p>
|
156
|
+
</li><li>
|
157
|
+
<p>shot: method name</p>
|
158
|
+
</li><li>
|
159
|
+
<p>hit: method name</p>
|
160
|
+
</li></ul>
|
161
|
+
|
162
|
+
<p>This method has two modes.</p>
|
163
|
+
<ul><li>
|
164
|
+
<p>If ‘offences` and `defences` are the same, collision check will be performed on each pair from the array. Method `hit` is called on the each sprite, with the other sprite as an argument.</p>
|
165
|
+
</li><li>
|
166
|
+
<p>Otherwise, collision check will be performed on each pair of offence sprite and defence sprite. In this case, method ‘shot` is called on the offence sprite and method `hit` is called on the defence sprite, with the other sprite as an argument.</p>
|
167
|
+
</li></ul>
|
168
|
+
|
169
|
+
<p>TODO: return true if any collition is detected TODO: skip collision checking if shot/hit returned ‘:discard`</p>
|
170
|
+
|
171
|
+
|
172
|
+
</div>
|
173
|
+
</div>
|
174
|
+
<div class="tags">
|
175
|
+
|
176
|
+
|
177
|
+
</div><table class="source_code">
|
178
|
+
<tr>
|
179
|
+
<td>
|
180
|
+
<pre class="lines">
|
181
|
+
|
182
|
+
|
183
|
+
26
|
184
|
+
27
|
185
|
+
28
|
186
|
+
29
|
187
|
+
30
|
188
|
+
31
|
189
|
+
32
|
190
|
+
33
|
191
|
+
34
|
192
|
+
35
|
193
|
+
36
|
194
|
+
37
|
195
|
+
38
|
196
|
+
39
|
197
|
+
40
|
198
|
+
41
|
199
|
+
42
|
200
|
+
43
|
201
|
+
44
|
202
|
+
45
|
203
|
+
46
|
204
|
+
47
|
205
|
+
48
|
206
|
+
49
|
207
|
+
50
|
208
|
+
51
|
209
|
+
52
|
210
|
+
53
|
211
|
+
54
|
212
|
+
55
|
213
|
+
56
|
214
|
+
57</pre>
|
215
|
+
</td>
|
216
|
+
<td>
|
217
|
+
<pre class="code"><span class="info file"># File 'lib/dxopal/sprite/collision_check.rb', line 26</span>
|
218
|
+
|
219
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_check'>check</span><span class='lparen'>(</span><span class='id identifier rubyid_offences'>offences</span><span class='comma'>,</span> <span class='id identifier rubyid_defences'>defences</span><span class='comma'>,</span> <span class='id identifier rubyid_shot'>shot</span><span class='op'>=</span><span class='symbol'>:shot</span><span class='comma'>,</span> <span class='id identifier rubyid_hit'>hit</span><span class='op'>=</span><span class='symbol'>:hit</span><span class='rparen'>)</span>
|
220
|
+
<span class='id identifier rubyid_offences'>offences</span> <span class='op'>=</span> <span class='const'>Array</span><span class='lparen'>(</span><span class='id identifier rubyid_offences'>offences</span><span class='rparen'>)</span>
|
221
|
+
<span class='id identifier rubyid_defences'>defences</span> <span class='op'>=</span> <span class='const'>Array</span><span class='lparen'>(</span><span class='id identifier rubyid_defences'>defences</span><span class='rparen'>)</span>
|
222
|
+
<span class='id identifier rubyid_i'>i</span> <span class='op'>=</span> <span class='id identifier rubyid_j'>j</span> <span class='op'>=</span> <span class='int'>0</span> <span class='comment'># trick to use i, j in the `#{}`
|
223
|
+
</span> <span class='kw'>if</span> <span class='id identifier rubyid_offences'>offences</span><span class='period'>.</span><span class='id identifier rubyid_equal?'>equal?</span><span class='lparen'>(</span><span class='id identifier rubyid_defences'>defences</span><span class='rparen'>)</span>
|
224
|
+
<span class='comment'># any-vs-any mode
|
225
|
+
</span> <span class='id identifier rubyid_sprites'>sprites</span> <span class='op'>=</span> <span class='id identifier rubyid_offences'>offences</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_x'>x</span><span class='op'>|</span> <span class='id identifier rubyid_x'>x</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="../../Sprite.html" title="DXOpal::Sprite (class)">Sprite</a></span></span><span class='rparen'>)</span><span class='rbrace'>}</span>
|
226
|
+
<span class='id identifier rubyid_n'>n</span> <span class='op'>=</span> <span class='id identifier rubyid_sprites'>sprites</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span>
|
227
|
+
<span class='backtick'>%x{</span><span class='tstring_content'>
|
228
|
+
for (var i=0; i<n; i++) {
|
229
|
+
for (var j=i+1; j<n; j++) {
|
230
|
+
if (</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_sprites'>sprites</span><span class='lbracket'>[</span><span class='id identifier rubyid_i'>i</span><span class='rbracket'>]</span> <span class='op'>===</span> <span class='id identifier rubyid_sprites'>sprites</span><span class='lbracket'>[</span><span class='id identifier rubyid_j'>j</span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_content'>) {
|
231
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_sprites'>sprites</span><span class='lbracket'>[</span><span class='id identifier rubyid_i'>i</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid___send__'>__send__</span><span class='lparen'>(</span><span class='id identifier rubyid_hit'>hit</span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
232
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_sprites'>sprites</span><span class='lbracket'>[</span><span class='id identifier rubyid_j'>j</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid___send__'>__send__</span><span class='lparen'>(</span><span class='id identifier rubyid_hit'>hit</span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
233
|
+
}
|
234
|
+
}
|
235
|
+
}
|
236
|
+
</span><span class='tstring_end'>}</span></span>
|
237
|
+
<span class='kw'>else</span>
|
238
|
+
<span class='comment'># offence-vs-defence mode
|
239
|
+
</span> <span class='backtick'>%x{</span><span class='tstring_content'>
|
240
|
+
for (var i=0; i<offences.length; i++) {
|
241
|
+
for (var j=0; j<defences.length; j++) {
|
242
|
+
if (</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_offences'>offences</span><span class='lbracket'>[</span><span class='id identifier rubyid_i'>i</span><span class='rbracket'>]</span> <span class='op'>===</span> <span class='id identifier rubyid_defences'>defences</span><span class='lbracket'>[</span><span class='id identifier rubyid_j'>j</span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_content'>) {
|
243
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_offences'>offences</span><span class='lbracket'>[</span><span class='id identifier rubyid_i'>i</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid___send__'>__send__</span><span class='lparen'>(</span><span class='id identifier rubyid_shot'>shot</span><span class='comma'>,</span> <span class='id identifier rubyid_defences'>defences</span><span class='lbracket'>[</span><span class='id identifier rubyid_j'>j</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
244
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_defences'>defences</span><span class='lbracket'>[</span><span class='id identifier rubyid_j'>j</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid___send__'>__send__</span><span class='lparen'>(</span><span class='id identifier rubyid_hit'>hit</span><span class='comma'>,</span> <span class='id identifier rubyid_offences'>offences</span><span class='lbracket'>[</span><span class='id identifier rubyid_i'>i</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
245
|
+
}
|
246
|
+
}
|
247
|
+
}
|
248
|
+
</span><span class='tstring_end'>}</span></span>
|
249
|
+
<span class='kw'>end</span>
|
250
|
+
<span class='kw'>end</span></pre>
|
251
|
+
</td>
|
252
|
+
</tr>
|
253
|
+
</table>
|
254
|
+
</div>
|
255
|
+
|
256
|
+
</div>
|
257
|
+
|
258
|
+
</div>
|
259
|
+
|
260
|
+
<div id="footer">
|
261
|
+
Generated on Tue Jul 9 22:42:34 2024 by
|
262
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
263
|
+
0.9.36 (ruby-3.2.2).
|
264
|
+
</div>
|
265
|
+
|
266
|
+
</div>
|
267
|
+
</body>
|
268
|
+
</html>
|