Nazara Engine  0.4
A fast, complete, cross-platform API designed for game development
EntityOwner.hpp
1 // Copyright (C) 2017 Jérôme Leclercq
2 // This file is part of the "Nazara Development Kit"
3 // For conditions of distribution and use, see copyright notice in Prerequesites.hpp
4 
5 #pragma once
6 
7 #ifndef NDK_ENTITYOWNER_HPP
8 #define NDK_ENTITYOWNER_HPP
9 
10 #include <NDK/Entity.hpp>
11 
12 namespace Ndk
13 {
14  class EntityOwner : public EntityHandle
15  {
16  public:
17  EntityOwner() = default;
18  explicit EntityOwner(Entity* entity);
19  EntityOwner(const EntityOwner& handle) = delete;
20  EntityOwner(EntityOwner&& handle) noexcept = default;
21  ~EntityOwner();
22 
23  void Reset(Entity* entity = nullptr);
24  void Reset(EntityOwner&& handle);
25 
26  EntityOwner& operator=(Entity* entity);
27  EntityOwner& operator=(const EntityOwner& handle) = delete;
28  EntityOwner& operator=(EntityOwner&& handle) noexcept = default;
29  };
30 }
31 
32 #include <NDK/EntityOwner.inl>
33 
34 #endif // NDK_ENTITYOwner_HPP
TODO: For now is unable to display different color in the history, it needs a RichTextDrawer to do so...
Definition: Algorithm.hpp:12
NDK class that represents an entity in a world.
Definition: Entity.hpp:28
~EntityOwner()
Destructs the object and calls Reset.
Definition: EntityOwner.inl:35
NDK class that represents the owner of the entity and so its lifetime.
Definition: EntityOwner.hpp:14
void Reset(Entity *entity=nullptr)
Resets the ownership of the entity, previous is killed.
Definition: EntityOwner.inl:46
EntityOwner & operator=(Entity *entity)
Resets the ownership of the entity to the affected one.
Definition: EntityOwner.inl:72