#include "stdafx.h" #include #include "Gui/GLGSFrame.h" #include "Emu/Io/Null/NullKeyboardHandler.h" #include "Emu/Io/Windows/WindowsKeyboardHandler.h" #include "Emu/Io/Null/NullMouseHandler.h" #include "Emu/Io/Windows/WindowsMouseHandler.h" #include "Emu/Io/Null/NullPadHandler.h" #include "Emu/Io/Windows/WindowsPadHandler.h" #if defined(_WIN32) #include "Emu/Io/XInput/XInputPadHandler.h" #endif rCanvas::rCanvas(void *parent) { handle = static_cast(new wxGLCanvas(static_cast(parent),wxID_ANY,NULL)); } rCanvas::~rCanvas() { delete static_cast(handle); } bool rCanvas::SetCurrent(void *ctx) { return static_cast(handle)->SetCurrent(*static_cast(ctx)); } rGLFrame::rGLFrame() { handle = static_cast(new GLGSFrame()); } rGLFrame::~rGLFrame() { delete static_cast(handle); } void rGLFrame::Close() { static_cast(handle)->Close(); } bool rGLFrame::IsShown() { return static_cast(handle)->IsShown(); } void rGLFrame::Hide() { static_cast(handle)->Hide(); } void rGLFrame::Show() { static_cast(handle)->Show(); } void *rGLFrame::GetNewContext() { return static_cast(new wxGLContext( static_cast(handle)->GetCanvas() )); } void rGLFrame::Flip(void *ctx) { static_cast(handle)->Flip( static_cast(ctx)); } void rGLFrame::SetCurrent(void *ctx) { static_cast(handle)->GetCanvas()->SetCurrent(*static_cast(ctx)); } rImage::rImage() { handle = static_cast(new wxImage()); } rImage::~rImage() { delete static_cast(handle); } void rImage::Create(int width, int height, void *data, void *alpha) { static_cast(handle)->Create(width, height, static_cast(data), static_cast(alpha)); } void rImage::SaveFile(const std::string& name, rImageType type) { if (type == rBITMAP_TYPE_PNG) { static_cast(handle)->SaveFile(fmt::FromUTF8(name),wxBITMAP_TYPE_PNG); } else { throw std::string("unsupported type"); } } int rPlatform::getKeyboardHandlerCount() { return 2; } KeyboardHandlerBase *rPlatform::getKeyboardHandler(int i) { switch (i) { case 0: return new NullKeyboardHandler(); break; case 1: return new WindowsKeyboardHandler(); break; default: return new NullKeyboardHandler(); } } int rPlatform::getMouseHandlerCount() { return 2; } MouseHandlerBase *rPlatform::getMouseHandler(int i) { switch (i) { case 0: return new NullMouseHandler(); break; case 1: return new WindowsMouseHandler(); break; default: return new NullMouseHandler(); } } int rPlatform::getPadHandlerCount() { #if defined(_WIN32) return 3; #else return 2; #endif } PadHandlerBase *rPlatform::getPadHandler(int i) { switch (i) { case 0: return new NullPadHandler(); break; case 1: return new WindowsPadHandler(); break; #if defined(_WIN32) case 2: return new XInputPadHandler(); break; #endif default: return new NullPadHandler(); } }