From 4b903c3c50af8434b101feb7e84c32ef9cf3254e Mon Sep 17 00:00:00 2001 From: realtradam Date: Mon, 12 Jul 2021 04:09:37 -0400 Subject: fixed doc compilation --- docs/FelFlame.html | 14 +- docs/FelFlame/ComponentManager.html | 162 +++++++------- docs/FelFlame/Components.html | 26 ++- docs/FelFlame/Entities.html | 66 +++--- docs/FelFlame/Scenes.html | 74 ++++--- docs/FelFlame/Stage.html | 16 +- docs/FelFlame/Systems.html | 32 +-- docs/Felflame_.html | 143 ++++++++++++ docs/_index.html | 86 +++++++- docs/class_list.html | 2 +- docs/file.README.html | 78 +++---- docs/file.version.html | 74 +++++++ docs/index.html | 78 +++---- docs/method_list.html | 424 ++++++++++++++++++++++++++++++++++++ docs/top-level-namespace.html | 41 +++- 15 files changed, 1045 insertions(+), 271 deletions(-) create mode 100644 docs/Felflame_.html create mode 100644 docs/file.version.html (limited to 'docs') diff --git a/docs/FelFlame.html b/docs/FelFlame.html index 2a8640b..f4656b8 100644 --- a/docs/FelFlame.html +++ b/docs/FelFlame.html @@ -94,8 +94,8 @@
Defined in:
-
felflame.rb,
- system_manager.rb,
component_manager.rb,
entity_manager.rb,
scene_manager.rb,
stage_manager.rb
+
lib/felflame.rb,
+ lib/felflame/scene_manager.rb,
lib/felflame/stage_manager.rb,
lib/felflame/entity_manager.rb,
lib/felflame/system_manager.rb,
lib/felflame/component_manager.rb
@@ -287,12 +287,12 @@
 
 
-13
-14
-15
+15 +16 +17 -
# File 'felflame.rb', line 13
+      
# File 'lib/felflame.rb', line 15
 
 def call
   FelFlame::Stage.call
@@ -307,7 +307,7 @@
 
 
       
diff --git a/docs/FelFlame/ComponentManager.html b/docs/FelFlame/ComponentManager.html
index d75d01c..be384b9 100644
--- a/docs/FelFlame/ComponentManager.html
+++ b/docs/FelFlame/ComponentManager.html
@@ -94,7 +94,7 @@
   
   
Defined in:
-
component_manager.rb
+
lib/felflame/component_manager.rb
@@ -617,10 +617,6 @@
 
 
-100
-101
-102
-103
 104
 105
 106
@@ -635,10 +631,14 @@
 115
 116
 117
-118
+118 +119 +120 +121 +122
-
# File 'component_manager.rb', line 100
+      
# File 'lib/felflame/component_manager.rb', line 104
 
 def initialize(**attrs)
   # Prepare the object
@@ -710,12 +710,12 @@
       
 
 
-132
-133
-134
+136 +137 +138
-
# File 'component_manager.rb', line 132
+      
# File 'lib/felflame/component_manager.rb', line 136
 
 def addition_triggers
   @addition_triggers ||= []
@@ -766,12 +766,12 @@
       
 
 
-148
-149
-150
+152 +153 +154
-
# File 'component_manager.rb', line 148
+      
# File 'lib/felflame/component_manager.rb', line 152
 
 def attr_triggers
   @attr_triggers ||= {}
@@ -822,12 +822,12 @@
       
 
 
-140
-141
-142
+144 +145 +146
-
# File 'component_manager.rb', line 140
+      
# File 'lib/felflame/component_manager.rb', line 144
 
 def removal_triggers
   @removal_triggers ||= []
@@ -883,12 +883,12 @@
       
 
 
-77
-78
-79
+81 +82 +83
-
# File 'component_manager.rb', line 77
+      
# File 'lib/felflame/component_manager.rb', line 81
 
 def addition_triggers
   @addition_triggers ||= []
@@ -939,12 +939,12 @@
       
 
 
-93
-94
-95
+97 +98 +99
-
# File 'component_manager.rb', line 93
+      
# File 'lib/felflame/component_manager.rb', line 97
 
 def attr_triggers
   @attr_triggers ||= {}
@@ -995,12 +995,12 @@
       
 
 
-59
-60
-61
+63 +64 +65
-
# File 'component_manager.rb', line 59
+      
# File 'lib/felflame/component_manager.rb', line 63
 
 def id
   @id
@@ -1051,12 +1051,12 @@
       
 
 
-85
-86
-87
+89 +90 +91
-
# File 'component_manager.rb', line 85
+      
# File 'lib/felflame/component_manager.rb', line 89
 
 def removal_triggers
   @removal_triggers ||= []
@@ -1141,12 +1141,12 @@
       
 
 
-165
-166
-167
+169 +170 +171
-
# File 'component_manager.rb', line 165
+      
# File 'lib/felflame/component_manager.rb', line 169
 
 def [](component_id)
   data[component_id]
@@ -1195,12 +1195,12 @@
       
 
 
-172
-173
-174
+176 +177 +178
-
# File 'component_manager.rb', line 172
+      
# File 'lib/felflame/component_manager.rb', line 176
 
 def each(&block)
   data.compact.each(&block)
@@ -1260,18 +1260,18 @@
       
 
 
-199
-200
-201
-202
 203
 204
 205
 206
-207
+207 +208 +209 +210 +211
-
# File 'component_manager.rb', line 199
+      
# File 'lib/felflame/component_manager.rb', line 203
 
 def attr_changed_trigger_systems(attr)
   systems_to_execute = self.class.attr_triggers[attr]
@@ -1331,16 +1331,16 @@
       
 
 
