-
Notifications
You must be signed in to change notification settings - Fork 1
/
register_types.cpp
42 lines (34 loc) · 1002 Bytes
/
register_types.cpp
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
#include "register_types.h"
#include "core/class_db.h"
#include "core/engine.h"
#include "src/entities_manager.h"
#include "src/entity_registry.h"
#include "src/entity_node.h"
#include "src/bestia_server.h"
static BestiaServer *bestia_server = NULL;
static _BestiaServer *_bestia_server = NULL;
void register_bestia_types()
{
ClassDB::register_class<bestia::EntitiesManager>();
ClassDB::register_class<bestia::EntityNode>();
bestia::EntityRegistry::create_singleton();
bestia_server = memnew(BestiaServer);
bestia_server->init();
_bestia_server = memnew(_BestiaServer);
ClassDB::register_class<_BestiaServer>();
Engine::get_singleton()->add_singleton(Engine::Singleton("BestiaServer", _BestiaServer::get_singleton()));
}
void unregister_bestia_types()
{
bestia::EntityRegistry::destroy_singleton();
if (bestia_server)
{
bestia_server->finish();
memdelete(bestia_server);
bestia_server = NULL;
}
if (_bestia_server)
{
memdelete(_bestia_server);
}
}