Added a new dummy DisplayServer class.

This commit is contained in:
Relintai 2023-12-12 13:35:51 +01:00
parent 88e9ad04f2
commit c11e564b4e
3 changed files with 133 additions and 0 deletions

View File

@ -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;
}

58
servers/display_server.h Normal file
View File

@ -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

View File

@ -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<ScriptDebuggerRemote::ResourceUsage> *r_usage) {
List<RS::TextureInfo> tinfo;
@ -112,6 +113,8 @@ void register_server_types() {
ClassDB::register_virtual_class<RenderingServer>();
ClassDB::register_virtual_class<DisplayServer>();
ClassDB::register_class<AudioServer>();
ClassDB::register_virtual_class<PhysicsServer>();
@ -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()));