Files
dolphin/Source/Core/DolphinWX/GLInterface/Platform.cpp
Jasper St. Pierre 8bd4b9d2f9 Remove support for Wayland
Yes, this is a fancy new feature, but our Wayland support was
particularly bitrotten, and ideally this would be handled by a platform
layer like SDL. If not, we can always add this back in when GLInterface
has caught up. We might be able to even support wxWidgets and GL
together with subsurfaces!
2014-08-19 10:05:56 -04:00

69 lines
1.4 KiB
C++

// Copyright 2014 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include <string>
#include "Core/Host.h"
#include "DolphinWX/GLInterface/GLInterface.h"
bool cPlatform::Init(EGLConfig config, void *window_handle)
{
#if HAVE_X11
if (!XInterface.Initialize(config, window_handle))
return false;
#elif ANDROID
EGLint format;
eglGetConfigAttrib(GLWin.egl_dpy, config, EGL_NATIVE_VISUAL_ID, &format);
ANativeWindow_setBuffersGeometry((EGLNativeWindowType)Host_GetRenderHandle(), 0, 0, format);
int none, width, height;
Host_GetRenderWindowSize(none, none, width, height);
GLInterface->SetBackBufferDimensions(width, height);
#endif
return true;
}
EGLDisplay cPlatform::EGLGetDisplay(void)
{
#if HAVE_X11
return (EGLDisplay) XInterface.EGLGetDisplay();
#elif ANDROID
return eglGetDisplay(EGL_DEFAULT_DISPLAY);
#endif
return nullptr;
}
EGLNativeWindowType cPlatform::CreateWindow(void)
{
#if HAVE_X11
return (EGLNativeWindowType) XInterface.CreateWindow();
#endif
#ifdef ANDROID
return (EGLNativeWindowType)Host_GetRenderHandle();
#endif
return 0;
}
void cPlatform::DestroyWindow(void)
{
#if HAVE_X11
XInterface.DestroyWindow();
#endif
}
void cPlatform::UpdateFPSDisplay(const std::string& text)
{
#if HAVE_X11
XInterface.UpdateFPSDisplay(text);
#endif
}
void
cPlatform::SwapBuffers()
{
#if HAVE_X11
XInterface.SwapBuffers();
#elif ANDROID
eglSwapBuffers(GLWin.egl_dpy, GLWin.egl_surf);
#endif
}