rpcsx/rpcs3/Gui/GSFrame.cpp
Peter Tissen c37905e465 initial start to eliminate static func init, not compilable atm
move module initialization into a module manager, still has some issues like stopping not working and debug crashing

add #idef 0 to modules that aren't in the windows project

don't double initialize and don't de-initialize for now, since many modules don't expect it and it leads to many errors

remove duplicate module lists for empty modules and implemented ones, make Module non-copyable but movable

add secondary project, no real use for it now

add some memleak config to the emucore and add asmjit path to rpcs3

small rebase error fixed to get it to compile again

add filters for emucore

re-add the module manager and static file

WIP commit, linker errors abound

some more abstraction layer stuff

fix the remaining linker errors, re-enable platform specific mouse, pad and keyboard handlers

rebasing

fix memset undefined and re() usage of se_t before declaration

Add wxGUI define by default for cmake builds

fix copy constructors of Datetime header

fix copy constructors of other wx interface classes

remove static declarations of global variables

make wxGLCanvas constructor non-ambiguous even with wx2.8. compat mode, fix wrong std::exception constructor calls

remove duplicate definition for FromUTF8 and ToUTF8

temp changes
2014-06-08 23:16:06 +02:00

82 lines
1.6 KiB
C++

#include "stdafx.h"
#include "GSFrame.h"
BEGIN_EVENT_TABLE(GSFrame, wxFrame)
EVT_PAINT(GSFrame::OnPaint)
EVT_SIZE(GSFrame::OnSize)
END_EVENT_TABLE()
wxSize AspectRatio(wxSize rs, const wxSize as)
{
const double aq = (double)as.x / as.y;
const double rq = (double)rs.x / rs.y;
const double q = aq / rq;
if (q > 1.0)
{
rs.y /= q;
}
else if (q < 1.0)
{
rs.x *= q;
}
return rs;
}
GSFrame::GSFrame(wxWindow* parent, const wxString& title) : wxFrame(parent, wxID_ANY, title)
{
CellVideoOutResolution res = ResolutionTable[ResolutionIdToNum(Ini.GSResolution.GetValue())];
SetClientSize(res.width, res.height);
wxGetApp().Bind(wxEVT_KEY_DOWN, &GSFrame::OnKeyDown, this);
Bind(wxEVT_CLOSE_WINDOW, &GSFrame::OnClose, this);
}
void GSFrame::OnPaint(wxPaintEvent& event)
{
wxPaintDC(this);
}
void GSFrame::OnClose(wxCloseEvent& event)
{
Emu.Stop();
}
/*
void GSFrame::OnSize(wxSizeEvent&)
{
const wxSize client = GetClientSize();
const wxSize viewport = AspectRatio(client, m_size);
const int x = (client.GetX() - viewport.GetX()) / 2;
const int y = (client.GetY() - viewport.GetY()) / 2;
SetViewport(wxPoint(x, y), viewport);
}
*/
void GSFrame::OnKeyDown(wxKeyEvent& event)
{
switch (event.GetKeyCode())
{
case WXK_RETURN: if (event.AltDown()) { OnFullScreen(); return; } break;
case WXK_ESCAPE: if (IsFullScreen()) { ShowFullScreen(false); return; } break;
}
event.Skip();
}
void GSFrame::OnFullScreen()
{
ShowFullScreen(!IsFullScreen());
}
/*
void GSFrame::SetSize(int width, int height)
{
m_size.SetWidth(width);
m_size.SetHeight(height);
//wxFrame::SetSize(width, height);
OnSize(wxSizeEvent());
}
*/