-230
-231
-232
-233
-234
 235
-236
+236 +237 +238 +239 +240 +241
-
# File 'component_manager.rb', line 230
+      
# File 'lib/felflame/component_manager.rb', line 235
 
 def attrs
   return_hash = instance_variables.each_with_object({}) do |key, final|
@@ -1398,10 +1398,6 @@
       
 
 
-211
-212
-213
-214
 215
 216
 217
@@ -1414,10 +1410,15 @@
 224
 225
 226
-227
+227 +228 +229 +230 +231 +232
-
# File 'component_manager.rb', line 211
+      
# File 'lib/felflame/component_manager.rb', line 215
 
 def delete
   addition_triggers.each do |system|
@@ -1427,9 +1428,10 @@
   # the remove command is called, breaking the loop if it
   # wasn't referencing a clone(will get Nil errors)
   iter = entities.map(&:clone)
-  iter.each do |entity_id|
-    FelFlame::Entities[entity_id].remove self #unless FelFlame::Entities[entity_id].nil?
-  end
+  iter.each do |entity|
+    #FelFlame::Entities[entity_id].remove self #unless FelFlame::Entities[entity_id].nil?
+    entity.remove self
+  end
   self.class.data[id] = nil
   instance_variables.each do |var|
     instance_variable_set(var, nil)
@@ -1480,12 +1482,12 @@
       
 
 
-185
-186
-187
+189 +190 +191
-
# File 'component_manager.rb', line 185
+      
# File 'lib/felflame/component_manager.rb', line 189
 
 def entities
   @entities ||= []
@@ -1534,12 +1536,12 @@
       
 
 
-179
-180
-181
+183 +184 +185
-
# File 'component_manager.rb', line 179
+      
# File 'lib/felflame/component_manager.rb', line 183
 
 def to_i
   id
@@ -1593,14 +1595,14 @@
       
 
 
-191
-192
-193
-194
-195
+195 +196 +197 +198 +199
-
# File 'component_manager.rb', line 191
+      
# File 'lib/felflame/component_manager.rb', line 195
 
 def update_attrs(**opts)
   opts.each do |key, value|
@@ -1617,7 +1619,7 @@
 
 
       
diff --git a/docs/FelFlame/Components.html b/docs/FelFlame/Components.html
index 855d2bb..1b3802f 100644
--- a/docs/FelFlame/Components.html
+++ b/docs/FelFlame/Components.html
@@ -99,8 +99,8 @@
   
   
Defined in:
-
felflame.rb,
- component_manager.rb
+
lib/felflame.rb,
+ lib/felflame/component_manager.rb
@@ -231,12 +231,12 @@
 
 
-47
-48
-49
+51 +52 +53
-
# File 'component_manager.rb', line 47
+      
# File 'lib/felflame/component_manager.rb', line 51
 
 def each(&block)
   constants.each(&block)
@@ -373,10 +373,14 @@
 40
 41
 42
-43
+43 +44 +45 +46 +47
-
# File 'component_manager.rb', line 19
+      
# File 'lib/felflame/component_manager.rb', line 19
 
 def new(component_name, *attrs, **attrs_with_defaults)
   if FelFlame::Components.const_defined?(component_name)
@@ -385,7 +389,11 @@
 
 
   const_set(component_name, Class.new(FelFlame::ComponentManager) {})
+
   attrs.each do |attr|
+    if FelFlame::Components.const_get(component_name).method_defined?("#{attr}") || FelFlame::Components.const_get(component_name).method_defined?("#{attr}=")
+      raise NameError.new "The attribute name \"#{attr}\" is already a method"
+    end
     FelFlame::Components.const_get(component_name).attr_accessor attr
   end
   attrs_with_defaults.each do |attr, _default|
@@ -413,7 +421,7 @@
 
 
       
diff --git a/docs/FelFlame/Entities.html b/docs/FelFlame/Entities.html
index 9953edb..c5da7db 100644
--- a/docs/FelFlame/Entities.html
+++ b/docs/FelFlame/Entities.html
@@ -99,8 +99,8 @@
   
   
Defined in:
-
felflame.rb,
- entity_manager.rb
+
lib/felflame.rb,
+ lib/felflame/entity_manager.rb
@@ -435,7 +435,7 @@ 26
-
# File 'entity_manager.rb', line 16
+      
# File 'lib/felflame/entity_manager.rb', line 16
 
 def initialize(*components)
   # Assign new unique ID
@@ -504,7 +504,7 @@
 7
-
# File 'entity_manager.rb', line 5
+      
# File 'lib/felflame/entity_manager.rb', line 5
 
 def id
   @id
@@ -589,12 +589,12 @@
       
 
 
+116
 117
-118
-119
+118
-
# File 'entity_manager.rb', line 117
+      
# File 'lib/felflame/entity_manager.rb', line 116
 
 def [](entity_id)
   data[entity_id]
@@ -643,12 +643,12 @@
       
 
 
+123
 124
-125
-126
+125
-
# File 'entity_manager.rb', line 124
+      
# File 'lib/felflame/entity_manager.rb', line 123
 
 def each(&block)
   data.compact.each(&block)
@@ -728,6 +728,7 @@
       
 
 
+57
 58
 59
 60
@@ -740,21 +741,20 @@
 67
 68
 69
-70
-71
+70
-
# File 'entity_manager.rb', line 58
+      
# File 'lib/felflame/entity_manager.rb', line 57
 
 def add(*components_to_add)
   components_to_add.each do |component|
     if components[component.class].nil?
-      components[component.class] = [component.id]
-      component.entities.push id
+      components[component.class] = [component]
+      component.entities.push self
       check_systems component, :addition_triggers
