baku 0.2.4 → 0.2.5

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: '0481123c5896253353a81bda009ad5f4b0d9b125'
4
- data.tar.gz: 515ab80774af68e82f7f75f8583f58f298fd4fa3
3
+ metadata.gz: 4635f01f25cbff83a5aa0938436ed437a367c91f
4
+ data.tar.gz: 98cbe6bac2f0ff44d30379d31835e9aa1b5517e1
5
5
  SHA512:
6
- metadata.gz: d77c3a8e5d55d5ee37ff88e20154432feba06216e3b3812d4f40bd7b5f3f50f31d5e767fe709bc0f525fd42d2cec5677f61640a65032e3bc77f7d49b33f7dccf
7
- data.tar.gz: 6e85d1e2c98aab332fce9a85a4a3908b395cbc8f6d92e17a8fa227c8d3304945b5fe7f1f94c06544c653b64ce848ee21878693ff8a6ccd21dcd7333c7ee1afb7
6
+ metadata.gz: 2d44df506415840612bd94bbe97a97b97578f675f07140148cb23bf10843d99cb2d26272865b2ec457de12790c98936daae4482f6496a117e4de876719bf4ec9
7
+ data.tar.gz: 71e863d553c62ea6685cbb7f66e4e1a96bd7084568cd6d422c623165ff81ea63a68d07492fa66b49afd4e80578bf957b2834ee81e7c7c449e8cbf39a9c716634
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.2.5
2
+
3
+ * Add has_component? to Entity.
4
+
1
5
  # 0.2.4
2
6
 
3
7
  * Add world disposal.
data/README.md CHANGED
@@ -1,16 +1,10 @@
1
1
  # Baku
2
2
 
3
- Baku provides a simple Entity Component System framework for use with Ruby game
4
- engines. It has been tested with [Gosu](https://www.libgosu.org/ruby.html), but
5
- should be flexible enough to work with any Ruby project that has a game loop.
3
+ Baku provides a simple Entity Component System framework for use with Ruby game engines. It has been tested with [Gosu](https://www.libgosu.org/ruby.html), but should be flexible enough to work with any Ruby project that has a game loop.
6
4
 
7
- Baku is still very much a work in progress. There are undoubtedly bugs. I will
8
- be continually iterating and improving on it as I use it for my personal game
9
- development projects. Enjoy!
5
+ Baku is still very much a work in progress. There are undoubtedly bugs. I will be continually iterating and improving on it as I use it for my personal game development projects. Enjoy!
10
6
 
11
- ## Quick Start
12
-
13
- The [Quick Start Guide](https://github.com/jtuttle/baku/wiki/Quick-Start-Guide) will walk you through setting up a basic project with Gosu and Baku.
7
+ The [Baku wiki](https://github.com/jtuttle/baku/wiki) includes a [quick start guide](https://github.com/jtuttle/baku/wiki/quick-start-guide) if you're already familiar with the ECS approach. If not, there is also a descriptive [tutorial](https://github.com/jtuttle/baku/wiki/tutorial) that will cover ECS concepts while walking you through setting up Gosu with Baku.
14
8
 
15
9
  ## Installation
16
10
 
@@ -28,74 +22,6 @@ Or install it yourself as:
28
22
 
29
23
  $ gem install baku
30
24
 
31
- ## Usage
32
-
33
- Create components by overriding `Baku::Component` and calling `super()`. The
34
- example component below simple stores the x and y coordinates of an entity in
35
- a 2D space.
36
-
37
- ```
38
- class TransformComponent < Baku::Component
39
- attr_accessor :x, :y
40
-
41
- def initialize(x, y)
42
- super()
43
-
44
- @x = x
45
- @y = y
46
- end
47
- end
48
- ```
49
-
50
- Create systems by overriding `Baku::System` and calling `super()` to specify the
51
- components that an entity must possess in order for it to be processed by the
52
- system. The example system below will only operate on entities that possess both
53
- a `TransformComponent` and a `VelocityComponent`. You will also need to specify
54
- whether the system will be run during the `:update` or `:draw` loop.
55
-
56
- ```
57
- class MovementSystem < Baku::System
58
- def initialize
59
- super([TransformComponent, VelocityComponent], :update)
60
- end
61
-
62
- def process_entity(entity, transform, velocity)
63
- transform.x += velocity.x
64
- transform.y += velocity.y
65
- end
66
- end
67
- ```
68
-
69
- In your game initialization logic, create a `Baku::World` instance and register
70
- any systems you want to use. In the below example, we register our example
71
- system from above and create an entity that will be processed by the system:
72
-
73
- ```
74
- def game_initialization
75
- @world = Baku::World.new
76
- @world.add_system(MovementSystem.new)
77
-
78
- entity = @world.create_entity
79
- entity.add_component(TransformComponent)
80
- entity.add_component(VelocityComponent)
81
- end
82
- ```
83
-
84
- In your game `update` and `draw` loops, call the `Baku::World` instance's
85
- `update` and `draw` methods. You'll want to keep track of the millseconds
86
- between frames and pass that to the `update` method if you're planning to
87
- use the entity component system for anything that needs it.
88
-
89
- ```
90
- def game_update_loop
91
- @world.update(delta_ms)
92
- end
93
-
94
- def game_draw_loop
95
- @world.draw
96
- end
97
- ```
98
-
99
25
  ## Development
100
26
 
101
27
  After checking out the repo, run `bin/setup` to install dependencies. Then, run
data/lib/baku/entity.rb CHANGED
@@ -34,6 +34,10 @@ module Baku
34
34
 
35
35
  dispatch_event(:component_removed, self, @components[component_class])
36
36
  end
37
+
38
+ def has_component?(component_class)
39
+ @components.has_key?(component_class)
40
+ end
37
41
 
38
42
  def get_component(component_class)
39
43
  @components[component_class]
data/lib/baku/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Baku
2
- VERSION = "0.2.4"
2
+ VERSION = "0.2.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: baku
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Tuttle
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-10-03 00:00:00.000000000 Z
11
+ date: 2017-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler