You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Manage time singleton
This commit is contained in:
@@ -189,9 +189,6 @@ static const uint8_t MONTH_DAYS_TABLE[2][12] = {
|
|||||||
Time *Time::singleton = nullptr;
|
Time *Time::singleton = nullptr;
|
||||||
|
|
||||||
Time *Time::get_singleton() {
|
Time *Time::get_singleton() {
|
||||||
if (!singleton) {
|
|
||||||
memnew(Time);
|
|
||||||
}
|
|
||||||
return singleton;
|
return singleton;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -102,6 +102,7 @@ static core_bind::Marshalls *_marshalls = nullptr;
|
|||||||
static core_bind::EngineDebugger *_engine_debugger = nullptr;
|
static core_bind::EngineDebugger *_engine_debugger = nullptr;
|
||||||
|
|
||||||
static IP *ip = nullptr;
|
static IP *ip = nullptr;
|
||||||
|
static Time *_time = nullptr;
|
||||||
|
|
||||||
static core_bind::Geometry2D *_geometry_2d = nullptr;
|
static core_bind::Geometry2D *_geometry_2d = nullptr;
|
||||||
static core_bind::Geometry3D *_geometry_3d = nullptr;
|
static core_bind::Geometry3D *_geometry_3d = nullptr;
|
||||||
@@ -128,6 +129,7 @@ void register_core_types() {
|
|||||||
ObjectDB::setup();
|
ObjectDB::setup();
|
||||||
|
|
||||||
StringName::setup();
|
StringName::setup();
|
||||||
|
_time = memnew(Time);
|
||||||
ResourceLoader::initialize();
|
ResourceLoader::initialize();
|
||||||
|
|
||||||
register_global_constants();
|
register_global_constants();
|
||||||
@@ -436,6 +438,7 @@ void unregister_core_types() {
|
|||||||
ResourceLoader::finalize();
|
ResourceLoader::finalize();
|
||||||
|
|
||||||
ClassDB::cleanup_defaults();
|
ClassDB::cleanup_defaults();
|
||||||
|
memdelete(_time);
|
||||||
ObjectDB::cleanup();
|
ObjectDB::cleanup();
|
||||||
|
|
||||||
Variant::unregister_types();
|
Variant::unregister_types();
|
||||||
|
|||||||
@@ -132,7 +132,6 @@ static InputMap *input_map = nullptr;
|
|||||||
static TranslationServer *translation_server = nullptr;
|
static TranslationServer *translation_server = nullptr;
|
||||||
static Performance *performance = nullptr;
|
static Performance *performance = nullptr;
|
||||||
static PackedData *packed_data = nullptr;
|
static PackedData *packed_data = nullptr;
|
||||||
static Time *time_singleton = nullptr;
|
|
||||||
#ifdef MINIZIP_ENABLED
|
#ifdef MINIZIP_ENABLED
|
||||||
static ZipArchive *zip_packed_data = nullptr;
|
static ZipArchive *zip_packed_data = nullptr;
|
||||||
#endif
|
#endif
|
||||||
@@ -783,7 +782,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
|
|||||||
MAIN_PRINT("Main: Initialize Globals");
|
MAIN_PRINT("Main: Initialize Globals");
|
||||||
|
|
||||||
input_map = memnew(InputMap);
|
input_map = memnew(InputMap);
|
||||||
time_singleton = memnew(Time);
|
|
||||||
globals = memnew(ProjectSettings);
|
globals = memnew(ProjectSettings);
|
||||||
|
|
||||||
register_core_settings(); //here globals are present
|
register_core_settings(); //here globals are present
|
||||||
@@ -2289,9 +2287,6 @@ error:
|
|||||||
if (input_map) {
|
if (input_map) {
|
||||||
memdelete(input_map);
|
memdelete(input_map);
|
||||||
}
|
}
|
||||||
if (time_singleton) {
|
|
||||||
memdelete(time_singleton);
|
|
||||||
}
|
|
||||||
if (translation_server) {
|
if (translation_server) {
|
||||||
memdelete(translation_server);
|
memdelete(translation_server);
|
||||||
}
|
}
|
||||||
@@ -4030,9 +4025,6 @@ void Main::cleanup(bool p_force) {
|
|||||||
if (input_map) {
|
if (input_map) {
|
||||||
memdelete(input_map);
|
memdelete(input_map);
|
||||||
}
|
}
|
||||||
if (time_singleton) {
|
|
||||||
memdelete(time_singleton);
|
|
||||||
}
|
|
||||||
if (translation_server) {
|
if (translation_server) {
|
||||||
memdelete(translation_server);
|
memdelete(translation_server);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user