-    elsif !components[component.class].include? component.id
-      components[component.class].push component.id
-      component.entities.push id
+    elsif !components[component.class].include? component
+      components[component.class].push component
+      component.entities.push self
       check_systems component, :addition_triggers
     end
   end
@@ -809,7 +809,7 @@
 32
-
# File 'entity_manager.rb', line 30
+      
# File 'lib/felflame/entity_manager.rb', line 30
 
 def components
   @components ||= {}
@@ -873,18 +873,16 @@
 49
 50
 51
-52
-53
+52
-
# File 'entity_manager.rb', line 42
+      
# File 'lib/felflame/entity_manager.rb', line 42
 
 def delete
   components.each do |component_manager, component_array|
-    component_array.each do |component_id|
-      component_manager[component_id].entities.delete(id)
-      #self.remove FelFlame::Components.const_get(component_manager.name)[component_id]
-    end
+    component_array.each do |component|
+      component.entities.delete(self)
+    end
   end
   FelFlame::Entities.data[id] = nil
   @components = {}
@@ -960,23 +958,23 @@
       
 
 
+87
 88
 89
 90
 91
 92
 93
-94
-95
+94
-
# File 'entity_manager.rb', line 88
+      
# File 'lib/felflame/entity_manager.rb', line 87
 
 def remove(*components_to_remove)
   components_to_remove.each do |component|
-    check_systems component, :removal_triggers if component.entities.include? id
-    component.entities.delete id
-    components[component.class].delete component.id
+    check_systems component, :removal_triggers if component.entities.include? self
+    component.entities.delete self
+    components[component.class].delete component
   end
   true
 end
@@ -1029,7 +1027,7 @@ 38
-
# File 'entity_manager.rb', line 36
+      
# File 'lib/felflame/entity_manager.rb', line 36
 
 def to_i
   id
@@ -1044,7 +1042,7 @@
 
 
       
diff --git a/docs/FelFlame/Scenes.html b/docs/FelFlame/Scenes.html
index 569657f..cf98351 100644
--- a/docs/FelFlame/Scenes.html
+++ b/docs/FelFlame/Scenes.html
@@ -94,8 +94,8 @@
   
   
Defined in:
-
felflame.rb,
- scene_manager.rb
+
lib/felflame.rb,
+ lib/felflame/scene_manager.rb
@@ -162,6 +162,8 @@ + readonly + @@ -364,13 +366,13 @@
 
 
-10
-11
-12
-13
+14 +15 +16 +17
-
# File 'scene_manager.rb', line 10
+      
# File 'lib/felflame/scene_manager.rb', line 14
 
 def initialize(name)
   FelFlame::Scenes.const_set(name, self)
@@ -419,7 +421,7 @@
 6
-
# File 'scene_manager.rb', line 4
+      
# File 'lib/felflame/scene_manager.rb', line 4
 
 def const_name
   @const_name
@@ -470,12 +472,12 @@
       
 
 
-17
-18
-19
+21 +22 +23
-
# File 'scene_manager.rb', line 17
+      
# File 'lib/felflame/scene_manager.rb', line 21
 
 def systems
   @systems ||= []
@@ -536,15 +538,15 @@
       
 
 
-30
-31
-32
-33
 34
-35
+35 +36 +37 +38 +39
-
# File 'scene_manager.rb', line 30
+      
# File 'lib/felflame/scene_manager.rb', line 34
 
 def add(*systems_to_add)
   self.systems |= systems_to_add
@@ -601,13 +603,13 @@
       
 
 
-23
-24
-25
-26
+27 +28 +29 +30
-
# File 'scene_manager.rb', line 23
+      
# File 'lib/felflame/scene_manager.rb', line 27
 
 def call
   systems.each(&:call)
@@ -662,14 +664,14 @@
       
 
 
-48
-49
-50
-51
-52
+52 +53 +54 +55 +56
-
# File 'scene_manager.rb', line 48
+      
# File 'lib/felflame/scene_manager.rb', line 52
 
 def clear
   systems.clear
@@ -725,15 +727,15 @@
       
 
 
-39
-40
-41
-42
 43
-44
+44 +45 +46 +47 +48
-
# File 'scene_manager.rb', line 39
+      
# File 'lib/felflame/scene_manager.rb', line 43
 
 def remove(*systems_to_remove)
   self.systems -= systems_to_remove
@@ -751,7 +753,7 @@
 
 
       
diff --git a/docs/FelFlame/Stage.html b/docs/FelFlame/Stage.html
index e3c3853..9f7a462 100644
--- a/docs/FelFlame/Stage.html
+++ b/docs/FelFlame/Stage.html
@@ -94,8 +94,8 @@
   
   
Defined in:
-
felflame.rb,
- stage_manager.rb
+
lib/felflame.rb,
+ lib/felflame/stage_manager.rb
@@ -310,7 +310,7 @@ 60
-
# File 'stage_manager.rb', line 58
+      
# File 'lib/felflame/stage_manager.rb', line 58
 
 def scenes
   @scenes ||= []
@@ -381,7 +381,7 @@
 18
-
# File 'stage_manager.rb', line 11
+      
# File 'lib/felflame/stage_manager.rb', line 11
 
 def add(*scenes_to_add)
   self.scenes |= scenes_to_add
@@ -446,7 +446,7 @@
 54
-
# File 'stage_manager.rb', line 51
+      
# File 'lib/felflame/stage_manager.rb', line 51
 
 def call
   systems.each(&:call)
@@ -508,7 +508,7 @@
 47
-
# File 'stage_manager.rb', line 43
+      
# File 'lib/felflame/stage_manager.rb', line 43
 
 def clear
   systems.clear
@@ -571,7 +571,7 @@
 26
