1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
#pragma once
#include <Base/TypeInfo.h>
namespace nCine
{
/// Base class of nCine objects
class Object
{
public:
/// Object types
enum class ObjectType {
Base = 0,
Texture,
Shader,
SceneNode,
Sprite,
MeshSprite,
AnimatedSprite,
Particle,
ParticleSystem,
AudioBuffer,
AudioBufferPlayer,
AudioStreamPlayer
};
/// Constructs an object with a specified type and adds it to the index
explicit Object(ObjectType type);
/// Removes an object from the index and then destroys it
virtual ~Object() = 0;
Object(Object&& other) noexcept;
Object& operator=(Object&& other) noexcept;
/// Returns the object identification number
inline unsigned int id() const {
return _id;
}
/// Returns the object type (RTTI)
inline ObjectType type() const {
return _type;
}
/// Static method to return class type
inline static ObjectType sType() {
return ObjectType::Base;
}
protected:
/// Object type
ObjectType _type;
/// Protected copy constructor used to clone objects
Object(const Object& other);
private:
static std::uint32_t _lastId;
std::uint32_t _id;
Object& operator=(const Object&) = delete;
};
inline Object::~Object() { }
}
|