Merge remote-tracking branch 'origin/master' into Android-trash

This commit is contained in:
Ryan Houdek
2013-04-13 00:58:37 -05:00
417 changed files with 23059 additions and 19251 deletions

View File

@ -38,6 +38,17 @@ bool cInterfaceAGL::Create(void *&window_handle)
int _tx, _ty, _twidth, _theight;
Host_GetRenderWindowSize(_tx, _ty, _twidth, _theight);
GLWin.cocoaWin = (NSView*)(((wxPanel*)window_handle)->GetHandle());
// Enable high-resolution display support.
[GLWin.cocoaWin setWantsBestResolutionOpenGLSurface:YES];
NSWindow *window = [GLWin.cocoaWin window];
float scale = [window backingScaleFactor];
_twidth *= scale;
_theight *= scale;
// Control window size and picture scaling
s_backbuffer_width = _twidth;
s_backbuffer_height = _theight;
@ -58,16 +69,14 @@ bool cInterfaceAGL::Create(void *&window_handle)
return NULL;
}
GLWin.cocoaWin = (NSView*)(((wxPanel*)window_handle)->GetHandle());;
if (GLWin.cocoaWin == nil) {
ERROR_LOG(VIDEO, "failed to create window");
return NULL;
}
[[GLWin.cocoaWin window] makeFirstResponder:GLWin.cocoaWin];
[window makeFirstResponder:GLWin.cocoaWin];
[GLWin.cocoaCtx setView: GLWin.cocoaWin];
[[GLWin.cocoaWin window] makeKeyAndOrderFront: nil];
[window makeKeyAndOrderFront: nil];
return true;
}
@ -78,6 +87,13 @@ bool cInterfaceAGL::MakeCurrent()
return true;
}
bool cInterfaceAGL::ClearCurrent()
{
// not tested at all
//clearCurrentContext();
return true;
}
// Close backend
void cInterfaceAGL::Shutdown()
{
@ -88,12 +104,19 @@ void cInterfaceAGL::Shutdown()
void cInterfaceAGL::Update()
{
if( s_backbuffer_width == [GLWin.cocoaWin frame].size.width
&& s_backbuffer_height == [GLWin.cocoaWin frame].size.height)
NSWindow *window = [GLWin.cocoaWin window];
NSSize size = [GLWin.cocoaWin frame].size;
float scale = [window backingScaleFactor];
size.width *= scale;
size.height *= scale;
if( s_backbuffer_width == size.width
&& s_backbuffer_height == size.height)
return;
s_backbuffer_width = [GLWin.cocoaWin frame].size.width;
s_backbuffer_height = [GLWin.cocoaWin frame].size.height;
s_backbuffer_width = size.width;
s_backbuffer_height = size.height;
[GLWin.cocoaCtx update];
}

View File

@ -30,6 +30,7 @@ public:
void Swap();
bool Create(void *&window_handle);
bool MakeCurrent();
bool ClearCurrent();
void Shutdown();
void Update();

View File

@ -141,12 +141,17 @@ bool cInterfaceGLX::MakeCurrent()
#endif
return glXMakeCurrent(GLWin.dpy, GLWin.win, GLWin.ctx);
}
bool cInterfaceGLX::ClearCurrent()
{
return glXMakeCurrent(GLWin.dpy, None, NULL);
}
// Close backend
void cInterfaceGLX::Shutdown()
{
XWindow.DestroyXWindow();
if (GLWin.ctx && !glXMakeCurrent(GLWin.dpy, None, NULL))
NOTICE_LOG(VIDEO, "Could not release drawing context.");
if (GLWin.ctx)
{
glXDestroyContext(GLWin.dpy, GLWin.ctx);

View File

@ -36,6 +36,7 @@ public:
void UpdateFPSDisplay(const char *Text);
bool Create(void *&window_handle);
bool MakeCurrent();
bool ClearCurrent();
void Shutdown();
};
#endif

View File

@ -27,6 +27,7 @@ public:
virtual void UpdateFPSDisplay(const char *Text) {}
virtual bool Create(void *&window_handle) { return true; }
virtual bool MakeCurrent() { return true; }
virtual bool ClearCurrent() { return true; }
virtual void Shutdown() {}
virtual void SwapInterval(int Interval) { }

View File

@ -131,6 +131,11 @@ bool cInterfaceWGL::MakeCurrent()
return wglMakeCurrent(hDC, hRC) ? true : false;
}
bool cInterfaceWGL::ClearCurrent()
{
return wglMakeCurrent(hDC, NULL) ? true : false;
}
// Update window width, size and etc. Called from Render.cpp
void cInterfaceWGL::Update()
{
@ -171,14 +176,14 @@ void cInterfaceWGL::Shutdown()
NOTICE_LOG(VIDEO, "Could not release drawing context.");
if (!wglDeleteContext(hRC))
ERROR_LOG(VIDEO, "Release Rendering Context Failed.");
ERROR_LOG(VIDEO, "Attempt to release rendering context failed.");
hRC = NULL;
}
if (hDC && !ReleaseDC(EmuWindow::GetWnd(), hDC))
{
ERROR_LOG(VIDEO, "Release Device Context Failed.");
ERROR_LOG(VIDEO, "Attempt to release device context failed.");
hDC = NULL;
}
}

View File

@ -33,6 +33,7 @@ public:
void UpdateFPSDisplay(const char *Text);
bool Create(void *&window_handle);
bool MakeCurrent();
bool ClearCurrent();
void Shutdown();
void Update();