From 1531c393a0b8b7c7a0451820fe3905b0b4e71079 Mon Sep 17 00:00:00 2001 From: realtradam Date: Wed, 26 May 2021 07:41:45 -0400 Subject: dynamic components can be created --- README.mdown | 5 +- component_manager.rb | 48 +++++++------- components/00_renderable.rb | 3 + components/01_sprite.rb | 13 ++++ components/02_label.rb | 5 ++ components/03_player_control.rb | 5 ++ helpers/01_component.rb | 143 +++++++++++++++++++--------------------- signatures.rb | 64 +++++------------- 8 files changed, 140 insertions(+), 146 deletions(-) diff --git a/README.mdown b/README.mdown index a8f3b46..3324697 100644 --- a/README.mdown +++ b/README.mdown @@ -45,8 +45,9 @@ FF::Cmp::Name.new(param1: value1) FF::Cmp::Name.get_by_entity(entity_id) # gets array of components @component.set(param2: 'not default') @component.param2 = 'different not default' -FF::Cmp::Name.delete(component_id) -FF::Cmp::Name.delete_by_entity(entity_id) # deletes all related components attached to entity +FF::Cmp::Name.detach(entity_id: ent_id, component_id: cmp_id) +FF::Cmp::Name.remove_entity(entity_id) # Removes entity from any components +FF::Cmp::Name.delete_component(component_id) # deletes component and removes from all relevant entities @component.dump # returns hash of all variables!(and the id) FF::Cmp::Name.load @component_dump diff --git a/component_manager.rb b/component_manager.rb index f54c5f6..2f1b2e2 100644 --- a/component_manager.rb +++ b/component_manager.rb @@ -2,32 +2,36 @@ #require 'app/ECS/components/00_test_component.rb' #require 'app/ECS/components/01_based.rb' - -class Components - class <