Skip to content

Commit

Permalink
Update README for 1.0.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
alecthomas committed Sep 29, 2014
1 parent 96d5d0d commit 362e165
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# EntityX - A fast, type-safe C++ Entity Component System [![Build Status](https://travis-ci.org/alecthomas/entityx.png)](https://travis-ci.org/alecthomas/entityx)

***NOTE: The current version 1.0.0alpha1 breaks backwards compataibility. See the [change log](CHANGES.md) for details.***
***NOTE: The current stable release 1.0.0 breaks backwards compataibility with < 1.0.0. See the [change log](CHANGES.md) for details.***

Entity Component Systems (ECS) are a form of decomposition that completely decouples entity logic and data from the entity "objects" themselves. The [Evolve your Hierarchy](http://cowboyprogramming.com/2007/01/05/evolve-your-heirachy/) article provides a solid overview of EC systems and why you should use them.

Expand Down
15 changes: 13 additions & 2 deletions entityx/Entity.h
Original file line number Diff line number Diff line change
Expand Up @@ -514,11 +514,16 @@ class EntityManager : entityx::help::NonCopyable {
ComponentHandle<C> assign(Entity::Id id, Args && ... args) {
assert_valid(id);
const BaseComponent::Family family = C::family();

// Placement new into the component pool.
Pool<C> *pool = accomodate_component<C>();
new(pool->get(id.index())) C(std::forward<Args>(args) ...);
ComponentHandle<C> component(this, id);

// Set the bit for this component.
entity_component_mask_[id.index()].set(family);

// Create and return handle.
ComponentHandle<C> component(this, id);
event_manager_.emit<ComponentAddedEvent<C>>(Entity(this, id), component);
return component;
}
Expand All @@ -533,10 +538,16 @@ class EntityManager : entityx::help::NonCopyable {
assert_valid(id);
const BaseComponent::Family family = C::family();
const uint32_t index = id.index();
ComponentHandle<C> component(this, id);

// Find the pool for this component family.
BasePool *pool = component_pools_[family];
ComponentHandle<C> component(this, id);
event_manager_.emit<ComponentRemovedEvent<C>>(Entity(this, id), component);

// Remove component bit.
entity_component_mask_[id.index()].reset(family);

// Call destructor.
pool->destroy(index);
}

Expand Down

0 comments on commit 362e165

Please sign in to comment.