(NDK) First commit

-Still missing a build file
-This is an Entity Component System, without any component nor system,
so this is an Entity. Yay.


Former-commit-id: f04d2fdfe8819826f940469c2618140a26afa637
This commit is contained in:
Lynix
2015-02-06 13:56:27 +01:00
parent d6c08db282
commit 5067767074
5 changed files with 345 additions and 0 deletions

View File

@@ -0,0 +1,72 @@
// 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>
namespace Ndk
{
class World;
class NDK_API Entity
{
friend World;
public:
class Id;
Entity();
Entity(const Entity&) = default;
~Entity() = default;
void Kill();
Id GetId() const;
World* GetWorld() const;
bool IsValid() const;
Entity& operator=(const Entity&) = default;
bool operator==(const Entity& other) const;
bool operator!=(const Entity& other) const;
// Identifiant
struct Id
{
struct Part
{
nzUInt32 counter, index;
};
union
{
Part part;
nzUInt64 value;
};
bool operator==(const Id& other) const
{
return value == other.value;
}
bool operator!=(const Id& other) const
{
return !operator==(other);
}
};
private:
Entity(Id id, World* world);
Id m_id;
World* m_world;
};
}
#endif // NDK_ENTITY_HPP