Add missing files.

This commit is contained in:
BearOso 2023-06-01 18:01:08 -05:00
parent fa20cd2d19
commit 5526a1d905
3 changed files with 119 additions and 0 deletions

View File

@ -0,0 +1,30 @@
/*****************************************************************************\
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
This file is licensed under the Snes9x License.
For further information, consult the LICENSE file in the root directory.
\*****************************************************************************/
#ifndef __GTK_OPENGL_CONTEXT_H
#define __GTK_OPENGL_CONTEXT_H
class OpenGLContext
{
public:
virtual ~OpenGLContext(){};
virtual bool create_context() = 0;
virtual void resize() = 0;
virtual void swap_buffers() = 0;
virtual void swap_interval(int frames) = 0;
virtual void make_current() = 0;
virtual bool ready()
{
return true;
};
int x;
int y;
int width;
int height;
};
#endif

View File

@ -0,0 +1,41 @@
/*****************************************************************************\
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
This file is licensed under the Snes9x License.
For further information, consult the LICENSE file in the root directory.
\*****************************************************************************/
#ifndef __WAYLAND_EGL_CONTEXT_H
#define __WAYLAND_EGL_CONTEXT_H
#include "opengl_context.hpp"
#include "wayland_surface.hpp"
#include "../external/glad/include/glad/egl.h"
#include <memory>
#include <wayland-egl.h>
class WaylandEGLContext : public OpenGLContext
{
public:
WaylandEGLContext();
~WaylandEGLContext();
bool attach(wl_display *display, wl_surface *surface, WaylandSurface::Metrics m);
bool create_context();
void resize() {};
void resize(WaylandSurface::Metrics m);
void swap_buffers();
void swap_interval(int frames);
void make_current();
bool ready();
EGLDisplay egl_display;
EGLSurface egl_surface;
EGLContext egl_context;
EGLConfig egl_config;
wl_egl_window *egl_window;
std::unique_ptr<WaylandSurface> wayland_surface;
};
#endif

View File

@ -0,0 +1,48 @@
/*****************************************************************************\
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
This file is licensed under the Snes9x License.
For further information, consult the LICENSE file in the root directory.
\*****************************************************************************/
#pragma once
#include "viewporter-client-protocol.h"
#include "fractional-scale-v1.h"
#include <tuple>
class WaylandSurface
{
public:
WaylandSurface();
~WaylandSurface();
struct Metrics {
int x, y, width, height, scale;
};
bool attach(wl_display *display, wl_surface *surface, Metrics source_metrics);
void resize(Metrics new_metrics);
std::tuple<int, int> get_size();
struct wl_display *display;
struct wl_registry *registry;
struct wl_compositor *compositor;
struct wl_subcompositor *subcompositor;
struct wl_surface *parent;
struct wl_surface *child;
struct wl_subsurface *subsurface;
struct wl_region *region;
Metrics metrics;
double actual_scale;
struct zwp_idle_inhibit_manager_v1 *idle_inhibit_manager;
struct zwp_idle_inhibitor_v1 *idle_inhibitor;
struct wp_viewporter *viewporter;
struct wp_viewport *viewport;
struct wp_fractional_scale_manager_v1 *fractional_scale_manager;
struct wp_fractional_scale_v1 *fractional_scale;
};