-
# File 'stage_manager.rb', line 22
+      
# File 'lib/felflame/stage_manager.rb', line 22
 
 def remove(*scenes_to_remove)
   self.scenes -= scenes_to_remove
@@ -588,7 +588,7 @@
 
 
       
diff --git a/docs/FelFlame/Systems.html b/docs/FelFlame/Systems.html
index 10b7bf5..49c2686 100644
--- a/docs/FelFlame/Systems.html
+++ b/docs/FelFlame/Systems.html
@@ -99,8 +99,8 @@
   
   
Defined in:
-
felflame.rb,
- system_manager.rb
+
lib/felflame.rb,
+ lib/felflame/system_manager.rb
@@ -594,7 +594,7 @@ 76
-
# File 'system_manager.rb', line 71
+      
# File 'lib/felflame/system_manager.rb', line 71
 
 def initialize(name, priority: 0, &block)
   FelFlame::Systems.const_set(name, self)
@@ -658,7 +658,7 @@
 26
-
# File 'system_manager.rb', line 24
+      
# File 'lib/felflame/system_manager.rb', line 24
 
 def addition_triggers
   @addition_triggers ||= []
@@ -714,7 +714,7 @@
 44
-
# File 'system_manager.rb', line 42
+      
# File 'lib/felflame/system_manager.rb', line 42
 
 def attr_triggers
   @attr_triggers ||= {}
@@ -757,7 +757,7 @@
 9
-
# File 'system_manager.rb', line 7
+      
# File 'lib/felflame/system_manager.rb', line 7
 
 def const_name
   @const_name
@@ -800,7 +800,7 @@
 6
-
# File 'system_manager.rb', line 4
+      
# File 'lib/felflame/system_manager.rb', line 4
 
 def priority
   @priority
@@ -856,7 +856,7 @@
 35
-
# File 'system_manager.rb', line 33
+      
# File 'lib/felflame/system_manager.rb', line 33
 
 def removal_triggers
   @removal_triggers ||= []
@@ -917,7 +917,7 @@
 53
-
# File 'system_manager.rb', line 51
+      
# File 'lib/felflame/system_manager.rb', line 51
 
 def each(&block)
   constants.map { |sym| const_get(sym) }.sort_by(&:priority).reverse.each(&block)
@@ -964,7 +964,7 @@
 81
-
# File 'system_manager.rb', line 79
+      
# File 'lib/felflame/system_manager.rb', line 79
 
 def call
   @block.call
@@ -1146,7 +1146,7 @@
 177
-
# File 'system_manager.rb', line 111
+      
# File 'lib/felflame/system_manager.rb', line 111
 
 def clear_triggers(*trigger_types, component_or_manager: nil)
   trigger_types = [:addition_triggers, :removal_triggers, :attr_triggers] if trigger_types.empty?
@@ -1271,7 +1271,7 @@
 86
-
# File 'system_manager.rb', line 84
+      
# File 'lib/felflame/system_manager.rb', line 84
 
 def redefine(&block)
   @block = block
@@ -1352,7 +1352,7 @@
 186
-
# File 'system_manager.rb', line 182
+      
# File 'lib/felflame/system_manager.rb', line 182
 
 def trigger_when_added(component_or_manager)
   self.addition_triggers |= [component_or_manager]
@@ -1423,7 +1423,7 @@
 211
-
# File 'system_manager.rb', line 199
+      
# File 'lib/felflame/system_manager.rb', line 199
 
 def trigger_when_is_changed(component_or_manager, attr)
   if component_or_manager.attr_triggers[attr].nil?
@@ -1514,7 +1514,7 @@
 195
-
# File 'system_manager.rb', line 191
+      
# File 'lib/felflame/system_manager.rb', line 191
 
 def trigger_when_removed(component_or_manager)
   self.removal_triggers |= [component_or_manager]
@@ -1531,7 +1531,7 @@
 
 
       
diff --git a/docs/Felflame_.html b/docs/Felflame_.html
new file mode 100644
index 0000000..fd1a524
--- /dev/null
+++ b/docs/Felflame_.html
@@ -0,0 +1,143 @@
+
+
+  
+    
+
+
+  Module: Felflame
+  
+    — Documentation by YARD 0.9.26
+  
+
+
+  
+
+  
+
+
+
+
+  
+
+  
+
+
+  
+  
+    
+
+    
+ + +

Module: Felflame + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/felflame/version.rb
+
+ +
+ +

Overview

+
+ +

:nocov: Keeps the version of the Gem

+ + +
+
+
+ + +
+ +

+ Constant Summary + collapse +

+ +
+ +
VERSION = +
+
+ +

The version of the Gem

+ + +
+
+
+ + +
+
+
"2.0.0"
+ +
+ + + + + + + + + + +
+ + + +
+ + \ No newline at end of file diff --git a/docs/_index.html b/docs/_index.html index 98534bd..c5b3318 100644 --- a/docs/_index.html +++ b/docs/_index.html @@ -75,6 +75,90 @@ + + + + +
    +
  • E
  • + +
+ + + + + +
    +
  • S
  • +
      + +
    • + Scenes + + (FelFlame) + +
    • + +
    • + Stage + + (FelFlame) + +
    • + +
    • + Systems + + (FelFlame) + +
    • + +
    +
+ @@ -84,7 +168,7 @@ diff --git a/docs/class_list.html b/docs/class_list.html index 3f4c240..8d7b4f0 100644 --- a/docs/class_list.html +++ b/docs/class_list.html @@ -43,7 +43,7 @@ diff --git a/docs/file.README.html b/docs/file.README.html index 67e4cc5..3098d73 100644 --- a/docs/file.README.html +++ b/docs/file.README.html @@ -195,15 +195,15 @@ ECS stands for Entity, Component, and System.

