added default constructor to actor

This commit is contained in:
Michele Caini
2019-06-13 06:52:01 +02:00
parent 7a3fa68468
commit 6101feda10
3 changed files with 11 additions and 3 deletions

1
TODO
View File

@@ -22,6 +22,5 @@
- standard each, use bitmask to speed up the whole thing and avoid accessing the pools to test for the page
- iterator based each with a couple of iterators passed from outside (use bitmask + has)
* stable component handle that isn't affected by reallocations
* default constructor + init/re-init function to actor
* multi component registry::remove and some others?
* built-in support for dual (or N-) buffering

View File

@@ -29,6 +29,10 @@ struct basic_actor {
/*! @brief Underlying entity identifier. */
using entity_type = Entity;
basic_actor() ENTT_NOEXCEPT
: reg{nullptr}, entt{entt::null}
{}
/**
* @brief Constructs an actor by using the given registry.
* @param ref An entity-component system properly initialized.

View File

@@ -42,11 +42,16 @@ TEST(Actor, Component) {
TEST(Actor, EntityLifetime) {
entt::registry registry;
entt::actor actor{registry};
entt::actor actor{};
ASSERT_FALSE(actor);
actor = entt::actor{registry};
actor.assign<int>();
ASSERT_TRUE(actor);
ASSERT_TRUE(actor);
ASSERT_FALSE(registry.empty<int>());
ASSERT_FALSE(registry.empty());
registry.destroy(actor.entity());