85 lines
2.1 KiB
C++
85 lines
2.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/>.
|
|
// =====================================================================================================================
|
|
|
|
#ifndef FENNEC_PLATFORM_INTERFACE_DISPLAY_H
|
|
#define FENNEC_PLATFORM_INTERFACE_DISPLAY_H
|
|
|
|
#include <fennec/fproc/strings/string.h>
|
|
#include <fennec/lang/types.h>
|
|
#include <fennec/lang/typeuuid.h>
|
|
#include <fennec/platform/interface/fwd.h>
|
|
|
|
namespace fennec
|
|
{
|
|
|
|
class display
|
|
{
|
|
public:
|
|
struct pixel_format {
|
|
uint8_t depth;
|
|
uint8_t r, g, b;
|
|
};
|
|
|
|
struct config {
|
|
pixel_format format;
|
|
};
|
|
|
|
virtual bool connected() const = 0;
|
|
virtual ~display();
|
|
|
|
virtual window* create_window() = 0;
|
|
|
|
const pixel_format& get_color_format() const {
|
|
return _config.format;
|
|
}
|
|
|
|
virtual void select_context();
|
|
virtual void* get_native_handle() = 0;
|
|
|
|
platform* get_platform() { return _platform; }
|
|
gfxcontext* get_context() { return _context; }
|
|
|
|
const string name;
|
|
const uint64_t uuid;
|
|
|
|
protected:
|
|
platform* _platform;
|
|
gfxcontext* _context;
|
|
config _config;
|
|
|
|
template<typename DisplayT>
|
|
explicit display(platform* platform, const cstring& name, DisplayT*)
|
|
: name(name)
|
|
, uuid(typeuuid<DisplayT>())
|
|
, _platform(platform)
|
|
, _context(nullptr)
|
|
, _config {
|
|
.format = {
|
|
.depth = 24,
|
|
.r = 8,
|
|
.g = 8,
|
|
.b = 8,
|
|
}
|
|
} {
|
|
}
|
|
};
|
|
|
|
}
|
|
|
|
#endif // FENNEC_PLATFORM_INTERFACE_DISPLAY_H
|