draco 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/README.md +2 -2
  4. data/lib/draco.rb +19 -4
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 363ccf9c3649a752219bca392bdc13b88defbd864a63afb5615969986e59c070
4
- data.tar.gz: 81dcbc8225646cec6efc357ecaacfd89334e9a183caad035cf4bd2ece9a01470
3
+ metadata.gz: 1886b23bb2d098362aa4452b25922fc98fb033fd86f0b8360586da1406bd5810
4
+ data.tar.gz: 9c0e7314c301c7b879ec71bbe8eb8966b04d6c85093d176a2d0c658cb0ad5b0b
5
5
  SHA512:
6
- metadata.gz: aa089a7a6abe9b615d07e8def023fad13fedcbca605e78bc1acf181431b1659961811074a9238f79702b7e1e9ddd76782a173fd079ed5f7ae04a2ee83905c660
7
- data.tar.gz: e6a70346719b8cf5e5269924158bcbad7ed4ea66440686c57931b7dc6232d467adf6abeac5740970e6d16a573d61a66af27c5626599ed115a7a87624d9ac9bdf
6
+ metadata.gz: 29ebe2a5000a3966d4269df1ee0fb7046b0c830f8f5ed589e918d953665da8e0d1f8992d71fb9f2f2b76339fd390821f4732b60488f84daad6ceec3638caa715
7
+ data.tar.gz: 3f617f62d43e4c680a7983278b465cf5498594883581ad0571368a10ef59e80a35969a1c7cdfbdab114ee808b718782433e467761fdf8fc952229643d6d2e27e
@@ -1,3 +1,9 @@
1
+ ## 0.5.1 (December 31, 2020)
2
+
3
+ Features:
4
+
5
+ - Add an alias to `Draco::Tag` in Entities and Systems.
6
+
1
7
  ## 0.5.0 (December 31, 2020)
2
8
 
3
9
  Features:
data/README.md CHANGED
@@ -92,7 +92,7 @@ Often we have types of entities that are reused throughout the game. We can defi
92
92
  ```ruby
93
93
  class Goblin < Draco::Entity
94
94
  component Position, x: 50, y: 50
95
- component Visible
95
+ component Tag(:visible)
96
96
  end
97
97
 
98
98
  goblin = Goblin.new
@@ -123,7 +123,7 @@ entities that include all of the given components.
123
123
 
124
124
  ```ruby
125
125
  class RenderSpriteSystem < Draco::System
126
- filter Visible, Position, Sprite
126
+ filter Tag(:visible), Position, Sprite
127
127
 
128
128
  def tick(args)
129
129
  # You can also access the world that called the system.
@@ -5,7 +5,7 @@
5
5
  # An Entity Component System is an architectural pattern used in game development to decouple behavior from objects.
6
6
  module Draco
7
7
  # Public: The version of the library. Draco uses semver to version releases.
8
- VERSION = "0.5.0"
8
+ VERSION = "0.5.1"
9
9
 
10
10
  # Public: A general purpose game object that consists of a unique id and a collection of Components.
11
11
  class Entity
@@ -39,6 +39,15 @@ module Draco
39
39
  @default_components[component] = defaults
40
40
  end
41
41
 
42
+ # Public: Creates a tag Component. If the tag already exists, return it.
43
+ #
44
+ # name - The string or symbol name of the component.
45
+ #
46
+ # Returns a class with subclass Draco::Component.
47
+ def self.Tag(name) # rubocop:disable Naming/MethodName
48
+ Draco::Tag(name)
49
+ end
50
+
42
51
  class << self
43
52
  # Internal: Returns the default components for the class.
44
53
  attr_reader :default_components
@@ -300,9 +309,6 @@ module Draco
300
309
  end
301
310
  end
302
311
 
303
- # Internal: Empty module to enable Tag() method.
304
- module Tag; end
305
-
306
312
  # Public: Creates a new empty component at runtime. If the given Class already exists, it reuses the existing Class.
307
313
  #
308
314
  # name - The symbol or string name of the component. It can be either camelcase or underscored.
@@ -349,6 +355,15 @@ module Draco
349
355
  sub.instance_variable_set(:@filter, [])
350
356
  end
351
357
 
358
+ # Public: Creates a tag Component. If the tag already exists, return it.
359
+ #
360
+ # name - The string or symbol name of the component.
361
+ #
362
+ # Returns a class with subclass Draco::Component.
363
+ def self.Tag(name) # rubocop:disable Naming/MethodName
364
+ Draco::Tag(name)
365
+ end
366
+
352
367
  # Public: Initializes a new System.
353
368
  #
354
369
  # entities - The Entities to operate on (default: []).
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: draco
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Pruitt