mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-08 16:05:56 +00:00
Revert "Merge pull request #1245 from DHrpcs3/master"
This reverts commit5feba39ff7, reversing changes made toebf28f8da0.
This commit is contained in:
parent
5feba39ff7
commit
f483c3b9ca
319 changed files with 7402 additions and 72277 deletions
|
|
@ -1,43 +1,102 @@
|
|||
#include "stdafx_gui.h"
|
||||
#include "Utilities/Log.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "GLGSFrame.h"
|
||||
#include "D3DGSFrame.h"
|
||||
#include "Utilities/Timer.h"
|
||||
|
||||
GLGSFrame::GLGSFrame() : GSFrame("OpenGL")
|
||||
#ifndef _WIN32
|
||||
#include "frame_icon.xpm"
|
||||
#endif
|
||||
|
||||
GLGSFrame::GLGSFrame()
|
||||
: GSFrame(nullptr, "GSFrame[OpenGL]")
|
||||
, m_frames(0)
|
||||
{
|
||||
m_canvas = new wxGLCanvas(this, wxID_ANY, NULL);
|
||||
m_canvas->SetSize(GetClientSize());
|
||||
SetIcon(wxICON(frame_icon));
|
||||
canvas = new wxGLCanvas(this, wxID_ANY, NULL);
|
||||
canvas->SetSize(GetClientSize());
|
||||
|
||||
m_canvas->Bind(wxEVT_LEFT_DCLICK, &GSFrame::OnLeftDclick, this);
|
||||
canvas->Bind(wxEVT_LEFT_DCLICK, &GSFrame::OnLeftDclick, this);
|
||||
}
|
||||
|
||||
void* GLGSFrame::make_context()
|
||||
GLGSFrame::~GLGSFrame()
|
||||
{
|
||||
return new wxGLContext(m_canvas);
|
||||
}
|
||||
|
||||
void GLGSFrame::set_current(draw_context_t ctx)
|
||||
void GLGSFrame::Close()
|
||||
{
|
||||
m_canvas->SetCurrent(*(wxGLContext*)ctx.get());
|
||||
GSFrame::Close();
|
||||
}
|
||||
|
||||
void GLGSFrame::delete_context(void* ctx)
|
||||
bool GLGSFrame::IsShown()
|
||||
{
|
||||
return GSFrame::IsShown();
|
||||
}
|
||||
|
||||
void GLGSFrame::Hide()
|
||||
{
|
||||
GSFrame::Hide();
|
||||
}
|
||||
|
||||
void GLGSFrame::Show()
|
||||
{
|
||||
GSFrame::Show();
|
||||
}
|
||||
|
||||
void* GLGSFrame::GetNewContext()
|
||||
{
|
||||
return new wxGLContext(GetCanvas());
|
||||
}
|
||||
|
||||
void GLGSFrame::SetCurrent(void* ctx)
|
||||
{
|
||||
GetCanvas()->SetCurrent(*(wxGLContext*)ctx);
|
||||
}
|
||||
|
||||
void GLGSFrame::DeleteContext(void* ctx)
|
||||
{
|
||||
delete (wxGLContext*)ctx;
|
||||
}
|
||||
|
||||
void GLGSFrame::flip(draw_context_t context)
|
||||
void GLGSFrame::Flip(void* context)
|
||||
{
|
||||
GSFrame::flip(context);
|
||||
if (!canvas) return;
|
||||
canvas->SetCurrent(*(wxGLContext*)context);
|
||||
|
||||
if (!m_canvas) return;
|
||||
static Timer fps_t;
|
||||
canvas->SwapBuffers();
|
||||
m_frames++;
|
||||
|
||||
m_canvas->SetCurrent(*(wxGLContext*)context.get());
|
||||
m_canvas->SwapBuffers();
|
||||
const std::string sub_title = Emu.GetTitle() + (Emu.GetTitleID().length() ? " [" + Emu.GetTitleID() + "] | " : " | ");
|
||||
|
||||
if (fps_t.GetElapsedTimeInSec() >= 0.5)
|
||||
{
|
||||
// can freeze on exit
|
||||
SetTitle(wxString(sub_title.c_str(), wxConvUTF8) + wxString::Format("FPS: %.2f", (double)m_frames / fps_t.GetElapsedTimeInSec()));
|
||||
m_frames = 0;
|
||||
fps_t.Start();
|
||||
}
|
||||
}
|
||||
|
||||
void GLGSFrame::OnSize(wxSizeEvent& event)
|
||||
{
|
||||
if (m_canvas)
|
||||
m_canvas->SetSize(GetClientSize());
|
||||
|
||||
if (canvas) canvas->SetSize(GetClientSize());
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void GLGSFrame::SetViewport(int x, int y, u32 w, u32 h)
|
||||
{
|
||||
/*
|
||||
//ConLog.Warning("SetViewport(x=%d, y=%d, w=%d, h=%d)", x, y, w, h);
|
||||
|
||||
const wxSize client = GetClientSize();
|
||||
const wxSize viewport = AspectRatio(client, wxSize(w, h));
|
||||
|
||||
const int vx = (client.GetX() - viewport.GetX()) / 2;
|
||||
const int vy = (client.GetY() - viewport.GetY()) / 2;
|
||||
|
||||
glViewport(vx + x, vy + y, viewport.GetWidth(), viewport.GetHeight());
|
||||
*/
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue