summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--docs/FelFlame.html2
-rw-r--r--docs/FelFlame/ComponentManager.html273
-rw-r--r--docs/FelFlame/Components.html2
-rw-r--r--docs/FelFlame/Entities.html2
-rw-r--r--docs/FelFlame/Scenes.html2
-rw-r--r--docs/FelFlame/Stage.html2
-rw-r--r--docs/FelFlame/Systems.html2
-rw-r--r--docs/Felflame_.html2
-rw-r--r--docs/_index.html2
-rw-r--r--docs/file.README.html2
-rw-r--r--docs/index.html2
-rw-r--r--docs/method_list.html106
-rw-r--r--docs/top-level-namespace.html2
-rw-r--r--lib/felflame/component_manager.rb44
-rw-r--r--spec/component_manager_spec.rb45
-rw-r--r--spec/entity_manager_spec.rb30
16 files changed, 205 insertions, 315 deletions
diff --git a/docs/FelFlame.html b/docs/FelFlame.html
index ba3cf89..b08b611 100644
--- a/docs/FelFlame.html
+++ b/docs/FelFlame.html
@@ -307,7 +307,7 @@
</div>
<div id="footer">
- Generated on Wed Dec 29 06:04:54 2021 by
+ Generated on Wed Dec 29 07:21:30 2021 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.26 (ruby-2.7.3).
</div>
diff --git a/docs/FelFlame/ComponentManager.html b/docs/FelFlame/ComponentManager.html
index 95c9fe4..eeba9e6 100644
--- a/docs/FelFlame/ComponentManager.html
+++ b/docs/FelFlame/ComponentManager.html
@@ -341,7 +341,7 @@
<li class="public ">
<span class="summary_signature">
- <a href="#[]-class_method" title="[] (class method)">.<strong>[]</strong>(component_id) &#x21d2; Component </a>
+ <a href="#method_missing-class_method" title="method_missing (class method)">.<strong>method_missing</strong>(symbol, *args, &amp;block) &#x21d2; Object </a>
@@ -355,33 +355,7 @@
- <span class="summary_desc"><div class='inline'>
-<p>Gets a Component from the given <span class='object_link'><a href="#id-instance_method" title="FelFlame::ComponentManager#id (method)">unique ID</a></span>.</p>
-</div></span>
-
-</li>
-
-
- <li class="public ">
- <span class="summary_signature">
-
- <a href="#each-class_method" title="each (class method)">.<strong>each</strong>(&amp;block) &#x21d2; Enumerator </a>
-
-
-
- </span>
-
-
-
-
-
-
-
-
-
- <span class="summary_desc"><div class='inline'>
-<p>Iterates over all components within the component manager.</p>
-</div></span>
+ <span class="summary_desc"><div class='inline'></div></span>
</li>
@@ -710,12 +684,12 @@
<pre class="lines">
-136
-137
-138</pre>
+144
+145
+146</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 136</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 144</span>
<span class='kw'>def</span> <span class='id identifier rubyid_addition_triggers'>addition_triggers</span>
<span class='ivar'>@addition_triggers</span> <span class='op'>||=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
@@ -766,12 +740,12 @@
<pre class="lines">
-152
-153
-154</pre>
+160
+161
+162</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 152</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 160</span>
<span class='kw'>def</span> <span class='id identifier rubyid_attr_triggers'>attr_triggers</span>
<span class='ivar'>@attr_triggers</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
@@ -822,12 +796,12 @@
<pre class="lines">
-144
-145
-146</pre>
+152
+153
+154</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 144</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 152</span>
<span class='kw'>def</span> <span class='id identifier rubyid_removal_triggers'>removal_triggers</span>
<span class='ivar'>@removal_triggers</span> <span class='op'>||=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
@@ -1074,136 +1048,37 @@
<div class="method_details first">
- <h3 class="signature first" id="[]-class_method">
-
- .<strong>[]</strong>(component_id) &#x21d2; <tt>Component</tt>
-
-
-
-
-
-</h3><div class="docstring">
- <div class="discussion">
-
-<p>Gets a Component from the given <span class='object_link'><a href="#id-instance_method" title="FelFlame::ComponentManager#id (method)">unique ID</a></span>. Usage is simular to how an Array lookup works.</p>
-
-
- </div>
-</div>
-<div class="tags">
-
- <div class="examples">
- <p class="tag_title">Examples:</p>
-
-
- <pre class="example code"><code><span class='comment'># this gets the &#39;Health&#39; Component with ID 7
-</span><span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Components.html" title="FelFlame::Components (class)">Components</a></span></span><span class='op'>::</span><span class='const'>Health</span><span class='lbracket'>[</span><span class='int'>7</span><span class='rbracket'>]</span></code></pre>
-
- </div>
-<p class="tag_title">Parameters:</p>
-<ul class="param">
-
- <li>
-
- <span class='name'>component_id</span>
-
-
- <span class='type'>(<tt>Integer</tt>)</span>
-
-
-
- </li>
-
-</ul>
-
-<p class="tag_title">Returns:</p>
-<ul class="return">
-
- <li>
-
-
- <span class='type'>(<tt>Component</tt>)</span>
-
-
-
- &mdash;
- <div class='inline'>
-<p>Returns the Component that uses the given unique <span class='object_link'><a href="#id-instance_method" title="FelFlame::ComponentManager#id (method)">ID</a></span>, nil if there is no Component associated with the given <span class='object_link'><a href="#id-instance_method" title="FelFlame::ComponentManager#id (method)">ID</a></span></p>
-</div>
-
- </li>
+ <h3 class="signature first" id="method_missing-class_method">
-</ul>
-
-</div><table class="source_code">
- <tr>
- <td>
- <pre class="lines">
-
-
-169
-170
-171</pre>
- </td>
- <td>
- <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 169</span>
-
-<span class='kw'>def</span> <span class='op'>[]</span><span class='lparen'>(</span><span class='id identifier rubyid_component_id'>component_id</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_component_id'>component_id</span><span class='rbracket'>]</span>
-<span class='kw'>end</span></pre>
- </td>
- </tr>
-</table>
-</div>
-
- <div class="method_details ">
- <h3 class="signature " id="each-class_method">
-
- .<strong>each</strong>(&amp;block) &#x21d2; <tt>Enumerator</tt>
-
-
+ .<strong>method_missing</strong>(symbol, *args, &amp;block) &#x21d2; <tt>Object</tt>
-</h3><div class="docstring">
- <div class="discussion">
-
-<p>Iterates over all components within the component manager. Special Enumerable methods like <code>map</code> or <code>each_with_index</code> are not implemented</p>
-
- </div>
-</div>
-<div class="tags">
-
-<p class="tag_title">Returns:</p>
-<ul class="return">
-
- <li>
-
-
- <span class='type'>(<tt>Enumerator</tt>)</span>
-
-
-
- </li>
-</ul>
-
-</div><table class="source_code">
+</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
-176
-177
-178</pre>
+126
+127
+128
+129
+130
+131
+132</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 176</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 126</span>
-<span class='kw'>def</span> <span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
+<span class='kw'>def</span> <span class='id identifier rubyid_method_missing'>method_missing</span><span class='lparen'>(</span><span class='id identifier rubyid_symbol'>symbol</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
+ <span class='kw'>if</span> <span class='id identifier rubyid_symbol'>symbol</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>each</span><span class='tstring_end'>&#39;</span></span>
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_symbol'>symbol</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
+ <span class='kw'>else</span>
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_symbol'>symbol</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
+ <span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
@@ -1260,18 +1135,18 @@
<pre class="lines">
-203
-204
-205
-206
-207
-208
-209
-210
-211</pre>
+211
+212
+213
+214
+215
+216
+217
+218
+219</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 203</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 211</span>
<span class='kw'>def</span> <span class='id identifier rubyid_attr_changed_trigger_systems'>attr_changed_trigger_systems</span><span class='lparen'>(</span><span class='id identifier rubyid_attr'>attr</span><span class='rparen'>)</span>
<span class='id identifier rubyid_systems_to_execute'>systems_to_execute</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_attr'>attr</span><span class='rbracket'>]</span>
@@ -1331,16 +1206,16 @@
<pre class="lines">
-235
-236
-237
-238
-239
-240
-241</pre>
+243
+244
+245
+246
+247
+248
+249</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 235</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 243</span>
<span class='kw'>def</span> <span class='id identifier rubyid_attrs'>attrs</span>
<span class='id identifier rubyid_return_hash'>return_hash</span> <span class='op'>=</span> <span class='id identifier rubyid_instance_variables'>instance_variables</span><span class='period'>.</span><span class='id identifier rubyid_each_with_object'>each_with_object</span><span class='lparen'>(</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_final'>final</span><span class='op'>|</span>
@@ -1398,14 +1273,6 @@
<pre class="lines">
-215
-216
-217
-218
-219
-220
-221
-222
223
224
225
@@ -1415,10 +1282,18 @@
229
230
231
-232</pre>
+232
+233
+234
+235
+236
+237
+238
+239
+240</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 215</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 223</span>
<span class='kw'>def</span> <span class='id identifier rubyid_delete'>delete</span>
<span class='id identifier rubyid_addition_triggers'>addition_triggers</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_system'>system</span><span class='op'>|</span>
@@ -1482,12 +1357,12 @@
<pre class="lines">
-189
-190
-191</pre>
+197
+198
+199</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 189</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 197</span>
<span class='kw'>def</span> <span class='id identifier rubyid_entities'>entities</span>
<span class='ivar'>@entities</span> <span class='op'>||=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
@@ -1536,12 +1411,12 @@
<pre class="lines">
-183
-184
-185</pre>
+191
+192
+193</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 183</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 191</span>
<span class='kw'>def</span> <span class='id identifier rubyid_to_i'>to_i</span>
<span class='id identifier rubyid_id'>id</span>
@@ -1595,14 +1470,14 @@
<pre class="lines">
-195
-196
-197
-198
-199</pre>
+203
+204
+205
+206
+207</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 195</span>
+ <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 203</span>
<span class='kw'>def</span> <span class='id identifier rubyid_update_attrs'>update_attrs</span><span class='lparen'>(</span><span class='op'>**</span><span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span>
<span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='op'>|</span>
@@ -1619,7 +1494,7 @@
</div>
<div id="footer">
- Generated on Wed Dec 29 06:04:55 2021 by
+ Generated on Wed Dec 29 07:21:30 2021 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.26 (ruby-2.7.3).
</div>
diff --git a/docs/FelFlame/Components.html b/docs/FelFlame/Components.html
index 4ebd2dc..b6cd81e 100644
--- a/docs/FelFlame/Components.html
+++ b/docs/FelFlame/Components.html
@@ -421,7 +421,7 @@
</div>
<div id="footer">
- Generated on Wed Dec 29 06:04:55 2021 by
+ Generated on Wed Dec 29 07:21:30 2021 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.26 (ruby-2.7.3).
</div>
diff --git a/docs/FelFlame/Entities.html b/docs/FelFlame/Entities.html
index 306b98e..afd5294 100644
--- a/docs/FelFlame/Entities.html
+++ b/docs/FelFlame/Entities.html
@@ -1042,7 +1042,7 @@
</div>
<div id="footer">
- Generated on Wed Dec 29 06:04:55 2021 by
+ Generated on Wed Dec 29 07:21:30 2021 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.26 (ruby-2.7.3).
</div>
diff --git a/docs/FelFlame/Scenes.html b/docs/FelFlame/Scenes.html
index a78044b..d8b0578 100644
--- a/docs/FelFlame/Scenes.html
+++ b/docs/FelFlame/Scenes.html
@@ -753,7 +753,7 @@
</div>
<div id="footer">
- Generated on Wed Dec 29 06:04:55 2021 by
+ Generated on Wed Dec 29 07:21:30 2021 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.26 (ruby-2.7.3).
</div>
diff --git a/docs/FelFlame/Stage.html b/docs/FelFlame/Stage.html
index 50e9dcb..8478e3f 100644
--- a/docs/FelFlame/Stage.html
+++ b/docs/FelFlame/Stage.html
@@ -588,7 +588,7 @@
</div>
<div id="footer">
- Generated on Wed Dec 29 06:04:55 2021 by
+ Generated on Wed Dec 29 07:21:30 2021 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.26 (ruby-2.7.3).
</div>
diff --git a/docs/FelFlame/Systems.html b/docs/FelFlame/Systems.html
index 56e8aca..6912a03 100644
--- a/docs/FelFlame/Systems.html
+++ b/docs/FelFlame/Systems.html
@@ -1531,7 +1531,7 @@
</div>
<div id="footer">
- Generated on Wed Dec 29 06:04:55 2021 by
+ Generated on Wed Dec 29 07:21:30 2021 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.26 (ruby-2.7.3).
</div>
diff --git a/docs/Felflame_.html b/docs/Felflame_.html
index 94ef230..483f158 100644
--- a/docs/Felflame_.html
+++ b/docs/Felflame_.html
@@ -133,7 +133,7 @@
</div>
<div id="footer">
- Generated on Wed Dec 29 06:04:54 2021 by
+ Generated on Wed Dec 29 07:21:30 2021 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.26 (ruby-2.7.3).
</div>
diff --git a/docs/_index.html b/docs/_index.html
index 61b0c08..5fcfafb 100644
--- a/docs/_index.html
+++ b/docs/_index.html
@@ -168,7 +168,7 @@
</div>
<div id="footer">
- Generated on Wed Dec 29 06:04:54 2021 by
+ Generated on Wed Dec 29 07:21:30 2021 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.26 (ruby-2.7.3).
</div>
diff --git a/docs/file.README.html b/docs/file.README.html
index 132fb00..a69ef78 100644
--- a/docs/file.README.html
+++ b/docs/file.README.html
@@ -514,7 +514,7 @@ E.g priority 1 will go first, priority 2 will go second, etcetera. </p>
</div></div>
<div id="footer">
- Generated on Wed Dec 29 06:04:54 2021 by
+ Generated on Wed Dec 29 07:21:30 2021 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.26 (ruby-2.7.3).
</div>
diff --git a/docs/index.html b/docs/index.html
index 5038a53..9168208 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -514,7 +514,7 @@ E.g priority 1 will go first, priority 2 will go second, etcetera. </p>
</div></div>
<div id="footer">
- Generated on Wed Dec 29 06:04:54 2021 by
+ Generated on Wed Dec 29 07:21:30 2021 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.26 (ruby-2.7.3).
</div>
diff --git a/docs/method_list.html b/docs/method_list.html
index 4071d1b..b61ff32 100644
--- a/docs/method_list.html
+++ b/docs/method_list.html
@@ -54,21 +54,13 @@
<li class="even ">
<div class="item">
- <span class='object_link'><a href="FelFlame/ComponentManager.html#[]-class_method" title="FelFlame::ComponentManager.[] (method)">[]</a></span>
- <small>FelFlame::ComponentManager</small>
- </div>
- </li>
-
-
- <li class="odd ">
- <div class="item">
<span class='object_link'><a href="FelFlame/Scenes.html#add-instance_method" title="FelFlame::Scenes#add (method)">#add</a></span>
<small>FelFlame::Scenes</small>
</div>
</li>
- <li class="even ">
+ <li class="odd ">
<div class="item">
<span class='object_link'><a href="FelFlame/Stage.html#add-class_method" title="FelFlame::Stage.add (method)">add</a></span>
<small>FelFlame::Stage</small>
@@ -76,7 +68,7 @@
</li>
- <li class="odd ">
+ <li class="even ">
<div class="item">
<span class='object_link'><a href="FelFlame/Entities.html#add-instance_method" title="FelFlame::Entities#add (method)">#add</a></span>
<small>FelFlame::Entities</small>
@@ -84,7 +76,7 @@
</li>
- <li class="even ">
+ <li class="odd ">
<div class="item">
<span class='object_link'><a href="FelFlame/Systems.html#addition_triggers-instance_method" title="FelFlame::Systems#addition_triggers (method)">#addition_triggers</a></span>
<small>FelFlame::Systems</small>
@@ -92,7 +84,7 @@
</li>
- <li class="odd ">
+ <li class="even ">
<div class="item">
<span class='object_link'><a href="FelFlame/ComponentManager.html#addition_triggers-instance_method" title="FelFlame::ComponentManager#addition_triggers (method)">#addition_triggers</a></span>
<small>FelFlame::ComponentManager</small>
@@ -100,7 +92,7 @@
</li>
- <li class="even ">
+ <li class="odd ">
<div class="item">
<span class='object_link'><a href="FelFlame/ComponentManager.html#addition_triggers-class_method" title="FelFlame::ComponentManager.addition_triggers (method)">addition_triggers</a></span>
<small>FelFlame::ComponentManager</small>
@@ -108,7 +100,7 @@
</li>
- <li class="odd ">
+ <li class="even ">
<div class="item">
<span class='object_link'><a href="FelFlame/ComponentManager.html#attr_changed_trigger_systems-instance_method" title="FelFlame::ComponentManager#attr_changed_trigger_systems (method)">#attr_changed_trigger_systems</a></span>
<small>FelFlame::ComponentManager</small>
@@ -116,7 +108,7 @@
</li>
- <li class="even ">
+ <li class="odd ">
<div class="item">
<span class='object_link'><a href="FelFlame/Systems.html#attr_triggers-instance_method" title="FelFlame::Systems#attr_triggers (method)">#attr_triggers</a></span>
<small>FelFlame::Systems</small>
@@ -124,7 +116,7 @@
</li>
- <li class="odd ">
+ <li class="even ">
<div class="item">
<span class='object_link'><a href="FelFlame/ComponentManager.html#attr_triggers-instance_method" title="FelFlame::ComponentManager#attr_triggers (method)">#attr_triggers</a></span>
<small>FelFlame::ComponentManager</small>
@@ -132,7 +124,7 @@
</li>
- <li class="even ">
+ <li class="odd ">
<div class="item">
<span class='object_link'><a href="FelFlame/ComponentManager.html#attr_triggers-class_method" title="FelFlame::ComponentManager.attr_triggers (method)">attr_triggers</a></span>
<small>FelFlame::ComponentManager</small>
@@ -140,7 +132,7 @@
</li>
- <li class="odd ">
+ <li class="even ">
<div class="item">
<span class='object_link'><a href="FelFlame/ComponentManager.html#attrs-instance_method" title="FelFlame::ComponentManager#attrs (method)">#attrs</a></span>
<small>FelFlame::ComponentManager</small>
@@ -148,7 +140,7 @@
</li>
- <li class="even ">
+ <li class="odd ">
<div class="item">
<span class='object_link'><a href="FelFlame.html#call-class_method" title="FelFlame.call (method)">call</a></span>
<small>FelFlame</small>
@@ -156,7 +148,7 @@
</li>
- <li class="odd ">
+ <li class="even ">
<div class="item">
<span class='object_link'><a href="FelFlame/Scenes.html#call-instance_method" title="FelFlame::Scenes#call (method)">#call</a></span>
<small>FelFlame::Scenes</small>
@@ -164,7 +156,7 @@
</li>
- <li class="even ">
+ <li class="odd ">
<div class="item">
<span class='object_link'><a href="FelFlame/Stage.html#call-class_method" title="FelFlame::Stage.call (method)">call</a></span>
<small>FelFlame::Stage</small>
@@ -172,7 +164,7 @@
</li>
- <li class="odd ">
+ <li class="even ">
<div class="item">
<span class='object_link'><a href="FelFlame/Systems.html#call-instance_method" title="FelFlame::Systems#call (method)">#call</a></span>
<small>FelFlame::Systems</small>
@@ -180,7 +172,7 @@
</li>
- <li class="even ">
+ <li class="odd ">
<div class="item">
<span class='object_link'><a href="FelFlame/Scenes.html#clear-instance_method" title="FelFlame::Scenes#clear (method)">#clear</a></span>
<small>FelFlame::Scenes</small>
@@ -188,7 +180,7 @@
</li>
- <li class="odd ">
+ <li class="even ">
<div class="item">
<span class='object_link'><a href="FelFlame/Stage.html#clear-class_method" title="FelFlame::Stage.clear (method)">clear</a></span>
<small>FelFlame::Stage</small>
@@ -196,7 +188,7 @@
</li>
- <li class="even ">
+ <li class="odd ">
<div class="item">
<span class='object_link'><a href="FelFlame/Systems.html#clear_triggers-instance_method" title="FelFlame::Systems#clear_triggers (method)">#clear_triggers</a></span>
<small>FelFlame::Systems</small>
@@ -204,7 +196,7 @@
</li>
- <li class="odd ">
+ <li class="even ">
<div class="item">
<span class='object_link'><a href="FelFlame/Entities.html#components-instance_method" title="FelFlame::Entities#components (method)">#components</a></span>
<small>FelFlame::Entities</small>
@@ -212,7 +204,7 @@
</li>
- <li class="even ">
+ <li class="odd ">
<div class="item">
<span class='object_link'><a href="FelFlame/Scenes.html#const_name-instance_method" title="FelFlame::Scenes#const_name (method)">#const_name</a></span>
<small>FelFlame::Scenes</small>
@@ -220,7 +212,7 @@
</li>
- <li class="odd ">
+ <li class="even ">
<div class="item">
<span class='object_link'><a href="FelFlame/Systems.html#const_name-instance_method" title="FelFlame::Systems#const_name (method)">#const_name</a></span>
<small>FelFlame::Systems</small>
@@ -228,7 +220,7 @@
</li>
- <li class="even ">
+ <li class="odd ">
<div class="item">
<span class='object_link'><a href="FelFlame/Entities.html#delete-instance_method" title="FelFlame::Entities#delete (method)">#delete</a></span>
<small>FelFlame::Entities</small>
@@ -236,7 +228,7 @@
</li>
- <li class="odd ">
+ <li class="even ">
<div class="item">
<span class='object_link'><a href="FelFlame/ComponentManager.html#delete-instance_method" title="FelFlame::ComponentManager#delete (method)">#delete</a></span>
<small>FelFlame::ComponentManager</small>
@@ -244,7 +236,7 @@
</li>
- <li class="even ">
+ <li class="odd ">
<div class="item">
<span class='object_link'><a href="FelFlame/Entities.html#each-class_method" title="FelFlame::Entities.each (method)">each</a></span>
<small>FelFlame::Entities</small>
@@ -252,7 +244,7 @@
</li>
- <li class="odd ">
+ <li class="even ">
<div class="item">
<span class='object_link'><a href="FelFlame/Systems.html#each-class_method" title="FelFlame::Systems.each (method)">each</a></span>
<small>FelFlame::Systems</small>
@@ -260,7 +252,7 @@
</li>
- <li class="even ">
+ <li class="odd ">
<div class="item">
<span class='object_link'><a href="FelFlame/Components.html#each-class_method" title="FelFlame::Components.each (method)">each</a></span>
<small>FelFlame::Components</small>
@@ -268,14 +260,6 @@
</li>
- <li class="odd ">
- <div class="item">
- <span class='object_link'><a href="FelFlame/ComponentManager.html#each-class_method" title="FelFlame::ComponentManager.each (method)">each</a></span>
- <small>FelFlame::ComponentManager</small>
- </div>
- </li>
-
-
<li class="even ">
<div class="item">
<span class='object_link'><a href="FelFlame/ComponentManager.html#entities-instance_method" title="FelFlame::ComponentManager#entities (method)">#entities</a></span>
@@ -334,13 +318,21 @@
<li class="odd ">
<div class="item">
+ <span class='object_link'><a href="FelFlame/ComponentManager.html#method_missing-class_method" title="FelFlame::ComponentManager.method_missing (method)">method_missing</a></span>
+ <small>FelFlame::ComponentManager</small>
+ </div>
+ </li>
+
+
+ <li class="even ">
+ <div class="item">
<span class='object_link'><a href="FelFlame/Components.html#new-class_method" title="FelFlame::Components.new (method)">new</a></span>
<small>FelFlame::Components</small>
</div>
</li>
- <li class="even ">
+ <li class="odd ">
<div class="item">
<span class='object_link'><a href="FelFlame/Systems.html#priority-instance_method" title="FelFlame::Systems#priority (method)">#priority</a></span>
<small>FelFlame::Systems</small>
@@ -348,7 +340,7 @@
</li>
- <li class="odd ">
+ <li class="even ">
<div class="item">
<span class='object_link'><a href="FelFlame/Systems.html#redefine-instance_method" title="FelFlame::Systems#redefine (method)">#redefine</a></span>
<small>FelFlame::Systems</small>
@@ -356,7 +348,7 @@
</li>
- <li class="even ">
+ <li class="odd ">
<div class="item">
<span class='object_link'><a href="FelFlame/Systems.html#removal_triggers-instance_method" title="FelFlame::Systems#removal_triggers (method)">#removal_triggers</a></span>
<small>FelFlame::Systems</small>
@@ -364,7 +356,7 @@
</li>
- <li class="odd ">
+ <li class="even ">
<div class="item">
<span class='object_link'><a href="FelFlame/ComponentManager.html#removal_triggers-instance_method" title="FelFlame::ComponentManager#removal_triggers (method)">#removal_triggers</a></span>
<small>FelFlame::ComponentManager</small>
@@ -372,7 +364,7 @@
</li>
- <li class="even ">
+ <li class="odd ">
<div class="item">
<span class='object_link'><a href="FelFlame/ComponentManager.html#removal_triggers-class_method" title="FelFlame::ComponentManager.removal_triggers (method)">removal_triggers</a></span>
<small>FelFlame::ComponentManager</small>
@@ -380,7 +372,7 @@
</li>
- <li class="odd ">
+ <li class="even ">
<div class="item">
<span class='object_link'><a href="FelFlame/Scenes.html#remove-instance_method" title="FelFlame::Scenes#remove (method)">#remove</a></span>
<small>FelFlame::Scenes</small>
@@ -388,7 +380,7 @@
</li>
- <li class="even ">
+ <li class="odd ">
<div class="item">
<span class='object_link'><a href="FelFlame/Stage.html#remove-class_method" title="FelFlame::Stage.remove (method)">remove</a></span>
<small>FelFlame::Stage</small>
@@ -396,7 +388,7 @@
</li>
- <li class="odd ">
+ <li class="even ">
<div class="item">
<span class='object_link'><a href="FelFlame/Entities.html#remove-instance_method" title="FelFlame::Entities#remove (method)">#remove</a></span>
<small>FelFlame::Entities</small>
@@ -404,7 +396,7 @@
</li>
- <li class="even ">
+ <li class="odd ">
<div class="item">
<span class='object_link'><a href="FelFlame/Stage.html#scenes-class_method" title="FelFlame::Stage.scenes (method)">scenes</a></span>
<small>FelFlame::Stage</small>
@@ -412,7 +404,7 @@
</li>
- <li class="odd ">
+ <li class="even ">
<div class="item">
<span class='object_link'><a href="FelFlame/Scenes.html#systems-instance_method" title="FelFlame::Scenes#systems (method)">#systems</a></span>
<small>FelFlame::Scenes</small>
@@ -420,7 +412,7 @@
</li>
- <li class="even ">
+ <li class="odd ">
<div class="item">
<span class='object_link'><a href="FelFlame/Entities.html#to_i-instance_method" title="FelFlame::Entities#to_i (method)">#to_i</a></span>
<small>FelFlame::Entities</small>
@@ -428,7 +420,7 @@
</li>
- <li class="odd ">
+ <li class="even ">
<div class="item">
<span class='object_link'><a href="FelFlame/ComponentManager.html#to_i-instance_method" title="FelFlame::ComponentManager#to_i (method)">#to_i</a></span>
<small>FelFlame::ComponentManager</small>
@@ -436,7 +428,7 @@
</li>
- <li class="even ">
+ <li class="odd ">
<div class="item">
<span class='object_link'><a href="FelFlame/Systems.html#trigger_when_added-instance_method" title="FelFlame::Systems#trigger_when_added (method)">#trigger_when_added</a></span>
<small>FelFlame::Systems</small>
@@ -444,7 +436,7 @@
</li>
- <li class="odd ">
+ <li class="even ">
<div class="item">
<span class='object_link'><a href="FelFlame/Systems.html#trigger_when_is_changed-instance_method" title="FelFlame::Systems#trigger_when_is_changed (method)">#trigger_when_is_changed</a></span>
<small>FelFlame::Systems</small>
@@ -452,7 +444,7 @@
</li>
- <li class="even ">
+ <li class="odd ">
<div class="item">
<span class='object_link'><a href="FelFlame/Systems.html#trigger_when_removed-instance_method" title="FelFlame::Systems#trigger_when_removed (method)">#trigger_when_removed</a></span>
<small>FelFlame::Systems</small>
@@ -460,7 +452,7 @@
</li>
- <li class="odd ">
+ <li class="even ">
<div class="item">
<span class='object_link'><a href="FelFlame/ComponentManager.html#update_attrs-instance_method" title="FelFlame::ComponentManager#update_attrs (method)">#update_attrs</a></span>
<small>FelFlame::ComponentManager</small>
diff --git a/docs/top-level-namespace.html b/docs/top-level-namespace.html
index 7e418d2..4275c26 100644
--- a/docs/top-level-namespace.html
+++ b/docs/top-level-namespace.html
@@ -129,7 +129,7 @@
</div>
<div id="footer">
- Generated on Wed Dec 29 06:04:54 2021 by
+ Generated on Wed Dec 29 07:21:30 2021 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.26 (ruby-2.7.3).
</div>
diff --git a/lib/felflame/component_manager.rb b/lib/felflame/component_manager.rb
index 43932d2..2fa4949 100644
--- a/lib/felflame/component_manager.rb
+++ b/lib/felflame/component_manager.rb
@@ -60,13 +60,13 @@ class FelFlame
# Holds the {id unique ID} of a component. The {id ID} is only unique within the scope of the component manager it was created from.
# @return [Integer]
- attr_reader :id
+ #attr_reader :id
# A seperate attr_writer was made for documentation readability reasons.
# Yard will list attr_reader is readonly which is my intention.
# This value needs to be changable as it is set by other functions.
# @!visibility private
- attr_writer :id
+ #attr_writer :id
# Allows overwriting the storage of triggers, such as for clearing.
# This method should generally only need to be used internally and
@@ -108,9 +108,9 @@ class FelFlame
set_defaults
# Generate ID
- new_id = self.class.data.find_index { |i| i.nil? }
- new_id = self.class.data.size if new_id.nil?
- @id = new_id
+ #new_id = self.class.data.find_index { |i| i.nil? }
+ #new_id = self.class.data.size if new_id.nil?
+ #@id = new_id
# Fill params
attrs.each do |key, value|
@@ -118,11 +118,23 @@ class FelFlame
end
# Save Component
- self.class.data[new_id] = self
+ #self.class.data[new_id] = self
+ self.class.push self
end
class <<self
+ # Allows using the manager as an array of components. Forwards any
+ # method calls to the array stored in the component manager
+ def respond_to_missing?(method, *args, &block)
+ puts 'got here'
+ if self.data.respond_to? method
+ self.data.send(symbol, *args, &block)
+ else
+ super
+ end
+ end
+
# Allows overwriting the storage of triggers, such as for clearing.
# This method should generally only need to be used internally and
# not by a game developer.
@@ -166,23 +178,23 @@ class FelFlame
# FelFlame::Components::Health[7]
# @param component_id [Integer]
# @return [Component] Returns the Component that uses the given unique {id ID}, nil if there is no Component associated with the given {id ID}
- def [](component_id)
- data[component_id]
- end
+ #def [](component_id)
+ # data[component_id]
+ #end
# Iterates over all components within the component manager.
# Special Enumerable methods like +map+ or +each_with_index+ are not implemented
# @return [Enumerator]
- def each(&block)
- data.compact.each(&block)
- end
+ #def each(&block)
+ # data.compact.each(&block)
+ #end
end
# An alias for the {id ID Reader}
# @return [Integer]
- def to_i
- id
- end
+ #def to_i
+ # id
+ #end
# A list of entity ids that are linked to the component
# @return [Array<Integer>]
@@ -224,7 +236,7 @@ class FelFlame
#FelFlame::Entities[entity_id].remove self #unless FelFlame::Entities[entity_id].nil?
entity.remove self
end
- self.class.data[id] = nil
+ self.class.delete self
instance_variables.each do |var|
instance_variable_set(var, nil)
end
diff --git a/spec/component_manager_spec.rb b/spec/component_manager_spec.rb
index d99d744..203d185 100644
--- a/spec/component_manager_spec.rb
+++ b/spec/component_manager_spec.rb
@@ -25,16 +25,17 @@ describe 'Components' do
end
it 'can delete a component' do
- component_id = @cmp1.id
+ #component_id = @cmp1.id
@ent0.add @cmp1
-
+ length = @component_manager.length
expect(@cmp1.delete).to be true
- expect(@cmp1.id).to be_nil
- expect(@component_manager[component_id]).to be_nil
+ expect(@component_manager.length).to eq(length-1)
+ #expect(@cmp1.id).to be_nil
+ #expect(@component_manager[component_id]).to be_nil
expect(@cmp1.entities).to eq([])
end
- it 'can iterate over all component managers' do
+ it 'can iterate component managers' do
all_components = FelFlame::Components.constants
expect(all_components.length).to be > 0
expect(FelFlame::Components.each).to be_an Enumerator
@@ -46,7 +47,7 @@ describe 'Components' do
it 'can change params on initialization' do
@cmp3 = @component_manager.new(param1: 'ok', param2: 10)
- expect(@cmp3.attrs).to eq(param1: 'ok', param2: 10, id: @cmp3.id)
+ expect(@cmp3.attrs).to eq(param1: 'ok', param2: 10)
end
@@ -60,28 +61,32 @@ describe 'Components' do
end
it 'can read attrs' do
- expect(@cmp0.attrs).to eq(param2: 'def', id: 0)
- expect(@cmp1.attrs).to eq(param2: 'def', id: 1)
- expect(@cmp2.attrs).to eq(param2: 'def', id: 2)
+ expect(@cmp0.attrs).to eq(param2: 'def')
+ expect(@cmp1.attrs).to eq(param2: 'def')
+ expect(@cmp2.attrs).to eq(param2: 'def')
end
it 'can set attrs' do
expect(@cmp0.param1 = 4).to eq(4)
expect(@cmp1.update_attrs(param1: 3, param2: 'new')).to eq(param1: 3, param2: 'new')
- expect(@cmp1.attrs).to eq(param1: 3, param2: 'new', id: 1)
+ expect(@cmp1.attrs).to eq(param1: 3, param2: 'new')
end
- it 'can be accessed' do
- expect(@cmp0).to eq(@component_manager[0])
- expect(@cmp1).to eq(@component_manager[1])
- expect(@cmp2).to eq(@component_manager[2])
+ it 'can be used as a singleton' do
+ expect(@component_manager.first).to eq(@cmp0)
end
- it 'can get id from to_i' do
- expect(@cmp0.id).to eq(@cmp0.to_i)
- expect(@cmp1.id).to eq(@cmp1.to_i)
- expect(@cmp2.id).to eq(@cmp2.to_i)
- end
+ #it 'can be accessed' do
+ # expect(@cmp0).to eq(@component_manager[0])
+ # expect(@cmp1).to eq(@component_manager[1])
+ # expect(@cmp2).to eq(@component_manager[2])
+ #end
+
+ #it 'can get id from to_i' do
+ # expect(@cmp0.id).to eq(@cmp0.to_i)
+ # expect(@cmp1.id).to eq(@cmp1.to_i)
+ # expect(@cmp2.id).to eq(@cmp2.to_i)
+ #end
it 'cant overwrite exiting component managers' do
FelFlame::Components.new('TestComponent1')
@@ -89,7 +94,7 @@ describe 'Components' do
end
it 'can\'t create an attribute when its name is an existing method' do
- expect { FelFlame::Components.new('TestComponent2', :id) }.to raise_error(NameError)
+ #expect { FelFlame::Components.new('TestComponent2', :id) }.to raise_error(NameError)
expect { FelFlame::Components.new('TestComponent2', :addition_triggers) }.to raise_error(NameError)
expect { FelFlame::Components.new('TestComponent2', :removal_triggers) }.to raise_error(NameError)
expect { FelFlame::Components.new('TestComponent2', :attr_triggers) }.to raise_error(NameError)
diff --git a/spec/entity_manager_spec.rb b/spec/entity_manager_spec.rb
index ef638c0..7bf941d 100644
--- a/spec/entity_manager_spec.rb
+++ b/spec/entity_manager_spec.rb
@@ -9,6 +9,7 @@ describe 'Entities' do
#end
before :all do
+ $VERBOSE = nil
@component_manager ||= FelFlame::Components.new('TestEntity', :param1, param2: 'def')
end
@@ -32,17 +33,17 @@ describe 'Entities' do
expect(@ent0.components[@component_manager].count).to eq(2)
end
- it 'has correct ID\'s' do
- expect(@ent0.id).to eq(0)
- expect(@ent1.id).to eq(1)
- expect(@ent2.id).to eq(2)
- end
+ #it 'has correct ID\'s' do
+ # expect(@ent0.id).to eq(0)
+ # expect(@ent1.id).to eq(1)
+ # expect(@ent2.id).to eq(2)
+ #end
- it 'can be accessed' do
- expect(@ent0).to eq(FelFlame::Entities[0])
- expect(@ent1).to eq(FelFlame::Entities[1])
- expect(@ent2).to eq(FelFlame::Entities[2])
- end
+ #it 'can be accessed' do
+ # expect(@ent0).to eq(FelFlame::Entities[0])
+ # expect(@ent1).to eq(FelFlame::Entities[1])
+ # expect(@ent2).to eq(FelFlame::Entities[2])
+ #end
it 'can have components attached' do
@ent0.add @cmp0
@@ -82,10 +83,15 @@ describe 'Entities' do
@cmp1.delete
expect(@ent0.components).to eq({@component_manager => [@cmp0,@cmp2]})
@component_manager.each(&:delete)
- expect(@component_manager.each.to_a).to eq([])
+ $stderr.puts ('HERE HERE ' * 5)
+ $stderr.puts @component_manager
+ @component_manager.each do |component|
+ $stderr.puts component
+ end
+ expect(@component_manager.empty?).to be true
expect(@ent0.components).to eq({@component_manager => []})
expect(@ent2.components).to eq({@component_manager => []})
FelFlame::Entities.each(&:delete)
- expect(FelFlame::Entities.each.to_a).to eq([])
+ expect(FelFlame::Entities.empty?).to be true
end
end