- Setup EGL context for Wayland. Test window now opens as black rectangle.
This commit is contained in:
46
source/platform/linux/wayland/egl/surface.cpp
Normal file
46
source/platform/linux/wayland/egl/surface.cpp
Normal file
@@ -0,0 +1,46 @@
|
||||
// =====================================================================================================================
|
||||
// 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/>.
|
||||
// =====================================================================================================================
|
||||
|
||||
|
||||
#include <fennec/platform/linux/wayland/window.h>
|
||||
#include <fennec/platform/linux/wayland/egl/surface.h>
|
||||
#include <fennec/platform/linux/wayland/lib/wayland.h>
|
||||
|
||||
namespace fennec
|
||||
{
|
||||
|
||||
wayland_eglsurface::wayland_eglsurface(wayland_window* win, eglcontext* ctx)
|
||||
: eglsurface(win, ctx,
|
||||
reinterpret_cast<EGLNativeWindowType>(
|
||||
wl_egl_window_create(
|
||||
static_cast<wl_surface*>(win->get_native_handle()), win->get_size().x, win->get_size().y
|
||||
)
|
||||
)
|
||||
) {
|
||||
|
||||
}
|
||||
|
||||
wayland_eglsurface::~wayland_eglsurface() {
|
||||
wl_egl_window_destroy(reinterpret_cast<wl_egl_window*>(_eglwindow));
|
||||
}
|
||||
|
||||
void wayland_eglsurface::resize(const ivec2& size) {
|
||||
wl_egl_window_resize(reinterpret_cast<wl_egl_window*>(_eglwindow), size.x, size.y, 0, 0);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user