rpcsx/rpcs3/Gui/GLGSFrame.cpp

53 lines
1,009 B
C++
Raw Normal View History

#include "stdafx_gui.h"
#include "Utilities/Log.h"
#include "Emu/Memory/Memory.h"
#include "Emu/System.h"
#include "GLGSFrame.h"
#include "Utilities/Timer.h"
#ifndef _WIN32
#include "frame_icon.xpm"
#endif
2015-10-08 02:44:57 +02:00
GLGSFrame::GLGSFrame() : GSFrame("OpenGL")
{
SetIcon(wxICON(frame_icon));
2015-10-08 02:44:57 +02:00
m_canvas = new wxGLCanvas(this, wxID_ANY, NULL);
m_canvas->SetSize(GetClientSize());
2015-10-08 02:44:57 +02:00
m_canvas->Bind(wxEVT_LEFT_DCLICK, &GSFrame::OnLeftDclick, this);
}
GLGSFrame::~GLGSFrame()
{
}
2015-10-08 02:44:57 +02:00
void* GLGSFrame::make_context()
{
2015-10-08 02:44:57 +02:00
return new wxGLContext(m_canvas);
}
2015-10-08 02:44:57 +02:00
void GLGSFrame::set_current(draw_context_t ctx)
{
2015-10-08 02:44:57 +02:00
m_canvas->SetCurrent(*(wxGLContext*)ctx.get());
}
2015-10-08 02:44:57 +02:00
void GLGSFrame::delete_context(void* ctx)
{
delete (wxGLContext*)ctx;
}
2015-10-08 02:44:57 +02:00
void GLGSFrame::flip(draw_context_t context)
{
2015-10-08 02:44:57 +02:00
GSFrame::flip(context);
if (!m_canvas) return;
m_canvas->SetCurrent(*(wxGLContext*)context.get());
m_canvas->SwapBuffers();
}
void GLGSFrame::OnSize(wxSizeEvent& event)
{
2015-10-08 02:44:57 +02:00
if (m_canvas)
m_canvas->SetSize(GetClientSize());
event.Skip();
}