mirror of
https://github.com/Relintai/pandemonium_engine_minimal.git
synced 2024-11-17 22:17:19 +01:00
Removed the window server.
This commit is contained in:
parent
55207c94de
commit
c1b34be977
@ -67,7 +67,6 @@
|
||||
#include "servers/physics_2d_server.h"
|
||||
#include "servers/physics_server.h"
|
||||
#include "servers/rendering_server.h"
|
||||
#include "servers/window_server.h"
|
||||
|
||||
static void _debugger_get_resource_usage(List<ScriptDebuggerRemote::ResourceUsage> *r_usage) {
|
||||
List<RS::TextureInfo> tinfo;
|
||||
@ -112,9 +111,7 @@ void register_server_types() {
|
||||
OS::get_singleton()->set_has_server_feature_callback(has_server_feature_callback);
|
||||
|
||||
ClassDB::register_virtual_class<RenderingServer>();
|
||||
|
||||
ClassDB::register_virtual_class<WindowServer>();
|
||||
|
||||
|
||||
ClassDB::register_class<AudioServer>();
|
||||
|
||||
ClassDB::register_virtual_class<PhysicsServer>();
|
||||
@ -228,7 +225,6 @@ 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("WindowServer", WindowServer::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()));
|
||||
|
@ -1,159 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* WindowServer.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 "window_server.h"
|
||||
|
||||
WindowServer *WindowServer::singleton = nullptr;
|
||||
WindowServer *(*WindowServer::create_func)() = nullptr;
|
||||
|
||||
int64_t WindowServer::get_native_handle_bind(HandleType p_handle_type) {
|
||||
return (int64_t)get_native_handle(p_handle_type);
|
||||
}
|
||||
|
||||
WindowServer *WindowServer::get_singleton() {
|
||||
return singleton;
|
||||
}
|
||||
|
||||
WindowServer *WindowServer::create() {
|
||||
ERR_FAIL_COND_V(singleton, nullptr);
|
||||
|
||||
if (create_func) {
|
||||
return create_func();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void WindowServer::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_screen_count"), &WindowServer::get_screen_count);
|
||||
ClassDB::bind_method(D_METHOD("get_current_screen"), &WindowServer::get_current_screen);
|
||||
ClassDB::bind_method(D_METHOD("set_current_screen", "screen"), &WindowServer::set_current_screen);
|
||||
ClassDB::bind_method(D_METHOD("get_screen_position", "screen"), &WindowServer::get_screen_position, DEFVAL(-1));
|
||||
ClassDB::bind_method(D_METHOD("get_screen_size", "screen"), &WindowServer::get_screen_size, DEFVAL(-1));
|
||||
ClassDB::bind_method(D_METHOD("get_screen_dpi", "screen"), &WindowServer::get_screen_dpi, DEFVAL(-1));
|
||||
ClassDB::bind_method(D_METHOD("get_screen_scale", "screen"), &WindowServer::get_screen_scale, DEFVAL(-1));
|
||||
ClassDB::bind_method(D_METHOD("get_screen_max_scale"), &WindowServer::get_screen_max_scale);
|
||||
ClassDB::bind_method(D_METHOD("get_screen_refresh_rate", "screen"), &WindowServer::get_screen_refresh_rate, DEFVAL(-1));
|
||||
ClassDB::bind_method(D_METHOD("get_window_position"), &WindowServer::get_window_position);
|
||||
ClassDB::bind_method(D_METHOD("set_window_position", "position"), &WindowServer::set_window_position);
|
||||
ClassDB::bind_method(D_METHOD("get_window_size"), &WindowServer::get_window_size);
|
||||
ClassDB::bind_method(D_METHOD("get_max_window_size"), &WindowServer::get_max_window_size);
|
||||
ClassDB::bind_method(D_METHOD("get_min_window_size"), &WindowServer::get_min_window_size);
|
||||
ClassDB::bind_method(D_METHOD("set_max_window_size", "size"), &WindowServer::set_max_window_size);
|
||||
ClassDB::bind_method(D_METHOD("set_min_window_size", "size"), &WindowServer::set_min_window_size);
|
||||
ClassDB::bind_method(D_METHOD("set_window_size", "size"), &WindowServer::set_window_size);
|
||||
ClassDB::bind_method(D_METHOD("set_window_fullscreen", "enabled"), &WindowServer::set_window_fullscreen);
|
||||
ClassDB::bind_method(D_METHOD("is_window_fullscreen"), &WindowServer::is_window_fullscreen);
|
||||
ClassDB::bind_method(D_METHOD("set_window_resizable", "enabled"), &WindowServer::set_window_resizable);
|
||||
ClassDB::bind_method(D_METHOD("is_window_resizable"), &WindowServer::is_window_resizable);
|
||||
ClassDB::bind_method(D_METHOD("set_window_minimized", "enabled"), &WindowServer::set_window_minimized);
|
||||
ClassDB::bind_method(D_METHOD("is_window_minimized"), &WindowServer::is_window_minimized);
|
||||
ClassDB::bind_method(D_METHOD("set_window_maximized", "enabled"), &WindowServer::set_window_maximized);
|
||||
ClassDB::bind_method(D_METHOD("is_window_maximized"), &WindowServer::is_window_maximized);
|
||||
ClassDB::bind_method(D_METHOD("set_window_always_on_top", "enabled"), &WindowServer::set_window_always_on_top);
|
||||
ClassDB::bind_method(D_METHOD("is_window_always_on_top"), &WindowServer::is_window_always_on_top);
|
||||
ClassDB::bind_method(D_METHOD("is_window_focused"), &WindowServer::is_window_focused);
|
||||
ClassDB::bind_method(D_METHOD("request_attention"), &WindowServer::request_attention);
|
||||
ClassDB::bind_method(D_METHOD("get_real_window_size"), &WindowServer::get_real_window_size);
|
||||
ClassDB::bind_method(D_METHOD("center_window"), &WindowServer::center_window);
|
||||
ClassDB::bind_method(D_METHOD("move_window_to_foreground"), &WindowServer::move_window_to_foreground);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_native_handle", "handle_type"), &WindowServer::get_native_handle_bind);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_borderless_window", "borderless"), &WindowServer::set_borderless_window);
|
||||
ClassDB::bind_method(D_METHOD("get_borderless_window"), &WindowServer::get_borderless_window);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_window_per_pixel_transparency_enabled"), &WindowServer::get_window_per_pixel_transparency_enabled);
|
||||
ClassDB::bind_method(D_METHOD("set_window_per_pixel_transparency_enabled", "enabled"), &WindowServer::set_window_per_pixel_transparency_enabled);
|
||||
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "current_screen"), "set_current_screen", "get_current_screen");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "min_window_size"), "set_min_window_size", "get_min_window_size");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "max_window_size"), "set_max_window_size", "get_max_window_size");
|
||||
//Main Window
|
||||
ADD_GROUP("Window", "window_");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "window_borderless"), "set_borderless_window", "get_borderless_window");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "window_per_pixel_transparency_enabled"), "set_window_per_pixel_transparency_enabled", "get_window_per_pixel_transparency_enabled");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "window_fullscreen"), "set_window_fullscreen", "is_window_fullscreen");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "window_maximized"), "set_window_maximized", "is_window_maximized");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "window_minimized"), "set_window_minimized", "is_window_minimized");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "window_resizable"), "set_window_resizable", "is_window_resizable");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "window_position"), "set_window_position", "get_window_position");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "window_size"), "set_window_size", "get_window_size");
|
||||
|
||||
// Those default values need to be specified for the docs generator,
|
||||
// to avoid using values from the documentation writer's own OS instance.
|
||||
ADD_PROPERTY_DEFAULT("clipboard", "");
|
||||
ADD_PROPERTY_DEFAULT("current_screen", 0);
|
||||
ADD_PROPERTY_DEFAULT("tablet_driver", "");
|
||||
ADD_PROPERTY_DEFAULT("exit_code", 0);
|
||||
ADD_PROPERTY_DEFAULT("vsync_enabled", true);
|
||||
ADD_PROPERTY_DEFAULT("vsync_via_compositor", false);
|
||||
ADD_PROPERTY_DEFAULT("low_processor_usage_mode", false);
|
||||
ADD_PROPERTY_DEFAULT("low_processor_usage_mode_sleep_usec", 6900);
|
||||
ADD_PROPERTY_DEFAULT("keep_screen_on", true);
|
||||
ADD_PROPERTY_DEFAULT("min_window_size", Vector2());
|
||||
ADD_PROPERTY_DEFAULT("max_window_size", Vector2());
|
||||
ADD_PROPERTY_DEFAULT("screen_orientation", 0);
|
||||
ADD_PROPERTY_DEFAULT("window_borderless", false);
|
||||
ADD_PROPERTY_DEFAULT("window_per_pixel_transparency_enabled", false);
|
||||
ADD_PROPERTY_DEFAULT("window_fullscreen", false);
|
||||
ADD_PROPERTY_DEFAULT("window_maximized", false);
|
||||
ADD_PROPERTY_DEFAULT("window_minimized", false);
|
||||
ADD_PROPERTY_DEFAULT("window_resizable", true);
|
||||
ADD_PROPERTY_DEFAULT("window_position", Vector2());
|
||||
ADD_PROPERTY_DEFAULT("window_size", Vector2());
|
||||
|
||||
BIND_ENUM_CONSTANT(DISPLAY_HANDLE);
|
||||
BIND_ENUM_CONSTANT(WINDOW_HANDLE);
|
||||
BIND_ENUM_CONSTANT(WINDOW_VIEW);
|
||||
BIND_ENUM_CONSTANT(OPENGL_CONTEXT);
|
||||
|
||||
//ClassDB::bind_method(D_METHOD("force_sync"), &WindowServer::sync);
|
||||
|
||||
//ClassDB::bind_method(D_METHOD("is_render_loop_enabled"), &WindowServer::is_render_loop_enabled);
|
||||
//ClassDB::bind_method(D_METHOD("set_render_loop_enabled", "enabled"), &WindowServer::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"));
|
||||
}
|
||||
|
||||
WindowServer::WindowServer() {
|
||||
//ERR_FAIL_COND(singleton);
|
||||
singleton = this;
|
||||
}
|
||||
|
||||
WindowServer::~WindowServer() {
|
||||
singleton = nullptr;
|
||||
}
|
@ -1,142 +0,0 @@
|
||||
#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 WindowServer : public Object {
|
||||
GDCLASS(WindowServer, Object);
|
||||
|
||||
static WindowServer *singleton;
|
||||
|
||||
public:
|
||||
const float SCREEN_REFRESH_RATE_FALLBACK = -1.0;
|
||||
struct VideoMode {
|
||||
int width, height;
|
||||
bool fullscreen;
|
||||
bool resizable;
|
||||
bool borderless_window;
|
||||
bool maximized;
|
||||
bool always_on_top;
|
||||
bool use_vsync;
|
||||
bool vsync_via_compositor;
|
||||
bool layered;
|
||||
|
||||
float get_aspect() const { return (float)width / (float)height; }
|
||||
|
||||
VideoMode(int p_width = 1024, int p_height = 600, bool p_fullscreen = false, bool p_resizable = true, bool p_borderless_window = false, bool p_maximized = false, bool p_always_on_top = false, bool p_use_vsync = false, bool p_vsync_via_compositor = false) {
|
||||
width = p_width;
|
||||
height = p_height;
|
||||
fullscreen = p_fullscreen;
|
||||
resizable = p_resizable;
|
||||
borderless_window = p_borderless_window;
|
||||
maximized = p_maximized;
|
||||
always_on_top = p_always_on_top;
|
||||
use_vsync = p_use_vsync;
|
||||
vsync_via_compositor = p_vsync_via_compositor;
|
||||
layered = false;
|
||||
}
|
||||
};
|
||||
|
||||
virtual int get_screen_count() const { return 1; }
|
||||
virtual int get_current_screen() const { return 0; }
|
||||
virtual void set_current_screen(int p_screen) {}
|
||||
virtual Point2 get_screen_position(int p_screen = -1) const { return Point2(); }
|
||||
virtual Size2 get_screen_size(int p_screen = -1) const { return get_window_size(); }
|
||||
virtual int get_screen_dpi(int p_screen = -1) const { return 72; }
|
||||
virtual float get_screen_scale(int p_screen = -1) const { return 1.0; }
|
||||
virtual float get_screen_max_scale() const { return 1.0; };
|
||||
virtual float get_screen_refresh_rate(int p_screen = -1) const { return SCREEN_REFRESH_RATE_FALLBACK; };
|
||||
virtual Point2 get_window_position() const { return Vector2(); }
|
||||
virtual void set_window_position(const Point2 &p_position) {}
|
||||
virtual Size2 get_max_window_size() const { return Size2(); };
|
||||
virtual Size2 get_min_window_size() const { return Size2(); };
|
||||
virtual Size2 get_window_size() const { return Size2(); };
|
||||
virtual Size2 get_real_window_size() const { return get_window_size(); }
|
||||
virtual void set_min_window_size(const Size2 p_size) {}
|
||||
virtual void set_max_window_size(const Size2 p_size) {}
|
||||
virtual void set_window_size(const Size2 p_size) {}
|
||||
virtual void set_window_fullscreen(bool p_enabled) {}
|
||||
virtual bool is_window_fullscreen() const { return true; }
|
||||
virtual void set_window_resizable(bool p_enabled) {}
|
||||
virtual bool is_window_resizable() const { return false; }
|
||||
virtual void set_window_minimized(bool p_enabled) {}
|
||||
virtual bool is_window_minimized() const { return false; }
|
||||
virtual void set_window_maximized(bool p_enabled) {}
|
||||
virtual bool is_window_maximized() const { return true; }
|
||||
virtual void set_window_always_on_top(bool p_enabled) {}
|
||||
virtual bool is_window_always_on_top() const { return false; }
|
||||
virtual bool is_window_focused() const { return true; }
|
||||
virtual void request_attention() {}
|
||||
virtual void center_window() {}
|
||||
|
||||
//WindowServer
|
||||
enum HandleType {
|
||||
DISPLAY_HANDLE, // X11::Display* ...
|
||||
WINDOW_HANDLE, // HWND, X11::Window*, NSWindow*, UIWindow*, Android activity ...
|
||||
WINDOW_VIEW, // HDC, NSView*, UIView*, Android surface ...
|
||||
OPENGL_CONTEXT, // HGLRC, X11::GLXContext, NSOpenGLContext*, EGLContext* ...
|
||||
};
|
||||
|
||||
virtual void *get_native_handle(int p_handle_type) { return nullptr; };
|
||||
virtual int64_t get_native_handle_bind(HandleType p_handle_type);
|
||||
|
||||
virtual void set_borderless_window(bool p_borderless) {}
|
||||
virtual bool get_borderless_window() { return false; }
|
||||
|
||||
virtual bool get_window_per_pixel_transparency_enabled() const { return false; }
|
||||
virtual void set_window_per_pixel_transparency_enabled(bool p_enabled) {}
|
||||
|
||||
virtual void set_no_window_mode(bool p_enable) {}
|
||||
virtual bool is_no_window_mode_enabled() const { return false; }
|
||||
|
||||
virtual void move_window_to_foreground() {}
|
||||
|
||||
virtual void swap_buffers() {}
|
||||
|
||||
protected:
|
||||
static WindowServer *(*create_func)();
|
||||
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
static WindowServer *get_singleton();
|
||||
static WindowServer *create();
|
||||
|
||||
WindowServer();
|
||||
virtual ~WindowServer();
|
||||
};
|
||||
|
||||
VARIANT_ENUM_CAST(WindowServer::HandleType);
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user