Files
fennec/include/fennec/platform/interface/display_server.h

125 lines
3.1 KiB
C++

// =====================================================================================================================
// fennec, a free and open source game engine
// Copyright © 2025 Medusa Slockbower
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// =====================================================================================================================
///
/// \file display_server.h
/// \brief
///
///
/// \details
/// \author Medusa Slockbower
///
/// \copyright Copyright © 2025 Medusa Slockbower ([GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html))
///
///
#ifndef FENNEC_PLATFORM_INTERFACE_DISPLAY_SERVER_H
#define FENNEC_PLATFORM_INTERFACE_DISPLAY_SERVER_H
#include <fennec/containers/bitfield.h>
#include <fennec/platform/interface/fwd.h>
#include <fennec/platform/interface/window.h>
#include <fennec/rtti/enable.h>
#include <fennec/rtti/type_registry.h>
namespace fennec
{
class display_server : public type_registry<display_server, platform*> {
// Typedefs/Constants/Enums ============================================================================================
public:
enum feature_ : uint32_t {
feature_subwindows = 0,
feature_icon,
feature_window_drag,
feature_mouse,
feature_cursors,
feature_custom_cursors,
feature_clipboard,
feature_clipboard_primary,
feature_virtual_keyboard,
feature_status_indicators,
feature_dialogues,
feature_input_dialogues,
feature_file_dialogues,
feature_filtered_file_dialogues,
feature_orientation,
feature_hidpi,
feature_hdr,
feature_swap_buffers,
feature_window_transparency,
feature_screen_reader,
feature_text_to_speech,
feature_touchscreen,
feature_system_theme,
feature_count,
};
using featureset_t = bitfield<feature_count>;
struct config {
};
// Public Members ======================================================================================================
platform* const platform;
explicit display_server(fennec::platform* p)
: platform(p) {
}
virtual ~display_server() {
}
bool has_feature(uint32_t feature) const {
return features.test(feature);
}
virtual window* create_window(const window::config& conf) = 0;
window* get_window(size_t id) {
return id == window::nullid ? nullptr : windows[id];
}
virtual void connect() = 0;
virtual void disconnect() = 0;
virtual bool connected() const = 0;
protected:
featureset_t features;
object_pool<window*> windows;
FENNEC_RTTI_CLASS_ENABLE() {
}
};
}
#endif // FENNEC_PLATFORM_INTERFACE_DISPLAY_SERVER_H