summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorrealtradam <[email protected]>2021-06-12 00:57:04 -0400
committerrealtradam <[email protected]>2021-06-12 00:57:04 -0400
commit8dcacf9e69214f66be09c120ba474b848047cb53 (patch)
tree43692e58a42632fd5fe069bcc3ab4bab96340ece
parent3ad8d2531329c1696a2bf86db8db9237309281ab (diff)
downloadFelECS-8dcacf9e69214f66be09c120ba474b848047cb53.tar.gz
FelECS-8dcacf9e69214f66be09c120ba474b848047cb53.zip
unit testing and cleanup
-rw-r--r--Gemfile2
-rw-r--r--Gemfile.lock23
-rw-r--r--Rakefile11
-rw-r--r--component_manager.rb64
-rw-r--r--docs/FelFlame.html2
-rw-r--r--docs/FelFlame/Components.html22
-rw-r--r--docs/FelFlame/Entities.html144
-rw-r--r--docs/FelFlame/Helper.html2
-rw-r--r--docs/FelFlame/Helper/ComponentManager.html338
-rw-r--r--docs/FelFlame/Systems.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.html12
-rw-r--r--docs/top-level-namespace.html2
-rw-r--r--entity_manager.rb67
-rw-r--r--helpers/00_tileset.rb7
-rw-r--r--helpers/01_component.rb11
-rw-r--r--tests/_test_helper.rb35
-rw-r--r--tests/_test_sample.rb14
-rw-r--r--tests/component_manager_test.rb62
-rw-r--r--tests/entity_manager_test.rb52
-rw-r--r--tests/felflame_test.rb45
-rw-r--r--tests/scene_manager_test.rb15
-rw-r--r--tests/stage_manager_test.rb15
-rw-r--r--tests/system_manager_test.rb15
26 files changed, 388 insertions, 580 deletions
diff --git a/Gemfile b/Gemfile
index d7a8e7f..34f0141 100644
--- a/Gemfile
+++ b/Gemfile
@@ -4,7 +4,9 @@ ruby '2.7.3'
group :test do
gem 'minitest-reporters', '~> 1.4', '>= 1.4.3', require: false
+ gem 'rspec', '~> 3.10'
gem 'simplecov', '~> 0.21.2', require: false
+ gem 'simplecov-console', '~> 0.9.1'
gem 'simplecov_json_formatter', '~> 0.1.3', require: false
end
diff --git a/Gemfile.lock b/Gemfile.lock
index c52c5d9..5339f9e 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -3,6 +3,7 @@ GEM
specs:
ansi (1.5.0)
builder (3.2.4)
+ diff-lcs (1.4.4)
docile (1.4.0)
minitest (5.14.4)
minitest-reporters (1.4.3)
@@ -11,13 +12,33 @@ GEM
minitest (>= 5.0)
ruby-progressbar
redcarpet (3.5.1)
+ rspec (3.10.0)
+ rspec-core (~> 3.10.0)
+ rspec-expectations (~> 3.10.0)
+ rspec-mocks (~> 3.10.0)
+ rspec-core (3.10.1)
+ rspec-support (~> 3.10.0)
+ rspec-expectations (3.10.1)
+ diff-lcs (>= 1.2.0, < 2.0)
+ rspec-support (~> 3.10.0)
+ rspec-mocks (3.10.2)
+ diff-lcs (>= 1.2.0, < 2.0)
+ rspec-support (~> 3.10.0)
+ rspec-support (3.10.2)
ruby-progressbar (1.11.0)
simplecov (0.21.2)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
+ simplecov-console (0.9.1)
+ ansi
+ simplecov
+ terminal-table
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.3)
+ terminal-table (3.0.1)
+ unicode-display_width (>= 1.1.1, < 3)
+ unicode-display_width (2.0.0)
yard (0.9.26)
PLATFORMS
@@ -26,7 +47,9 @@ PLATFORMS
DEPENDENCIES
minitest-reporters (~> 1.4, >= 1.4.3)
redcarpet (~> 3.5, >= 3.5.1)
+ rspec (~> 3.10)
simplecov (~> 0.21.2)
+ simplecov-console (~> 0.9.1)
simplecov_json_formatter (~> 0.1.3)
yard (~> 0.9.26)
diff --git a/Rakefile b/Rakefile
index ff0dcc8..f84e93f 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,5 +1,6 @@
-require 'rake/testtask'
+#require 'rake/testtask'
+require 'rspec/core/rake_task'
require 'yard'
require_relative './codeclimate/export-coverage'
@@ -21,6 +22,8 @@ YARD::Rake::YardocTask.new do |t|
t.stats_options = ['--list-undoc']
end
-Rake::TestTask.new do |t|
- t.pattern = "tests/**/*_test.rb"
-end
+#Rake::TestTask.new do |t|
+# t.pattern = "tests/**/*_test.rb"
+#end
+
+RSpec::Core::RakeTask.new :spec
diff --git a/component_manager.rb b/component_manager.rb
index a7dd423..f4402b3 100644
--- a/component_manager.rb
+++ b/component_manager.rb
@@ -21,6 +21,10 @@ class FelFlame
# @param attrs_with_defaults [Keyword: DefaultValue] New components made with this manager will include these keywords as accessors, their defaults set to the values given to the keywords
# @return [ComponentManager]
def new(component_name, *attrs, **attrs_with_defaults)
+ if FelFlame::Components.const_defined?(component_name)
+ raise(NameError.new, "Component Manager '#{component_name}' is already defined")
+ end
+
const_set(component_name, Class.new(FelFlame::Helper::ComponentManager) {})
attrs.each do |attr|
FelFlame::Components.const_get(component_name).attr_accessor attr
@@ -28,7 +32,7 @@ class FelFlame
attrs_with_defaults.each do |attr, _default|
FelFlame::Components.const_get(component_name).attr_accessor attr
end
- FelFlame::Components.const_get(component_name).define_method(:initialize) do
+ FelFlame::Components.const_get(component_name).define_method(:set_defaults) do
attrs_with_defaults.each do |attr, default|
instance_variable_set("@#{attr}", default)
end
@@ -52,8 +56,31 @@ class FelFlame
# @return [Integer]
attr_accessor :id
+ # Creates a new component and sets the values of the attributes given to it. If an attritbute is not passed then it will remain as the default.
+ # @param attrs [Keyword: Value] You can pass any number of Keyword-Value pairs
+ # @return [Component]
+ def initialize(**attrs)
+ # Prepare the object
+ # (this is a function created with metaprogramming
+ # in FelFlame::Components
+ 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
+
+ # Fill params
+ attrs.each do |key, value|
+ send "#{key}=", value
+ end
+
+ # Save Component
+ self.class.data[new_id] = self
+ end
+
class <<self
- # @return [Array] Array of all Components that belong to a given component manager
+ # @return [Array<Component>] Array of all Components that belong to a given component manager
# @!visibility private
def data
@data ||= []
@@ -70,32 +97,11 @@ class FelFlame
data[component_id]
end
- # Creates a new component and sets the values of the attributes given to it. If an attritbute is not passed then it will remain as the default.
- # @param attrs [Keyword: Value]
- # @return [Component]
- def new(**attrs)
- new_component = super
-
- # Generate ID
- new_id = self.data.find_index { |i| i.nil? }
- new_id = self.data.size if new_id.nil?
- new_component.id = new_id
-
- # Fill params
- attrs.each do |key, value|
- new_component.send "#{key}=", value
- end
-
- # Save Component
- data[new_id] = new_component
- end
-
- # Iterates over all components within the component manager
+ # Iterates over all components within the component manager.
+ # Special Enumerable methods like +map+ or +each_with_index+ are not implemented
# @return [Enumerator]
- def each
- data.each do |component|
- yield component
- end
+ def each(&block)
+ data.compact.each(&block)
end
end
@@ -105,8 +111,8 @@ class FelFlame
id
end
- # A list of components that are linked to the component
- # @return [Array]
+ # A list of entity ids that are linked to the component
+ # @return [Array<Integer>]
def entities
@entities ||= []
end
diff --git a/docs/FelFlame.html b/docs/FelFlame.html
index e9ab145..b49faea 100644
--- a/docs/FelFlame.html
+++ b/docs/FelFlame.html
@@ -193,7 +193,7 @@
</div>
<div id="footer">
- Generated on Fri Jun 11 01:49:32 2021 by
+ Generated on Sat Jun 12 00:56:07 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 633c5fb..9c6c0c7 100644
--- a/docs/FelFlame/Components.html
+++ b/docs/FelFlame/Components.html
@@ -233,12 +233,12 @@
<pre class="lines">
-41
-42
-43</pre>
+45
+46
+47</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'component_manager.rb', line 41</span>
+ <pre class="code"><span class="info file"># File 'component_manager.rb', line 45</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_constants'>constants</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>
@@ -365,12 +365,20 @@
34
35
36
-37</pre>
+37
+38
+39
+40
+41</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'component_manager.rb', line 23</span>
<span class='kw'>def</span> <span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_component_name'>component_name</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_attrs'>attrs</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_attrs_with_defaults'>attrs_with_defaults</span><span class='rparen'>)</span>
+ <span class='kw'>if</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="" title="FelFlame::Components (class)">Components</a></span></span><span class='period'>.</span><span class='id identifier rubyid_const_defined?'>const_defined?</span><span class='lparen'>(</span><span class='id identifier rubyid_component_name'>component_name</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_raise'>raise</span><span class='lparen'>(</span><span class='const'>NameError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Component Manager &#39;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_component_name'>component_name</span><span class='embexpr_end'>}</span><span class='tstring_content'>&#39; is already defined</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
+ <span class='kw'>end</span>
+
<span class='id identifier rubyid_const_set'>const_set</span><span class='lparen'>(</span><span class='id identifier rubyid_component_name'>component_name</span><span class='comma'>,</span> <span class='const'>Class</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</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="Helper.html" title="FelFlame::Helper (class)">Helper</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Helper/ComponentManager.html" title="FelFlame::Helper::ComponentManager (class)">ComponentManager</a></span></span><span class='rparen'>)</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
<span class='id identifier rubyid_attrs'>attrs</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_attr'>attr</span><span class='op'>|</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="" title="FelFlame::Components (class)">Components</a></span></span><span class='period'>.</span><span class='id identifier rubyid_const_get'>const_get</span><span class='lparen'>(</span><span class='id identifier rubyid_component_name'>component_name</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='id identifier rubyid_attr'>attr</span>
@@ -378,7 +386,7 @@
<span class='id identifier rubyid_attrs_with_defaults'>attrs_with_defaults</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_attr'>attr</span><span class='comma'>,</span> <span class='id identifier rubyid__default'>_default</span><span class='op'>|</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="" title="FelFlame::Components (class)">Components</a></span></span><span class='period'>.</span><span class='id identifier rubyid_const_get'>const_get</span><span class='lparen'>(</span><span class='id identifier rubyid_component_name'>component_name</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='id identifier rubyid_attr'>attr</span>
<span class='kw'>end</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="" title="FelFlame::Components (class)">Components</a></span></span><span class='period'>.</span><span class='id identifier rubyid_const_get'>const_get</span><span class='lparen'>(</span><span class='id identifier rubyid_component_name'>component_name</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_define_method'>define_method</span><span class='lparen'>(</span><span class='symbol'>:initialize</span><span class='rparen'>)</span> <span class='kw'>do</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="" title="FelFlame::Components (class)">Components</a></span></span><span class='period'>.</span><span class='id identifier rubyid_const_get'>const_get</span><span class='lparen'>(</span><span class='id identifier rubyid_component_name'>component_name</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_define_method'>define_method</span><span class='lparen'>(</span><span class='symbol'>:set_defaults</span><span class='rparen'>)</span> <span class='kw'>do</span>
<span class='id identifier rubyid_attrs_with_defaults'>attrs_with_defaults</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_attr'>attr</span><span class='comma'>,</span> <span class='id identifier rubyid_default'>default</span><span class='op'>|</span>
<span class='id identifier rubyid_instance_variable_set'>instance_variable_set</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>@</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_attr'>attr</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_default'>default</span><span class='rparen'>)</span>
<span class='kw'>end</span>
@@ -395,7 +403,7 @@
</div>
<div id="footer">
- Generated on Fri Jun 11 01:49:32 2021 by
+ Generated on Sat Jun 12 00:56:07 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 4ba4d6f..38898a8 100644
--- a/docs/FelFlame/Entities.html
+++ b/docs/FelFlame/Entities.html
@@ -250,7 +250,7 @@
<li class="public ">
<span class="summary_signature">
- <a href="#add-instance_method" title="#add (instance method)">#<strong>add</strong>(component) &#x21d2; Boolean </a>
+ <a href="#add-instance_method" title="#add (instance method)">#<strong>add</strong>(*components_to_add) &#x21d2; Boolean </a>
@@ -265,7 +265,7 @@
<span class="summary_desc"><div class='inline'>
-<p>Returns true when added, or false if it already belongs to the Entity Add a component to the Entity.</p>
+<p>Add any number components to the Entity.</p>
</div></span>
</li>
@@ -348,7 +348,7 @@
<li class="public ">
<span class="summary_signature">
- <a href="#remove-instance_method" title="#remove (instance method)">#<strong>remove</strong>(component) &#x21d2; Boolean </a>
+ <a href="#remove-instance_method" title="#remove (instance method)">#<strong>remove</strong>(*components_to_remove) &#x21d2; Boolean </a>
@@ -481,21 +481,25 @@
18
19
20
-21</pre>
+21
+22
+23</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'entity_manager.rb', line 10</span>
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_components'>components</span><span class='rparen'>)</span>
<span class='comment'># Assign new unique ID
-</span> <span class='id identifier rubyid_new_id'>new_id</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_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_find_index'>find_index</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_i'>i</span><span class='op'>|</span> <span class='id identifier rubyid_i'>i</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='rbrace'>}</span>
+</span> <span class='id identifier rubyid_new_id'>new_id</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_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_find_index'>find_index</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:nil?</span><span class='rparen'>)</span>
<span class='id identifier rubyid_new_id'>new_id</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_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span> <span class='kw'>if</span> <span class='id identifier rubyid_new_id'>new_id</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span> <span class='op'>=</span> <span class='id identifier rubyid_new_id'>new_id</span>
<span class='comment'># Add each component
-</span> <span class='id identifier rubyid_components'>components</span><span class='period'>.</span><span class='id identifier rubyid_uniq'>uniq</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_component'>component</span><span class='op'>|</span>
- <span class='id identifier rubyid_add'>add</span> <span class='id identifier rubyid_component'>component</span>
- <span class='kw'>end</span>
+</span> <span class='comment'>#components.uniq.each do |component|
+</span> <span class='comment'># add component
+</span> <span class='comment'>#end
+</span> <span class='id identifier rubyid_add'>add</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_components'>components</span><span class='rparen'>)</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_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_id'>id</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>self</span>
<span class='kw'>end</span></pre>
</td>
@@ -639,12 +643,12 @@
<pre class="lines">
-103
104
-105</pre>
+105
+106</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'entity_manager.rb', line 103</span>
+ <pre class="code"><span class="info file"># File 'entity_manager.rb', line 104</span>
<span class='kw'>def</span> <span class='op'>[]</span><span class='lparen'>(</span><span class='id identifier rubyid_entity_id'>entity_id</span><span class='rparen'>)</span>
<span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_entity_id'>entity_id</span><span class='rbracket'>]</span>
@@ -693,12 +697,12 @@
<pre class="lines">
-110
111
-112</pre>
+112
+113</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'entity_manager.rb', line 110</span>
+ <pre class="code"><span class="info file"># File 'entity_manager.rb', line 111</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_each'>each</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
@@ -770,10 +774,10 @@
<pre class="lines">
-118</pre>
+119</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'entity_manager.rb', line 118</span>
+ <pre class="code"><span class="info file"># File 'entity_manager.rb', line 119</span>
<span class='kw'>def</span> <span class='id identifier rubyid_from_json'>from_json</span><span class='lparen'>(</span><span class='id identifier rubyid_json_string'>json_string</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span> <span class='kw'>end</span></pre>
</td>
@@ -790,7 +794,7 @@
<div class="method_details first">
<h3 class="signature first" id="add-instance_method">
- #<strong>add</strong>(component) &#x21d2; <tt>Boolean</tt>
+ #<strong>add</strong>(*components_to_add) &#x21d2; <tt>Boolean</tt>
@@ -799,7 +803,7 @@
</h3><div class="docstring">
<div class="discussion">
-<p>Returns true when added, or false if it already belongs to the Entity Add a component to the Entity</p>
+<p>Add any number components to the Entity.</p>
</div>
@@ -819,7 +823,7 @@
&mdash;
<div class='inline'>
-<p>A component created from any component manager</p>
+<p>Any number of components created from any component manager</p>
</div>
</li>
@@ -838,7 +842,7 @@
&mdash;
<div class='inline'>
-<p>true if component is added, false if it already is attached</p>
+<p>true if component is added, false if it already is attached or no components given</p>
</div>
</li>
@@ -851,6 +855,9 @@
<pre class="lines">
+54
+55
+56
57
58
59
@@ -862,24 +869,25 @@
65
66
67
-68
-69</pre>
+68</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'entity_manager.rb', line 57</span>
-
-<span class='kw'>def</span> <span class='id identifier rubyid_add'>add</span><span class='lparen'>(</span><span class='id identifier rubyid_component'>component</span><span class='rparen'>)</span>
- <span class='kw'>if</span> <span class='id identifier rubyid_components'>components</span><span class='lbracket'>[</span><span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
- <span class='id identifier rubyid_components'>components</span><span class='lbracket'>[</span><span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span><span class='rbracket'>]</span>
- <span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_entities'>entities</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span> <span class='id identifier rubyid_id'>id</span>
- <span class='kw'>true</span>
- <span class='kw'>elsif</span> <span class='op'>!</span><span class='id identifier rubyid_components'>components</span><span class='lbracket'>[</span><span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span> <span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span>
- <span class='id identifier rubyid_components'>components</span><span class='lbracket'>[</span><span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span> <span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span>
- <span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_entities'>entities</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span> <span class='id identifier rubyid_id'>id</span>
- <span class='kw'>true</span>
- <span class='kw'>else</span>
- <span class='kw'>false</span>
+ <pre class="code"><span class="info file"># File 'entity_manager.rb', line 54</span>
+
+<span class='kw'>def</span> <span class='id identifier rubyid_add'>add</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_components_to_add'>components_to_add</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_added'>added</span> <span class='op'>=</span> <span class='kw'>false</span>
+ <span class='id identifier rubyid_components_to_add'>components_to_add</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_component'>component</span><span class='op'>|</span>
+ <span class='kw'>if</span> <span class='id identifier rubyid_components'>components</span><span class='lbracket'>[</span><span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
+ <span class='id identifier rubyid_components'>components</span><span class='lbracket'>[</span><span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span><span class='rbracket'>]</span>
+ <span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_entities'>entities</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span> <span class='id identifier rubyid_id'>id</span>
+ <span class='id identifier rubyid_added'>added</span> <span class='op'>=</span><span class='kw'>true</span>
+ <span class='kw'>elsif</span> <span class='op'>!</span><span class='id identifier rubyid_components'>components</span><span class='lbracket'>[</span><span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span> <span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span>
+ <span class='id identifier rubyid_components'>components</span><span class='lbracket'>[</span><span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span> <span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span>
+ <span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_entities'>entities</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span> <span class='id identifier rubyid_id'>id</span>
+ <span class='id identifier rubyid_added'>added</span> <span class='op'>=</span> <span class='kw'>true</span>
+ <span class='kw'>end</span>
<span class='kw'>end</span>
+ <span class='id identifier rubyid_added'>added</span>
<span class='kw'>end</span></pre>
</td>
</tr>
@@ -925,12 +933,12 @@
<pre class="lines">
-25
-26
-27</pre>
+27
+28
+29</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'entity_manager.rb', line 25</span>
+ <pre class="code"><span class="info file"># File 'entity_manager.rb', line 27</span>
<span class='kw'>def</span> <span class='id identifier rubyid_components'>components</span>
<span class='ivar'>@components</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
@@ -984,8 +992,6 @@
<pre class="lines">
-37
-38
39
40
41
@@ -996,22 +1002,16 @@
46
47
48
-49
-50
-51</pre>
+49</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'entity_manager.rb', line 37</span>
+ <pre class="code"><span class="info file"># File 'entity_manager.rb', line 39</span>
<span class='kw'>def</span> <span class='id identifier rubyid_delete'>delete</span>
<span class='id identifier rubyid_components'>components</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_component_manager'>component_manager</span><span class='comma'>,</span> <span class='id identifier rubyid_component_array'>component_array</span><span class='op'>|</span>
<span class='id identifier rubyid_component_array'>component_array</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_component_id'>component_id</span><span class='op'>|</span>
- <span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='period'>.</span><span class='id identifier rubyid_const_get'>const_get</span><span class='lparen'>(</span>
- <span class='id identifier rubyid_component_manager'>component_manager</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_delete_prefix'>delete_prefix</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>FelFlame::</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
- <span class='rparen'>)</span><span class='lbracket'>[</span><span class='id identifier rubyid_component_id'>component_id</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_entities'>entities</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_id'>id</span><span class='rparen'>)</span>
- <span class='comment'># The following is neater, but doesnt work for some reason :/
-</span> <span class='comment'>#Object.const_get(component_manager)[component_id].entities.delete(id)
-</span> <span class='kw'>end</span>
+ <span class='id identifier rubyid_component_manager'>component_manager</span><span class='lbracket'>[</span><span class='id identifier rubyid_component_id'>component_id</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_entities'>entities</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_id'>id</span><span class='rparen'>)</span>
+ <span class='kw'>end</span>
<span class='kw'>end</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="" title="FelFlame::Entities (class)">Entities</a></span></span><span class='period'>.</span><span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_id'>id</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>nil</span>
<span class='ivar'>@id</span> <span class='op'>=</span> <span class='kw'>nil</span>
@@ -1026,7 +1026,7 @@
<div class="method_details ">
<h3 class="signature " id="remove-instance_method">
- #<strong>remove</strong>(component) &#x21d2; <tt>Boolean</tt>
+ #<strong>remove</strong>(*components_to_remove) &#x21d2; <tt>Boolean</tt>
@@ -1046,7 +1046,7 @@
<li>
- <span class='name'>component</span>
+ <span class='name'>component_to_remove</span>
<span class='type'>(<tt>Component</tt>)</span>
@@ -1074,7 +1074,7 @@
&mdash;
<div class='inline'>
-<p>true if component is removed, false if it wasnt attached to component</p>
+<p>true if at least one component is removed, false if none of them were attached to the component</p>
</div>
</li>
@@ -1087,6 +1087,7 @@
<pre class="lines">
+73
74
75
76
@@ -1094,18 +1095,21 @@
78
79
80
-81</pre>
+81
+82</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'entity_manager.rb', line 74</span>
-
-<span class='kw'>def</span> <span class='id identifier rubyid_remove'>remove</span><span class='lparen'>(</span><span class='id identifier rubyid_component'>component</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_components'>components</span><span class='lbracket'>[</span><span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span>
- <span class='kw'>if</span> <span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_entities'>entities</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='id identifier rubyid_id'>id</span>
- <span class='kw'>true</span>
- <span class='kw'>else</span>
- <span class='kw'>false</span>
+ <pre class="code"><span class="info file"># File 'entity_manager.rb', line 73</span>
+
+<span class='kw'>def</span> <span class='id identifier rubyid_remove'>remove</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_components_to_remove'>components_to_remove</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_removed'>removed</span> <span class='op'>=</span> <span class='kw'>false</span>
+ <span class='id identifier rubyid_components_to_remove'>components_to_remove</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_component'>component</span><span class='op'>|</span>
+ <span class='id identifier rubyid_components'>components</span><span class='lbracket'>[</span><span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span>
+ <span class='kw'>if</span> <span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_entities'>entities</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='id identifier rubyid_id'>id</span>
+ <span class='id identifier rubyid_removed'>removed</span> <span class='op'>=</span> <span class='kw'>true</span>
+ <span class='kw'>end</span>
<span class='kw'>end</span>
+ <span class='id identifier rubyid_removed'>removed</span>
<span class='kw'>end</span></pre>
</td>
</tr>
@@ -1151,12 +1155,12 @@
<pre class="lines">
-31
-32
-33</pre>
+33
+34
+35</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'entity_manager.rb', line 31</span>
+ <pre class="code"><span class="info file"># File 'entity_manager.rb', line 33</span>
<span class='kw'>def</span> <span class='id identifier rubyid_to_i'>to_i</span>
<span class='id identifier rubyid_id'>id</span>
@@ -1210,10 +1214,10 @@
<pre class="lines">
-86</pre>
+87</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'entity_manager.rb', line 86</span>
+ <pre class="code"><span class="info file"># File 'entity_manager.rb', line 87</span>
<span class='kw'>def</span> <span class='id identifier rubyid_to_json'>to_json</span><span class='lparen'>(</span><span class='rparen'>)</span> <span class='kw'>end</span></pre>
</td>
@@ -1226,7 +1230,7 @@
</div>
<div id="footer">
- Generated on Fri Jun 11 01:49:32 2021 by
+ Generated on Sat Jun 12 00:56:07 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/Helper.html b/docs/FelFlame/Helper.html
index ce27679..2dbcd7a 100644
--- a/docs/FelFlame/Helper.html
+++ b/docs/FelFlame/Helper.html
@@ -132,7 +132,7 @@
</div>
<div id="footer">
- Generated on Fri Jun 11 01:49:32 2021 by
+ Generated on Sat Jun 12 00:56:07 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/Helper/ComponentManager.html b/docs/FelFlame/Helper/ComponentManager.html
index c1d0452..acb1cf8 100644
--- a/docs/FelFlame/Helper/ComponentManager.html
+++ b/docs/FelFlame/Helper/ComponentManager.html
@@ -184,7 +184,7 @@
<li class="public ">
<span class="summary_signature">
- <a href="#each-class_method" title="each (class method)">.<strong>each</strong> &#x21d2; Enumerator </a>
+ <a href="#each-class_method" title="each (class method)">.<strong>each</strong>(&amp;block) &#x21d2; Enumerator </a>
@@ -205,10 +205,19 @@
</li>
+ </ul>
+
+ <h2>
+ Instance Method Summary
+ <small><a href="#" class="summary_toggle">collapse</a></small>
+ </h2>
+
+ <ul class="summary">
+
<li class="public ">
<span class="summary_signature">
- <a href="#new-class_method" title="new (class method)">.<strong>new</strong>(**attrs) &#x21d2; Component </a>
+ <a href="#attrs-instance_method" title="#attrs (instance method)">#<strong>attrs</strong> &#x21d2; Hash </a>
@@ -223,25 +232,16 @@
<span class="summary_desc"><div class='inline'>
-<p>Creates a new component and sets the values of the attributes given to it.</p>
+<p>A hash, where all the keys are attributes linked to their respective values.</p>
</div></span>
</li>
- </ul>
-
- <h2>
- Instance Method Summary
- <small><a href="#" class="summary_toggle">collapse</a></small>
- </h2>
-
- <ul class="summary">
-
<li class="public ">
<span class="summary_signature">
- <a href="#attrs-instance_method" title="#attrs (instance method)">#<strong>attrs</strong> &#x21d2; Hash </a>
+ <a href="#delete-instance_method" title="#delete (instance method)">#<strong>delete</strong> &#x21d2; Boolean </a>
@@ -256,7 +256,7 @@
<span class="summary_desc"><div class='inline'>
-<p>A hash, where all the keys are attributes linked to their respective values.</p>
+<p>Removes this component from the list and purges all references to this Component from other Entities, as well as its <span class='object_link'><a href="#id-instance_method" title="FelFlame::Helper::ComponentManager#id (method)">ID</a></span> and data.</p>
</div></span>
</li>
@@ -265,7 +265,7 @@
<li class="public ">
<span class="summary_signature">
- <a href="#delete-instance_method" title="#delete (instance method)">#<strong>delete</strong> &#x21d2; Boolean </a>
+ <a href="#entities-instance_method" title="#entities (instance method)">#<strong>entities</strong> &#x21d2; Array&lt;Integer&gt; </a>
@@ -280,7 +280,7 @@
<span class="summary_desc"><div class='inline'>
-<p>Removes this component from the list and purges all references to this Component from other Entities, as well as its <span class='object_link'><a href="#id-instance_method" title="FelFlame::Helper::ComponentManager#id (method)">ID</a></span> and data.</p>
+<p>A list of entity ids that are linked to the component.</p>
</div></span>
</li>
@@ -289,13 +289,15 @@
<li class="public ">
<span class="summary_signature">
- <a href="#entities-instance_method" title="#entities (instance method)">#<strong>entities</strong> &#x21d2; Array </a>
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(**attrs) &#x21d2; Component </a>
</span>
+ <span class="note title constructor">constructor</span>
+
@@ -304,7 +306,7 @@
<span class="summary_desc"><div class='inline'>
-<p>A list of components that are linked to the component.</p>
+<p>Creates a new component and sets the values of the attributes given to it.</p>
</div></span>
</li>
@@ -385,6 +387,103 @@
</ul>
+<div id="constructor_details" class="method_details_list">
+ <h2>Constructor Details</h2>
+
+ <div class="method_details first">
+ <h3 class="signature first" id="initialize-instance_method">
+
+ #<strong>initialize</strong>(**attrs) &#x21d2; <tt>Component</tt>
+
+
+
+
+
+</h3><div class="docstring">
+ <div class="discussion">
+
+<p>Creates a new component and sets the values of the attributes given to it. If an attritbute is not passed then it will remain as the default.</p>
+
+
+ </div>
+</div>
+<div class="tags">
+ <p class="tag_title">Parameters:</p>
+<ul class="param">
+
+ <li>
+
+ <span class='name'>attrs</span>
+
+
+ <span class='type'>(<tt>Keyword: Value</tt>)</span>
+
+
+
+ &mdash;
+ <div class='inline'>
+<p>You can pass any number of Keyword-Value pairs</p>
+</div>
+
+ </li>
+
+</ul>
+
+
+</div><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'component_manager.rb', line 62</span>
+
+<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='op'>**</span><span class='id identifier rubyid_attrs'>attrs</span><span class='rparen'>)</span>
+ <span class='comment'># Prepare the object
+</span> <span class='comment'># (this is a function created with metaprogramming
+</span> <span class='comment'># in FelFlame::Components
+</span> <span class='id identifier rubyid_set_defaults'>set_defaults</span>
+
+ <span class='comment'># Generate ID
+</span> <span class='id identifier rubyid_new_id'>new_id</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_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_find_index'>find_index</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_i'>i</span><span class='op'>|</span> <span class='id identifier rubyid_i'>i</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='rbrace'>}</span>
+ <span class='id identifier rubyid_new_id'>new_id</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_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span> <span class='kw'>if</span> <span class='id identifier rubyid_new_id'>new_id</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
+ <span class='ivar'>@id</span> <span class='op'>=</span> <span class='id identifier rubyid_new_id'>new_id</span>
+
+ <span class='comment'># Fill params
+</span> <span class='id identifier rubyid_attrs'>attrs</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>
+ <span class='id identifier rubyid_send'>send</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_key'>key</span><span class='embexpr_end'>}</span><span class='tstring_content'>=</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span>
+ <span class='kw'>end</span>
+
+ <span class='comment'># Save Component
+</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_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_new_id'>new_id</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>self</span>
+<span class='kw'>end</span></pre>
+ </td>
+ </tr>
+</table>
+</div>
+
+</div>
<div id="instance_attr_details" class="attr_details">
<h2>Instance Attribute Details</h2>
@@ -430,12 +529,12 @@
<pre class="lines">
-53
-54
-55</pre>
+57
+58
+59</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'component_manager.rb', line 53</span>
+ <pre class="code"><span class="info file"># File 'component_manager.rb', line 57</span>
<span class='kw'>def</span> <span class='id identifier rubyid_id'>id</span>
<span class='ivar'>@id</span>
@@ -520,12 +619,12 @@
<pre class="lines">
-69
-70
-71</pre>
+96
+97
+98</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'component_manager.rb', line 69</span>
+ <pre class="code"><span class="info file"># File 'component_manager.rb', line 96</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>
@@ -538,7 +637,7 @@
<div class="method_details ">
<h3 class="signature " id="each-class_method">
- .<strong>each</strong> &#x21d2; <tt>Enumerator</tt>
+ .<strong>each</strong>(&amp;block) &#x21d2; <tt>Enumerator</tt>
@@ -547,7 +646,7 @@
</h3><div class="docstring">
<div class="discussion">
-<p>Iterates over all components within the component manager</p>
+<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>
@@ -574,114 +673,15 @@
<pre class="lines">
-95
-96
-97
-98
-99</pre>
- </td>
- <td>
- <pre class="code"><span class="info file"># File 'component_manager.rb', line 95</span>
-
-<span class='kw'>def</span> <span class='id identifier rubyid_each'>each</span>
- <span class='id identifier rubyid_data'>data</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_component'>component</span><span class='op'>|</span>
- <span class='kw'>yield</span> <span class='id identifier rubyid_component'>component</span>
- <span class='kw'>end</span>
-<span class='kw'>end</span></pre>
- </td>
- </tr>
-</table>
-</div>
-
- <div class="method_details ">
- <h3 class="signature " id="new-class_method">
-
- .<strong>new</strong>(**attrs) &#x21d2; <tt>Component</tt>
-
-
-
-
-
-</h3><div class="docstring">
- <div class="discussion">
-
-<p>Creates a new component and sets the values of the attributes given to it. If an attritbute is not passed then it will remain as the default.</p>
-
-
- </div>
-</div>
-<div class="tags">
- <p class="tag_title">Parameters:</p>
-<ul class="param">
-
- <li>
-
- <span class='name'>attrs</span>
-
-
- <span class='type'>(<tt>Keyword: Value</tt>)</span>
-
-
-
- </li>
-
-</ul>
-
-<p class="tag_title">Returns:</p>
-<ul class="return">
-
- <li>
-
-
- <span class='type'>(<tt>Component</tt>)</span>
-
-
-
- </li>
-
-</ul>
-
-</div><table class="source_code">
- <tr>
- <td>
- <pre class="lines">
-
-
-76
-77
-78
-79
-80
-81
-82
-83
-84
-85
-86
-87
-88
-89
-90
-91</pre>
+103
+104
+105</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'component_manager.rb', line 76</span>
-
-<span class='kw'>def</span> <span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='op'>**</span><span class='id identifier rubyid_attrs'>attrs</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_new_component'>new_component</span> <span class='op'>=</span> <span class='kw'>super</span>
+ <pre class="code"><span class="info file"># File 'component_manager.rb', line 103</span>
- <span class='comment'># Generate ID
-</span> <span class='id identifier rubyid_new_id'>new_id</span> <span class='op'>=</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_find_index'>find_index</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_i'>i</span><span class='op'>|</span> <span class='id identifier rubyid_i'>i</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='rbrace'>}</span>
- <span class='id identifier rubyid_new_id'>new_id</span> <span class='op'>=</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_size'>size</span> <span class='kw'>if</span> <span class='id identifier rubyid_new_id'>new_id</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
- <span class='id identifier rubyid_new_component'>new_component</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span> <span class='op'>=</span> <span class='id identifier rubyid_new_id'>new_id</span>
-
- <span class='comment'># Fill params
-</span> <span class='id identifier rubyid_attrs'>attrs</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>
- <span class='id identifier rubyid_new_component'>new_component</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_key'>key</span><span class='embexpr_end'>}</span><span class='tstring_content'>=</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span>
- <span class='kw'>end</span>
-
- <span class='comment'># Save Component
-</span> <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_new_id'>new_id</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_new_component'>new_component</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'>end</span></pre>
</td>
</tr>
@@ -738,14 +738,14 @@
<pre class="lines">
-137
-138
-139
-140
-141</pre>
+143
+144
+145
+146
+147</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'component_manager.rb', line 137</span>
+ <pre class="code"><span class="info file"># File 'component_manager.rb', line 143</span>
<span class='kw'>def</span> <span class='id identifier rubyid_attrs'>attrs</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>
@@ -801,20 +801,20 @@
<pre class="lines">
-124
-125
-126
-127
-128
-129
130
131
132
133
-134</pre>
+134
+135
+136
+137
+138
+139
+140</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'component_manager.rb', line 124</span>
+ <pre class="code"><span class="info file"># File 'component_manager.rb', line 130</span>
<span class='kw'>def</span> <span class='id identifier rubyid_delete'>delete</span>
<span class='id identifier rubyid_entities'>entities</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_entity_id'>entity_id</span><span class='op'>|</span>
@@ -835,7 +835,7 @@
<div class="method_details ">
<h3 class="signature " id="entities-instance_method">
- #<strong>entities</strong> &#x21d2; <tt>Array</tt>
+ #<strong>entities</strong> &#x21d2; <tt>Array&lt;Integer&gt;</tt>
@@ -844,7 +844,7 @@
</h3><div class="docstring">
<div class="discussion">
-<p>A list of components that are linked to the component</p>
+<p>A list of entity ids that are linked to the component</p>
</div>
@@ -857,7 +857,7 @@
<li>
- <span class='type'>(<tt>Array</tt>)</span>
+ <span class='type'>(<tt>Array&lt;Integer&gt;</tt>)</span>
@@ -871,12 +871,12 @@
<pre class="lines">
-110
-111
-112</pre>
+116
+117
+118</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'component_manager.rb', line 110</span>
+ <pre class="code"><span class="info file"># File 'component_manager.rb', line 116</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>
@@ -925,12 +925,12 @@
<pre class="lines">
-104
-105
-106</pre>
+110
+111
+112</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'component_manager.rb', line 104</span>
+ <pre class="code"><span class="info file"># File 'component_manager.rb', line 110</span>
<span class='kw'>def</span> <span class='id identifier rubyid_to_i'>to_i</span>
<span class='id identifier rubyid_id'>id</span>
@@ -984,12 +984,12 @@
<pre class="lines">
-146
-147
-148</pre>
+152
+153
+154</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'component_manager.rb', line 146</span>
+ <pre class="code"><span class="info file"># File 'component_manager.rb', line 152</span>
<span class='kw'>def</span> <span class='id identifier rubyid_to_json'>to_json</span>
<span class='comment'># should return a json or hash of all data in this component
@@ -1043,14 +1043,14 @@
<pre class="lines">
-116
-117
-118
-119
-120</pre>
+122
+123
+124
+125
+126</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'component_manager.rb', line 116</span>
+ <pre class="code"><span class="info file"># File 'component_manager.rb', line 122</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>
@@ -1067,7 +1067,7 @@
</div>
<div id="footer">
- Generated on Fri Jun 11 01:49:32 2021 by
+ Generated on Sat Jun 12 00:56:07 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 a418bfb..2dd4534 100644
--- a/docs/FelFlame/Systems.html
+++ b/docs/FelFlame/Systems.html
@@ -124,7 +124,7 @@
</div>
<div id="footer">
- Generated on Fri Jun 11 01:49:32 2021 by
+ Generated on Sat Jun 12 00:56:07 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 42c4e44..0ae242d 100644
--- a/docs/_index.html
+++ b/docs/_index.html
@@ -164,7 +164,7 @@
</div>
<div id="footer">
- Generated on Fri Jun 11 01:49:32 2021 by
+ Generated on Sat Jun 12 00:56:07 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 a62e2fd..c1e498b 100644
--- a/docs/file.README.html
+++ b/docs/file.README.html
@@ -353,7 +353,7 @@ complete I will use a more verbose explanation as below to help users of the fra
</div></div>
<div id="footer">
- Generated on Fri Jun 11 01:49:32 2021 by
+ Generated on Sat Jun 12 00:56:07 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 333991c..1d9dc01 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -353,7 +353,7 @@ complete I will use a more verbose explanation as below to help users of the fra
</div></div>
<div id="footer">
- Generated on Fri Jun 11 01:49:32 2021 by
+ Generated on Sat Jun 12 00:56:07 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 065cba8..cdf6aae 100644
--- a/docs/method_list.html
+++ b/docs/method_list.html
@@ -158,24 +158,24 @@
<li class="odd ">
<div class="item">
- <span class='object_link'><a href="FelFlame/Entities.html#initialize-instance_method" title="FelFlame::Entities#initialize (method)">#initialize</a></span>
- <small>FelFlame::Entities</small>
+ <span class='object_link'><a href="FelFlame/Helper/ComponentManager.html#initialize-instance_method" title="FelFlame::Helper::ComponentManager#initialize (method)">#initialize</a></span>
+ <small>FelFlame::Helper::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>
+ <span class='object_link'><a href="FelFlame/Entities.html#initialize-instance_method" title="FelFlame::Entities#initialize (method)">#initialize</a></span>
+ <small>FelFlame::Entities</small>
</div>
</li>
<li class="odd ">
<div class="item">
- <span class='object_link'><a href="FelFlame/Helper/ComponentManager.html#new-class_method" title="FelFlame::Helper::ComponentManager.new (method)">new</a></span>
- <small>FelFlame::Helper::ComponentManager</small>
+ <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>
diff --git a/docs/top-level-namespace.html b/docs/top-level-namespace.html
index b2bd7c9..869c856 100644
--- a/docs/top-level-namespace.html
+++ b/docs/top-level-namespace.html
@@ -127,7 +127,7 @@
</div>
<div id="footer">
- Generated on Fri Jun 11 01:49:32 2021 by
+ Generated on Sat Jun 12 00:56:07 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/entity_manager.rb b/entity_manager.rb
index 5038630..abbf1d0 100644
--- a/entity_manager.rb
+++ b/entity_manager.rb
@@ -9,14 +9,16 @@ class FelFlame
# @return [Entity]
def initialize(*components)
# Assign new unique ID
- new_id = self.class.data.find_index { |i| i.nil? }
+ new_id = self.class.data.find_index(&:nil?)
new_id = self.class.data.size if new_id.nil?
self.id = new_id
# Add each component
- components.uniq.each do |component|
- add component
- end
+ #components.uniq.each do |component|
+ # add component
+ #end
+ add(*components)
+
self.class.data[id] = self
end
@@ -37,11 +39,7 @@ class FelFlame
def delete
components.each do |component_manager, component_array|
component_array.each do |component_id|
- FelFlame.const_get(
- component_manager.to_s.delete_prefix('FelFlame::')
- )[component_id].entities.delete(id)
- # The following is neater, but doesnt work for some reason :/
- #Object.const_get(component_manager)[component_id].entities.delete(id)
+ component_manager[component_id].entities.delete(id)
end
end
FelFlame::Entities.data[id] = nil
@@ -50,34 +48,37 @@ class FelFlame
true
end
- # Returns true when added, or false if it already belongs to the Entity
- # Add a component to the Entity
- # @param component [Component] A component created from any component manager
- # @return [Boolean] true if component is added, false if it already is attached
- def add(component)
- if components[component.class.to_s.to_sym].nil?
- components[component.class.to_s.to_sym] = [component.id]
- component.entities.push id
- true
- elsif !components[component.class.to_s.to_sym].include? component.id
- components[component.class.to_s.to_sym].push component.id
- component.entities.push id
- true
- else
- false
+ # Add any number components to the Entity.
+ # @param component [Component] Any number of components created from any component manager
+ # @return [Boolean] true if component is added, false if it already is attached or no components given
+ def add(*components_to_add)
+ added = false
+ components_to_add.each do |component|
+ if components[component.class].nil?
+ components[component.class] = [component.id]
+ component.entities.push id
+ added =true
+ elsif !components[component.class].include? component.id
+ components[component.class].push component.id
+ component.entities.push id
+ added = true
+ end
end
+ added
end
# Remove a component from the Entity
- # @param component [Component] A component created from any component manager
- # @return [Boolean] true if component is removed, false if it wasnt attached to component
- def remove(component)
- components[component.class.to_s.to_sym].delete component.id
- if component.entities.delete id
- true
- else
- false
+ # @param component_to_remove [Component] A component created from any component manager
+ # @return [Boolean] true if at least one component is removed, false if none of them were attached to the component
+ def remove(*components_to_remove)
+ removed = false
+ components_to_remove.each do |component|
+ components[component.class].delete component.id
+ if component.entities.delete id
+ removed = true
+ end
end
+ removed
end
# Export all data into a JSON String which can then be saved into a file
@@ -87,7 +88,7 @@ class FelFlame
class <<self
include Enumerable
- # @return [Array] Array of all Entities that exist
+ # @return [Array<Entity>] Array of all Entities that exist
# @!visibility private
def data
@data ||= []
diff --git a/helpers/00_tileset.rb b/helpers/00_tileset.rb
index 3890550..c4293cb 100644
--- a/helpers/00_tileset.rb
+++ b/helpers/00_tileset.rb
@@ -1,3 +1,9 @@
+# Coverage Ignored because the functionality of this
+# code will not be used for the core of FelFlame.
+# It will most likely be released as a seperate package
+# The code will most likely be kept here until it
+# eventually will be migrated to a new git repo
+# :nocov:
class Helper
# Returns a loaded map and its dependecies(images,json)
# If any are missing then it will load them from files
@@ -47,3 +53,4 @@ class Helper
end
end
end
+# :nocov:
diff --git a/helpers/01_component.rb b/helpers/01_component.rb
index cedc32e..2065d0c 100644
--- a/helpers/01_component.rb
+++ b/helpers/01_component.rb
@@ -1,6 +1,8 @@
class FelFlame
class Helper
+=begin
+ # Unused:
class Level < FelFlame::Helper::ComponentManager
class <<self
def data
@@ -18,7 +20,8 @@ class FelFlame
end
end
end
-
+=end
+=begin
class Array2D < Array
def [](val)
unless val.nil?
@@ -27,7 +30,8 @@ class FelFlame
super
end
end
-
+=end
+=begin
class ArrayOfHashes < Array
def [](val)
unless val.nil?
@@ -36,7 +40,9 @@ class FelFlame
super
end
end
+=end
+=begin
module ComponentHelper
class <<self
def up? char
@@ -63,5 +69,6 @@ class FelFlame
end
end
end
+=end
end
end
diff --git a/tests/_test_helper.rb b/tests/_test_helper.rb
deleted file mode 100644
index 6612b38..0000000
--- a/tests/_test_helper.rb
+++ /dev/null
@@ -1,35 +0,0 @@
-require 'simplecov'
-require 'simplecov_json_formatter'
-#require 'simplecov_small_badge'
-
-# SimpleCovSmallBadge fix
-=begin
-SimpleCovSmallBadge::Formatter.class_eval do
- private
- def state(covered_percent)
- if SimpleCov.minimum_coverage[:line]&.positive?
- if covered_percent >= SimpleCov.minimum_coverage[:line]
- 'good'
- else
- 'bad'
- end
- else
- 'unknown'
- end
- end
-end
-=end
-
-SimpleCov.start do
- SimpleCov.add_filter 'tests'
- SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new([
- SimpleCov::Formatter::HTMLFormatter,
- SimpleCov::Formatter::JSONFormatter
- #SimpleCovSmallBadge::Formatter
- ])
-end
-
-require 'minitest/autorun'
-require 'minitest/reporters'
-
-Minitest::Reporters.use!
diff --git a/tests/_test_sample.rb b/tests/_test_sample.rb
deleted file mode 100644
index afc3384..0000000
--- a/tests/_test_sample.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-require 'minitest/autorun'
-require_relative '_test_helper.rb'
-
-require_relative 'stuff_we_testing'
-
-describe 'Sample' do
- before do
- #setup vars here
- end
-
- it 'does something' do
- #_(@thing).mustequal 'something
- end
-end
diff --git a/tests/component_manager_test.rb b/tests/component_manager_test.rb
deleted file mode 100644
index 195eff3..0000000
--- a/tests/component_manager_test.rb
+++ /dev/null
@@ -1,62 +0,0 @@
-require 'minitest/autorun'
-require_relative '_test_helper.rb'
-
-require_relative '../felflame.rb'
-
-describe 'Components' do
- before(:all) do
- FelFlame::Components.new('Test', :param1, param2: 'default')
- #setup vars here
- end
-
- after do
- FelFlame::Components::Test.each.delete
- end
-
- it 'can create new component types' do
- _(FelFlame::Components.new('Test2', :p, k: 'something')).must_equal\
- FelFlame::Components::Test2
- end
-
- it 'can make new components' do
- _(FelFlame::Components::Test.new).must_equal FelFlame::Components::Test.get(0)
- end
-
- it 'can set values' do
- test = FelFlame::Components::Test.new
- _(test.param1 = 'ok').must_equal 'ok'
- _(test.param1).must_equal 'ok'
- end
-
- it 'can add to entity' do
- flunk
- end
-
- it 'can remove from entity' do
- flunk
- end
-
- it 'can delete component' do
- flunk
- end
-
- it 'can dump single component' do
- flunk
- end
-
- it 'can load single component' do
- flunk
- end
-
- it 'can be added as \'when added\' trigger to system' do
- flunk
- end
-
- it 'can be added as \'when removed\' trigger to system' do
- flunk
- end
-
- it 'can be added as \'when is_set\' trigger to system' do
- flunk
- end
-end
diff --git a/tests/entity_manager_test.rb b/tests/entity_manager_test.rb
deleted file mode 100644
index 09d21b5..0000000
--- a/tests/entity_manager_test.rb
+++ /dev/null
@@ -1,52 +0,0 @@
-require 'minitest/autorun'
-require_relative '_test_helper.rb'
-
-require_relative '../felflame.rb'
-
-describe 'Entities' do
- before do
- @one = FelFlame::Entities.new
- @two = FelFlame::Entities.new
- @three = FelFlame::Entities.new
- end
-
- after do
- FelFlame::Entities.delete(0)
- FelFlame::Entities.delete(1)
- FelFlame::Entities.delete(2)
- end
-
- it 'has correct ID\'s' do
- _(@one.id).must_equal 0
- _(@two.id).must_equal 1
- _(@three.id).must_equal 2
- end
-
- it 'can be accessed' do
- _(@one).must_equal FelFlame::Entities.get(0)
- _(@two).must_equal FelFlame::Entities.get(1)
- _(@three).must_equal FelFlame::Entities.get(2)
- end
-
- it 'can be deleted' do
- _(FelFlame::Entities.delete(0)).assert
- _(FelFlame::Entities.get(0)).assert_nil
- _(FelFlame::Entities.delete(7)).refute
- end
-
- it 'can be dumped' do
- flunk 'need to add dump test'
- @one.dump
- end
-
- it 'can load dumps' do
- flunk 'need to add this test'
- end
- it 'can have components added' do
- flunk 'make this test'
- end
-
- it 'can have components removed' do
- flunk 'make this test'
- end
-end
diff --git a/tests/felflame_test.rb b/tests/felflame_test.rb
deleted file mode 100644
index debb6f9..0000000
--- a/tests/felflame_test.rb
+++ /dev/null
@@ -1,45 +0,0 @@
-require 'minitest/autorun'
-require_relative '_test_helper.rb'
-
-require_relative '../felflame.rb'
-
-describe 'Entities' do
- before do
- end
-
- it 'cant find constant' do
- assert_raises(NameError, 'uninitialized constant DoesntExist') {
- FelFlame::DoesntExist
- }
- end
-
- it 'can\'t find method' do
- assert_raises(NoMethodError) {
- FelFlame.wrong
- }
- end
-
- it 'FelFlame aliased to FF' do
- _(FF).must_equal FelFlame
- end
-
- it 'Entities aliased to Ent' do
- _(FF::Ent).must_equal FelFlame::Entities
- end
-
- it 'Components aliased to Cmp' do
- _(FF::Cmp).must_equal FelFlame::Components
- end
-
- it 'Systems aliased to Sys' do
- _(FF::Sys).must_equal FelFlame::Systems
- end
-
- it 'Scenes aliased to Scn' do
- _(FF::Scn).must_equal FelFlame::Scene
- end
-
- it 'Stage aliased to Stg' do
- _(FF::Stg).must_equal FelFlame::Stage
- end
-end
diff --git a/tests/scene_manager_test.rb b/tests/scene_manager_test.rb
deleted file mode 100644
index 38febb8..0000000
--- a/tests/scene_manager_test.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-require 'minitest/autorun'
-require_relative '_test_helper.rb'
-
-require_relative '../scene_manager.rb'
-
-describe 'Sample' do
- before do
- #setup vars here
- end
-
- it 'does something' do
- _(4).must_equal 4
- #_(@thing).mustequal 'something
- end
-end
diff --git a/tests/stage_manager_test.rb b/tests/stage_manager_test.rb
deleted file mode 100644
index 69fda0a..0000000
--- a/tests/stage_manager_test.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-require 'minitest/autorun'
-require_relative '_test_helper.rb'
-
-require_relative '../stage_manager.rb'
-
-describe 'Sample' do
- before do
- #setup vars here
- end
-
- it 'does something' do
- _(4).must_equal 4
- #_(@thing).mustequal 'something
- end
-end
diff --git a/tests/system_manager_test.rb b/tests/system_manager_test.rb
deleted file mode 100644
index e02b283..0000000
--- a/tests/system_manager_test.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-require 'minitest/autorun'
-require_relative '_test_helper.rb'
-
-require_relative '../system_manager.rb'
-
-describe 'Sample' do
- before do
- #setup vars here
- end
-
- it 'does something' do
- _(4).must_equal 4
- #_(@thing).mustequal 'something
- end
-end