rpcsx/rpcs3/Emu/GS/GSRender.cpp
Bigpet 9a30ce5f18 Make buildable with GCC in Linux
* replace GetThreadID with std::this_thread.getId()
* name all anonymous structs and unions that contain non-trivially constructable objects
* made default constructor for big endian type noexcept to make it work with std::atomic
* move instantiated specialized template function members ouside of the class definition to comply with the standard
* added default instantiation for template parameter "=nullptr"
* used the C++11 standardized thread_local instead of the __declspec(thread)
* added transitional definitions to bridge the microsoft specific calls (compare and exchange and aligned alloc)
* removed cyclic dependency between Emulator->CPUThreadManager->CPUThread->SMutex->Emulator->...
* fixed some instances of indentation by space instead of tabs
* surrounded some unused code with an #if 0 block to make sure it doesn't compile
2014-02-23 17:52:52 +01:00

82 lines
1.6 KiB
C++

#include "stdafx.h"
#include "GSRender.h"
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().Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(GSFrame::OnKeyDown), (wxObject*)0, this);
Connect(wxEVT_CLOSE_WINDOW, wxCloseEventHandler(GSFrame::OnClose));
}
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());
}
*/
GSLockCurrent::GSLockCurrent(GSLockType type) : GSLock(Emu.GetGSManager().GetRender(), type)
{
}