fireblade-engine / ecs

A dependency free, lightweight, fast Entity-Component System (ECS) implementation in Swift
MIT License
110 stars 11 forks source link

Add family.createMember() #15

Closed ctreffs closed 4 years ago

ctreffs commented 4 years ago

This PR adds a convenience method to families to easily add entities with components required by the family.

An example would be:

let nexus = Nexus()

let name = Name(name: "Some Component")
let position = Position(x: 12, y: 34)

let family = nexus.family(requires: Position.self, Name.self)
let newEntity = family.createMember(with: position, name)

The changes are purely additional.

codecov[bot] commented 4 years ago

Codecov Report

Merging #15 into master will increase coverage by 0.15%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master      #15      +/-   ##
==========================================
+ Coverage   90.66%   90.82%   +0.15%     
==========================================
  Files          23       23              
  Lines         707      719      +12     
==========================================
+ Hits          641      653      +12     
  Misses         66       66