Entities are essentially "objects" in the game world. To create a new Entity we do the following:

-
@entity = FelFlame::Entities.new
+
@entity = FelFlame::Entities.new
 

or if we want to add (any number of)components to it:

-
@entity = FelFlame::Entites.new(
-  FelFlame::Components::Health.new,
+
@entity = FelFlame::Entites.new(
+  FelFlame::Components::Health.new,
   @component,
-  FelFlame::Components::Armour[7]
+  FelFlame::Components::Armour[7]
 )
 
@@ -211,7 +211,7 @@ ECS stands for Entity, Component, and System.

Once components are created we can access them using their ID like so:

-
@entity = FelFlame::Entities[2]
+
@entity = FelFlame::Entities[2]
 

Get ID

@@ -251,7 +251,7 @@ entity where a new entity will claim that ID. To get the ID of an Entity:

Components are where all the data is stored. The data is stored in variables or accessors in each component. These accessors and their defaults are configured when a component manager is created, like so:

-
@component_manager = FelFlame::Components.new('Stats', :armour, hp: 100)
+
@component_manager = FelFlame::Components.new('Stats', :armour, hp: 100)
 

In this example we created a component manager called "Stats". @@ -265,12 +265,12 @@ When defining attributes symbols should be used.

Now that we have a component manager we can make components from it like so:

-
@component = FelFlame::Components::Stats.new
+
@component = FelFlame::Components::Stats.new
 

Or we can even change the defaults:

-
@component = FelFlame::Components::Stats.new(armour: 'steel')
+
@component = FelFlame::Components::Stats.new(armour: 'steel')
 

Accessing and Getting ID

@@ -279,7 +279,7 @@ When defining attributes symbols should be used.

These IDs are only unique within the scope of their respective Component Managers. Here is how we can get the ID, as well as how to access a Component from its Component Manager.

-
@component = FelFlame::Components::Stats[2]
+
@component = FelFlame::Components::Stats[2]
 @component.id # => 2
 
@@ -307,7 +307,7 @@ Here are the ways to edit attrubutes, followed by the ways to read them.

When you make Systems you will want to be able to iterate over all Components of the same Component Manager(for example iterating over all sprites to render them). Here is how we do that:

-
FelFlame::Components::Sprites.each do |component|
+
FelFlame::Components::Sprites.each do |component|
   #do something with components
 end
 
@@ -325,14 +325,14 @@ Here are the ways to edit attrubutes, followed by the ways to read them.

We can create Systems like so:

-
FelFlame::Systems.new(name: 'Render', priority: 2) do
+
FelFlame::Systems.new(name: 'Render', priority: 2) do
   # Code and Logic
 end
 

The name we assign is how we can access the System, like so:

-
FelFlame::Systems::Render
+
FelFlame::Systems::Render
 

Priority determines the order Systems should be executed, this is used for Scenes and the Stage. @@ -341,8 +341,8 @@ E.g priority 1 will go first, priority 2 will go second, etcetera.

Often we will want to execute some logic on each Component in a given Component Manager so our code might look like this:

-
FelFlame::Systems.new(name: 'Render', priority: 2) do
-  FelFlame::Components::Sprites.each do |component|
+
FelFlame::Systems.new(name: 'Render', priority: 2) do
+  FelFlame::Components::Sprites.each do |component|
     # do something with these components
   end
 end
@@ -352,7 +352,7 @@ E.g priority 1 will go first, priority 2 will go second, etcetera.  

After we create a System, it won't do anything on its own until we tell it to. Here is how:

-
FelFlame::Systems::Render.call
+
FelFlame::Systems::Render.call
 

Sometimes you might want to manually activate a System, but the more common way to have Systems be triggered is to use Scenes and the Stage or the alternative ways of execution.

@@ -362,25 +362,25 @@ E.g priority 1 will go first, priority 2 will go second, etcetera.

Sometimes you want a System to automatically trigger when a special even happens. FelFlame can keep track of when a Component is added, removed, or when an attribute is changed and then execute Systems linked to these events. Here is how to create these links:

# When this Component is added to an Entity, this System will be called
-FelFlame::Systems::PassiveRegen.trigger_when_added(@component)
+FelFlame::Systems::PassiveRegen.trigger_when_added(@component)
 
 # When this Component is removed from an Entity, this System will be called
-FelFlame::Systems::PassiveRegen.trigger_when_removed(@component)
+FelFlame::Systems::PassiveRegen.trigger_when_removed(@component)
 
 # When this Component's health attribute is changed, this System will be called
-FelFlame::Systems::PassiveRegen.trigger_when_is_set(@component, :health)
+FelFlame::Systems::PassiveRegen.trigger_when_is_set(@component, :health)
 

If we want these triggers to happen for all Components that belong to specific Component Manager then we can do that instead:

# When a Component from this Component Manager is added to an Entity, this System will be called
-FelFlame::Systems::PassiveRegen.trigger_when_added(@component_manager)
+FelFlame::Systems::PassiveRegen.trigger_when_added(@component_manager)
 
 # When a Component from this Component Manager is removed from an Entity, this System will be called
-FelFlame::Systems::PassiveRegen.trigger_when_removed(@component_manager)
+FelFlame::Systems::PassiveRegen.trigger_when_removed(@component_manager)
 
 # When this Component's health attribute from this Component Manager is changed, this System will be called
-FelFlame::Systems::PassiveRegen.trigger_when_is_set(@component_manager, :health)
+FelFlame::Systems::PassiveRegen.trigger_when_is_set(@component_manager, :health)
 

We can create any number of these links between Systems, Components, and Component Manangers as we like, simply call the method again with our other Components and Component Managers

@@ -390,41 +390,41 @@ E.g priority 1 will go first, priority 2 will go second, etcetera.

If we wish to remove these links that we created, we can do that using the follwing function in any of the following ways:

# clears ALL triggers with this system
-FelFlame::Systems::PassiveRegen.clear_triggers
+FelFlame::Systems::PassiveRegen.clear_triggers
 
 # clears ALL triggers with this Component Manager
-FelFlame::Systems::PassiveRegen.clear_triggers(@component)
+FelFlame::Systems::PassiveRegen.clear_triggers(@component)
 
 # clear the 'trigger_when_added' for this Component
-FelFlame::Systems::PassiveRegen.clear_triggers(@component, :added)
+FelFlame::Systems::PassiveRegen.clear_triggers(@component, :added)
 
 # clear the 'trigger_when_removed' for this Component
-FelFlame::Systems::PassiveRegen.clear_triggers(@component, :removed)
+FelFlame::Systems::PassiveRegen.clear_triggers(@component, :removed)
 
 # clear the 'trigger_when_is_set' for this Component specifically for the health attribute
-FelFlame::Systems::PassiveRegen.clear_triggers(@component, :is_set, :health)
+FelFlame::Systems::PassiveRegen.clear_triggers(@component, :is_set, :health)
 

Likewise we can do the same with Component Managers:

# clears ALL triggers with this Component
-FelFlame::Systems::PassiveRegen.clear_triggers(@component_manager) 
+FelFlame::Systems::PassiveRegen.clear_triggers(@component_manager) 
 
 # clear the 'trigger_when_added' for this Component Manager
-FelFlame::Systems::PassiveRegen.clear_triggers(@component_manager, :added) 
+FelFlame::Systems::PassiveRegen.clear_triggers(@component_manager, :added) 
 
 # clear the 'trigger_when_removed' for this Component Manager
-FelFlame::Systems::PassiveRegen.clear_triggers(@component_manager, :removed) 
+FelFlame::Systems::PassiveRegen.clear_triggers(@component_manager, :removed) 
 
 # clear the 'trigger_when_is_set' for this Component Manager specifically for the health attribute
-FelFlame::Systems::PassiveRegen.clear_triggers(@component_manager, :is_set, :health) 
+FelFlame::Systems::PassiveRegen.clear_triggers(@component_manager, :is_set, :health) 
 

Redefinition

If we wanted to change what code or logic a given System executes, we could do that with:

-
FelFlame::Systems::PassiveRegen.redefine do
+
FelFlame::Systems::PassiveRegen.redefine do
   # Some new logic or code
 end
 
@@ -435,28 +435,28 @@ E.g priority 1 will go first, priority 2 will go second, etcetera.

Once we have all the core parts of ECS, we will want to organize our Systems. To do this we will use Scenes to group up Systems so they can quickly be enabled or disabled. Note that Alternative Executions will occur even if they are not part of a Scene. Here is how we make a new Scene:

-
@scene = FelFlame::Scenes.new('ExampleScene')
+
@scene = FelFlame::Scenes.new('ExampleScene')
 

Accessing

Just like other classes in FelFlame, the name we gave the Scene is how we access it:

-
@scene = FelFlame::Scenes::ExampleScene
+
@scene = FelFlame::Scenes::ExampleScene
 

Adding Systems

Adding Systems is simple. We can add as many as we want. In this example we add 3 different systems:

-
FelFlame::Scenes::ExampleScene.add(FelFlame::Systems::Render, @system2, @system3)
+
FelFlame::Scenes::ExampleScene.add(FelFlame::Systems::Render, @system2, @system3)
 

Removing Systems

Removing Systems works simularly:

-
FelFlame::Scenes::ExampleScene.remove(FelFlame::Systems::Render, @system2, @system3)
+
FelFlame::Scenes::ExampleScene.remove(FelFlame::Systems::Render, @system2, @system3)
 

Clearing

@@ -481,21 +481,21 @@ E.g priority 1 will go first, priority 2 will go second, etcetera.

Finally we have the Stage. There is only a single Stage and we do not have to create it as it exists by default. By adding a Scene to the Stage we are saying that the Scene is active. To add a Scene we do the following:

-
FelFlame::Stage.add FelFlame::Scene::ExampleScene
+
FelFlame::Stage.add FelFlame::Scene::ExampleScene
 

Removing Scenes

Likewise we can remove Scenes:

-
FelFlame::Stage.remove FelFlame::Scene::ExampleScene
+
FelFlame::Stage.remove FelFlame::Scene::ExampleScene
 

Executing

On each frame of the game we want to execute the Stage once. When the Stage is executed it is progressing your game 1 frame forward. The Stage will make sure for you that all the Systems from all Scenes added will be executed in the correct order according to their priority. Here is how we do it:

-
FelFlame::Stage.call
+
FelFlame::Stage.call
 

Closing Notes

@@ -512,7 +512,7 @@ E.g priority 1 will go first, priority 2 will go second, etcetera.

diff --git a/docs/file.version.html b/docs/file.version.html new file mode 100644 index 0000000..4bc29ad --- /dev/null +++ b/docs/file.version.html @@ -0,0 +1,74 @@ + + + + + + + File: version + + — Documentation by YARD 0.9.26 + + + + + + + + + + + + + + + + + + + +
+ + +
# frozen_string_literal: true
+
+module Felflame
+  VERSION = "2.0.0"
+end
+ + + +
+ + \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 94feb86..d7e23ca 100644 --- a/docs/index.html +++ b/docs/index.html @@ -195,15 +195,15 @@ ECS stands for Entity, Component, and System.

Entities are essentially "objects" in the game world. To create a new Entity we do the following:

-
@entity = FelFlame::Entities.new
+
@entity = FelFlame::Entities.new
 

or if we want to add (any number of)components to it:

-
@entity = FelFlame::Entites.new(
-  FelFlame::Components::Health.new,
+
@entity = FelFlame::Entites.new(
+  FelFlame::Components::Health.new,
   @component,
-  FelFlame::Components::Armour[7]
+  FelFlame::Components::Armour[7]
 )
 
@@ -211,7 +211,7 @@ ECS stands for Entity, Component, and System.

Once components are created we can access them using their ID like so:

-
@entity = FelFlame::Entities[2]
+
@entity = FelFlame::Entities[2]
 

Get ID

@@ -251,7 +251,7 @@ entity where a new entity will claim that ID. To get the ID of an Entity:

Components are where all the data is stored. The data is stored in variables or accessors in each component. These accessors and their defaults are configured when a component manager is created, like so:

-
@component_manager = FelFlame::Components.new('Stats', :armour, hp: 100)
+
@component_manager = FelFlame::Components.new('Stats', :armour, hp: 100)
 

In this example we created a component manager called "Stats". @@ -265,12 +265,12 @@ When defining attributes symbols should be used.

Now that we have a component manager we can make components from it like so:

-
@component = FelFlame::Components::Stats.new
+
@component = FelFlame::Components::Stats.new
 

Or we can even change the defaults:

-
@component = FelFlame::Components::Stats.new(armour: 'steel')
+
@component = FelFlame::Components::Stats.new(armour: 'steel')
 

Accessing and Getting ID

@@ -279,7 +279,7 @@ When defining attributes symbols should be used.

These IDs are only unique within the scope of their respective Component Managers. Here is how we can get the ID, as well as how to access a Component from its Component Manager.

-
@component = FelFlame::Components::Stats[2]
+
@component = FelFlame::Components::Stats[2]
 @component.id # => 2
 
@@ -307,7 +307,7 @@ Here are the ways to edit attrubutes, followed by the ways to read them.

When you make Systems you will want to be able to iterate over all Components of the same Component Manager(for example iterating over all sprites to render them). Here is how we do that:

-
FelFlame::Components::Sprites.each do |component|
+
FelFlame::Components::Sprites.each do |component|
   #do something with components
 end
 
@@ -325,14 +325,14 @@ Here are the ways to edit attrubutes, followed by the ways to read them.

We can create Systems like so:

-
FelFlame::Systems.new(name: 'Render', priority: 2) do
+
FelFlame::Systems.new(name: 'Render', priority: 2) do
   # Code and Logic
 end
 

The name we assign is how we can access the System, like so:

-
FelFlame::Systems::Render
+
FelFlame::Systems::Render
 

Priority determines the order Systems should be executed, this is used for Scenes and the Stage. @@ -341,8 +341,8 @@ E.g priority 1 will go first, priority 2 will go second, etcetera.

Often we will want to execute some logic on each Component in a given Component Manager so our code might look like this:

-
FelFlame::Systems.new(name: 'Render', priority: 2) do
-  FelFlame::Components::Sprites.each do |component|
+
FelFlame::Systems.new(name: 'Render', priority: 2) do
+  FelFlame::Components::Sprites.each do |component|
     # do something with these components
   end
 end
@@ -352,7 +352,7 @@ E.g priority 1 will go first, priority 2 will go second, etcetera.  

After we create a System, it won't do anything on its own until we tell it to. Here is how:

-
FelFlame::Systems::Render.call
+
FelFlame::Systems::Render.call
 

Sometimes you might want to manually activate a System, but the more common way to have Systems be triggered is to use Scenes and the Stage or the alternative ways of execution.

@@ -362,25 +362,25 @@ E.g priority 1 will go first, priority 2 will go second, etcetera.

Sometimes you want a System to automatically trigger when a special even happens. FelFlame can keep track of when a Component is added, removed, or when an attribute is changed and then execute Systems linked to these events. Here is how to create these links:

# When this Component is added to an Entity, this System will be called
-FelFlame::Systems::PassiveRegen.trigger_when_added(@component)
+FelFlame::Systems::PassiveRegen.trigger_when_added(@component)
 
 # When this Component is removed from an Entity, this System will be called
-FelFlame::Systems::PassiveRegen.trigger_when_removed(@component)
+FelFlame::Systems::PassiveRegen.trigger_when_removed(@component)
 
 # When this Component's health attribute is changed, this System will be called
-FelFlame::Systems::PassiveRegen.trigger_when_is_set(@component, :health)
+FelFlame::Systems::PassiveRegen.trigger_when_is_set(@component, :health)
 

If we want these triggers to happen for all Components that belong to specific Component Manager then we can do that instead:

# When a Component from this Component Manager is added to an Entity, this System will be called
-FelFlame::Systems::PassiveRegen.trigger_when_added(@component_manager)
+FelFlame::Systems::PassiveRegen.trigger_when_added(@component_manager)
 
 # When a Component from this Component Manager is removed from an Entity, this System will be called
-FelFlame::Systems::PassiveRegen.trigger_when_removed(@component_manager)
+FelFlame::Systems::PassiveRegen.trigger_when_removed(@component_manager)
 
 # When this Component's health attribute from this Component Manager is changed, this System will be called
-FelFlame::Systems::PassiveRegen.trigger_when_is_set(@component_manager, :health)
+FelFlame::Systems::PassiveRegen.trigger_when_is_set(@component_manager, :health)
 

We can create any number of these links between Systems, Components, and Component Manangers as we like, simply call the method again with our other Components and Component Managers

@@ -390,41 +390,41 @@ E.g priority 1 will go first, priority 2 will go second, etcetera.

If we wish to remove these links that we created, we can do that using the follwing function in any of the following ways:

# clears ALL triggers with this system
-FelFlame::Systems::PassiveRegen.clear_triggers
+FelFlame::Systems::PassiveRegen.clear_triggers
 
 # clears ALL triggers with this Component Manager
-FelFlame::Systems::PassiveRegen.clear_triggers(@component)
+FelFlame::Systems::PassiveRegen.clear_triggers(@component)
 
 # clear the 'trigger_when_added' for this Component
-FelFlame::Systems::PassiveRegen.clear_triggers(@component, :added)
+FelFlame::Systems::PassiveRegen.clear_triggers(@component, :added)
 
 # clear the 'trigger_when_removed' for this Component
-FelFlame::Systems::PassiveRegen.clear_triggers(@component, :removed)
+FelFlame::Systems::PassiveRegen.clear_triggers(@component, :removed)
 
 # clear the 'trigger_when_is_set' for this Component specifically for the health attribute
-FelFlame::Systems::PassiveRegen.clear_triggers(@component, :is_set, :health)
+FelFlame::Systems::PassiveRegen.clear_triggers(@component, :is_set, :health)
 

Likewise we can do the same with Component Managers:

# clears ALL triggers with this Component
-FelFlame::Systems::PassiveRegen.clear_triggers(@component_manager) 
+FelFlame::Systems::PassiveRegen.clear_triggers(@component_manager) 
 
 # clear the 'trigger_when_added' for this Component Manager
-FelFlame::Systems::PassiveRegen.clear_triggers(@component_manager, :added) 
+FelFlame::Systems::PassiveRegen.clear_triggers(@component_manager, :added) 
 
 # clear the 'trigger_when_removed' for this Component Manager
-FelFlame::Systems::PassiveRegen.clear_triggers(@component_manager, :removed) 
+FelFlame::Systems::PassiveRegen.clear_triggers(@component_manager, :removed) 
 
 # clear the 'trigger_when_is_set' for this Component Manager specifically for the health attribute
-FelFlame::Systems::PassiveRegen.clear_triggers(@component_manager, :is_set, :health) 
+FelFlame::Systems::PassiveRegen.clear_triggers(@component_manager, :is_set, :health) 
 

Redefinition

If we wanted to change what code or logic a given System executes, we could do that with:

-
FelFlame::Systems::PassiveRegen.redefine do
+
FelFlame::Systems::PassiveRegen.redefine do
   # Some new logic or code
 end
 
@@ -435,28 +435,28 @@ E.g priority 1 will go first, priority 2 will go second, etcetera.

Once we have all the core parts of ECS, we will want to organize our Systems. To do this we will use Scenes to group up Systems so they can quickly be enabled or disabled. Note that Alternative Executions will occur even if they are not part of a Scene. Here is how we make a new Scene:

-
@scene = FelFlame::Scenes.new('ExampleScene')
+
@scene = FelFlame::Scenes.new('ExampleScene')
 

Accessing

Just like other classes in FelFlame, the name we gave the Scene is how we access it:

-
@scene = FelFlame::Scenes::ExampleScene
+
@scene = FelFlame::Scenes::ExampleScene
 

Adding Systems

Adding Systems is simple. We can add as many as we want. In this example we add 3 different systems:

-
FelFlame::Scenes::ExampleScene.add(FelFlame::Systems::Render, @system2, @system3)
+
FelFlame::Scenes::ExampleScene.add(FelFlame::Systems::Render, @system2, @system3)
 

Removing Systems

Removing Systems works simularly:

-
FelFlame::Scenes::ExampleScene.remove(FelFlame::Systems::Render, @system2, @system3)
+
FelFlame::Scenes::ExampleScene.remove(FelFlame::Systems::Render, @system2, @system3)
 

Clearing

@@ -481,21 +481,21 @@ E.g priority 1 will go first, priority 2 will go second, etcetera.

Finally we have the Stage. There is only a single Stage and we do not have to create it as it exists by default. By adding a Scene to the Stage we are saying that the Scene is active. To add a Scene we do the following:

-
FelFlame::Stage.add FelFlame::Scene::ExampleScene
+
FelFlame::Stage.add FelFlame::Scene::ExampleScene
 

Removing Scenes

Likewise we can remove Scenes:

-
FelFlame::Stage.remove FelFlame::Scene::ExampleScene
+
FelFlame::Stage.remove FelFlame::Scene::ExampleScene
 

Executing

On each frame of the game we want to execute the Stage once. When the Stage is executed it is progressing your game 1 frame forward. The Stage will make sure for you that all the Systems from all Scenes added will be executed in the correct order according to their priority. Here is how we do it:

-
FelFlame::Stage.call
+
FelFlame::Stage.call
 

Closing Notes

@@ -512,7 +512,7 @@ E.g priority 1 will go first, priority 2 will go second, etcetera.

diff --git a/docs/method_list.html b/docs/method_list.html index 48eea1f..4071d1b 100644 --- a/docs/method_list.html +++ b/docs/method_list.html @@ -44,6 +44,430 @@ diff --git a/docs/top-level-namespace.html b/docs/top-level-namespace.html index 6fbfabe..a160bed 100644 --- a/docs/top-level-namespace.html +++ b/docs/top-level-namespace.html @@ -78,6 +78,45 @@ +

Defined Under Namespace

+

+ + + Modules: Felflame + + + + Classes: FelFlame + + +

+ + +

+ Constant Summary + collapse +

+ +
+ +
FF = +
+
+ +

An alias for FelFlame

+ + +
+
+
+ + +
+
+
FelFlame
+ +
+ @@ -90,7 +129,7 @@ -- cgit v1.2.3