From c11e564b4e29481500ab729057352e825007fd55 Mon Sep 17 00:00:00 2001 From: Relintai Date: Tue, 12 Dec 2023 13:35:51 +0100 Subject: [PATCH] Added a new dummy DisplayServer class. --- servers/display_server.cpp | 71 +++++++++++++++++++++++++++++++ servers/display_server.h | 58 +++++++++++++++++++++++++ servers/register_server_types.cpp | 4 ++ 3 files changed, 133 insertions(+) create mode 100644 servers/display_server.cpp create mode 100644 servers/display_server.h diff --git a/servers/display_server.cpp b/servers/display_server.cpp new file mode 100644 index 000000000..3c692fceb --- /dev/null +++ b/servers/display_server.cpp @@ -0,0 +1,71 @@ +/*************************************************************************/ +/* DisplayServer.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#include "display_server.h" + +DisplayServer *DisplayServer::singleton = nullptr; +DisplayServer *(*DisplayServer::create_func)() = nullptr; + +DisplayServer *DisplayServer::get_singleton() { + return singleton; +} + +DisplayServer *DisplayServer::create() { + ERR_FAIL_COND_V(singleton, nullptr); + + if (create_func) { + return create_func(); + } + + return nullptr; +} + +void DisplayServer::_bind_methods() { + //ClassDB::bind_method(D_METHOD("force_sync"), &DisplayServer::sync); + + //ClassDB::bind_method(D_METHOD("is_render_loop_enabled"), &DisplayServer::is_render_loop_enabled); + //ClassDB::bind_method(D_METHOD("set_render_loop_enabled", "enabled"), &DisplayServer::set_render_loop_enabled); + //ADD_PROPERTY(PropertyInfo(Variant::BOOL, "render_loop_enabled"), "set_render_loop_enabled", "is_render_loop_enabled"); + + //BIND_CONSTANT(NO_INDEX_ARRAY); + + //BIND_ENUM_CONSTANT(CUBEMAP_LEFT); + + //ADD_SIGNAL(MethodInfo("frame_pre_draw")); +} + +DisplayServer::DisplayServer() { + //ERR_FAIL_COND(singleton); + singleton = this; +} + +DisplayServer::~DisplayServer() { + singleton = nullptr; +} diff --git a/servers/display_server.h b/servers/display_server.h new file mode 100644 index 000000000..881c22520 --- /dev/null +++ b/servers/display_server.h @@ -0,0 +1,58 @@ +#ifndef DISPLAY_SERVER_H +#define DISPLAY_SERVER_H + +/*************************************************************************/ +/* display_server.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#include "core/containers/rid.h" +#include "core/object/object.h" + +class DisplayServer : public Object { + GDCLASS(DisplayServer, Object); + + static DisplayServer *singleton; + +protected: + static DisplayServer *(*create_func)(); + + static void _bind_methods(); + +public: + static DisplayServer *get_singleton(); + static DisplayServer *create(); + + + DisplayServer(); + virtual ~DisplayServer(); +}; + +//VARIANT_ENUM_CAST(DisplayServer::); + +#endif diff --git a/servers/register_server_types.cpp b/servers/register_server_types.cpp index 43f4c6589..e81f37c07 100644 --- a/servers/register_server_types.cpp +++ b/servers/register_server_types.cpp @@ -67,6 +67,7 @@ #include "servers/physics_2d_server.h" #include "servers/physics_server.h" #include "servers/rendering_server.h" +#include "servers/display_server.h" static void _debugger_get_resource_usage(List *r_usage) { List tinfo; @@ -112,6 +113,8 @@ void register_server_types() { ClassDB::register_virtual_class(); + ClassDB::register_virtual_class(); + ClassDB::register_class(); ClassDB::register_virtual_class(); @@ -225,6 +228,7 @@ void unregister_server_types() { void register_server_singletons() { Engine::get_singleton()->add_singleton(Engine::Singleton("RenderingServer", RenderingServer::get_singleton())); + Engine::get_singleton()->add_singleton(Engine::Singleton("DisplayServer", DisplayServer::get_singleton())); Engine::get_singleton()->add_singleton(Engine::Singleton("PhysicsServer", PhysicsServer::get_singleton())); Engine::get_singleton()->add_singleton(Engine::Singleton("Physics2DServer", Physics2DServer::get_singleton())); Engine::get_singleton()->add_singleton(Engine::Singleton("AudioServer", AudioServer::get_singleton()));