Olympe Engine
2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
Source
_deprecated
Object.h
Go to the documentation of this file.
1
/*
2
Olympe Engine V2 2025
3
Nicolas Chereau
4
nchereau@gmail.com
5
6
Purpose:
7
- Class representing a generic object in a game engine, with enumerations for object types and states.
8
9
*/
10
#pragma once
11
#include <string>
12
#include "
system/message.h
"
13
#include <chrono>
14
#include <cstdint>
15
16
using namespace
std;
17
18
enum class
ObjectType
19
{
20
None
= 0,
21
Singleton
,
// e.g. GameEngine, ResourceManager, EventManager, etc.
22
Entity
,
// Player, NPC, Item, etc.
23
Component
,
// Physics, AI, Render, Audio, etc.
24
Level
,
// Game level or environment
25
Sector
,
// Subdivision of a level
26
GraphicMap
,
// Tilemap or similar
27
CollisionMap
,
// Collision data
28
Count
29
};
30
31
class
Object
32
{
33
public
:
34
Object
()
35
{
36
// generate a unique id based on current time in nanoseconds
37
using namespace
std::chrono;
38
auto
now
= system_clock::now();
39
uid
=
static_cast<
uint64_t
>
(
duration_cast<nanoseconds>
(
now
.time_since_epoch()).count());
40
}
41
virtual
~Object
() {};
42
43
public
:
44
45
std::string
name
=
"unnamed_object"
;
46
// virtual ObjectType GetObjectType() const { return ObjectType::None; }
47
48
virtual
void
Process
() {};
49
virtual
void
Render
() {};
50
virtual
void
OnEvent
(
const
Message
&
msg
) {};
51
52
inline
uint64_t
GetUID
()
const
{
return
uid
; }
53
54
protected
:
55
// Object UID
56
uint64_t
uid
= 0;
57
};
58
59
GetComponentTypeID_Static
ComponentTypeID GetComponentTypeID_Static()
Definition
ECS_Entity.h:56
ObjectType
ObjectType
Definition
Object.h:19
ObjectType::CollisionMap
@ CollisionMap
ObjectType::Entity
@ Entity
ObjectType::Component
@ Component
ObjectType::None
@ None
ObjectType::Singleton
@ Singleton
ObjectType::GraphicMap
@ GraphicMap
ObjectType::Level
@ Level
ObjectType::Count
@ Count
ObjectType::Sector
@ Sector
Object
Definition
Object.h:32
Object::name
std::string name
Definition
Object.h:45
Object::Object
Object()
Definition
Object.h:34
Object::OnEvent
virtual void OnEvent(const Message &msg)
Definition
Object.h:50
Object::~Object
virtual ~Object()
Definition
Object.h:41
Object::uid
uint64_t uid
Definition
Object.h:56
Object::Process
virtual void Process()
Definition
Object.h:48
Object::Render
virtual void Render()
Definition
Object.h:49
Object::GetUID
uint64_t GetUID() const
Definition
Object.h:52
message.h
Message
Definition
message.h:10
Generated on Tue Feb 17 2026 13:49:10 for Olympe Engine by
1.9.8