baku 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3acdc8865ba365f5af863c36a85be4db11ed681c
4
- data.tar.gz: eee1b0ba43a5a33483caa7baa809618ee4154961
3
+ metadata.gz: e4e011013e5257d5b0af62562561e971cf0e449b
4
+ data.tar.gz: 31931a5ea325fa8c8cb9e661e339935b83ac14fa
5
5
  SHA512:
6
- metadata.gz: 339e6f8a610ffe4f11101eb98868bc70a5d17959e1f2cb72dbd89238d8dd68e857a18fd76fdb9d80dd73d436c515d50075f6335e6fab742bae6af7de44049fc6
7
- data.tar.gz: 77dbacbd13d4882ef2b9655db1bb52f778224d3f75733b5789b5aba24664f415f57df6bdb03b9573752eb3f2770f547e8c65f4aabc6a9f693adf0bbbdcbb500c
6
+ metadata.gz: b875ecf5c85daf770f8c91387848a93776aac8c5037112c9c9f5cd0832cb9948ebf7bfc321c035e4ce70848738d7622cecdc4607588ea3f45a92795c72f50f5f
7
+ data.tar.gz: 9bf020e852d6e1929541f7ccc7650360cea9d833e0bac78711ed33b196f84edf2a97b588beb98418bce1d94ba0cd4debc531fe6f6623a624114c3c2a3bf0c804
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.2.3
2
+
3
+ * Separate entity retrieval and processing logic in system to allow pre and post-processing.
4
+
1
5
  # 0.2.2
2
6
 
3
7
  * Fix entities being added to entity manager multiple times.
data/lib/baku/system.rb CHANGED
@@ -8,12 +8,18 @@ module Baku
8
8
  @game_loop_step = game_loop_step
9
9
  end
10
10
 
11
- def process_entities
11
+ def execute
12
12
  if @world.nil?
13
13
  raise StandardError.new("Must set :world property of System.")
14
14
  end
15
15
 
16
- @world.entity_manager.get_entities(component_mask).each do |entity|
16
+ entities = @world.entity_manager.get_entities(component_mask)
17
+
18
+ process_entities(entities)
19
+ end
20
+
21
+ def process_entities(entities)
22
+ entities.each do |entity|
17
23
  entity_components = @components.map { |c| entity.get_component(c) }
18
24
  process_entity(entity, *entity_components)
19
25
  end
@@ -26,5 +32,11 @@ module Baku
26
32
  def component_mask
27
33
  @component_mask ||= ComponentMask.from_components(@components)
28
34
  end
35
+
36
+ private
37
+
38
+ def retrieve_entities
39
+ @world.entity_manager.get_entities(component_mask)
40
+ end
29
41
  end
30
42
  end
data/lib/baku/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Baku
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
data/lib/baku/world.rb CHANGED
@@ -44,16 +44,11 @@ module Baku
44
44
 
45
45
  def update(delta_ms)
46
46
  @delta_ms = delta_ms
47
-
48
- @update_systems.each do |system|
49
- system.process_entities
50
- end
47
+ @update_systems.each(&:execute)
51
48
  end
52
49
 
53
50
  def draw
54
- @draw_systems.each do |system|
55
- system.process_entities
56
- end
51
+ @draw_systems.each(&:execute)
57
52
  end
58
53
  end
59
54
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: baku
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Tuttle