Files
NazaraEngine/SDK/include/NDK/Entity.hpp
Lynix 924d10e61c (Entity) Changed handle storage from a set to a vector
For performances reasons (creating handles no longer require any memory
allocation)


Former-commit-id: 76d705997c7fa3be78b063c6d602b09c7c20b2fd
2015-02-19 23:35:15 +01:00

61 lines
1.0 KiB
C++

// Copyright (C) 2015 Jérôme Leclercq
// This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp
#pragma once
#ifndef NDK_ENTITY_HPP
#define NDK_ENTITY_HPP
#include <NDK/Prerequesites.hpp>
#include <vector>
namespace Ndk
{
class EntityHandle;
class World;
class NDK_API Entity
{
friend EntityHandle;
friend World;
public:
using Id = nzUInt32;
Entity(const Entity&) = delete;
Entity(Entity&& entity);
~Entity();
EntityHandle CreateHandle();
Id GetId() const;
World* GetWorld() const;
void Kill();
bool IsValid() const;
Entity& operator=(const Entity&) = delete;
Entity& operator=(Entity&&) = delete;
private:
Entity(World& world, Id id);
void Create();
void Destroy();
void RegisterHandle(EntityHandle* handle);
void UnregisterHandle(EntityHandle* handle);
std::vector<EntityHandle*> m_handles;
Id m_id;
World* m_world;
bool m_valid;
};
}
#include <NDK/Entity.inl>
#endif // NDK_ENTITY_HPP