Merge pull request #38 from rkitover/master
fix wx GL viewport + build improvements
This commit is contained in:
commit
a2f5d1338e
|
@ -18,9 +18,9 @@ option( ENABLE_DEBUGGER "Enable the debugger" ON )
|
|||
option( ENABLE_NLS "Enable translations" ON )
|
||||
option( ENABLE_ASM_CORE "Enable x86 ASM CPU cores" OFF )
|
||||
option( ENABLE_ASM_SCALERS "Enable x86 ASM graphic filters" OFF )
|
||||
option( ENABLE_LINK "Enable GBA linking functionality" OFF )
|
||||
option( ENABLE_LINK "Enable GBA linking functionality" ON )
|
||||
option( ENABLE_LIRC "Enable LIRC support" OFF )
|
||||
option( ENABLE_FFMPEG "Enable ffmpeg A/V recording" OFF )
|
||||
option( ENABLE_FFMPEG "Enable ffmpeg A/V recording" ON )
|
||||
if(ENABLE_ASM_SCALERS)
|
||||
option( ENABLE_MMX "Enable MMX" OFF )
|
||||
endif(ENABLE_ASM_SCALERS)
|
||||
|
@ -133,9 +133,9 @@ FIND_PACKAGE(SDL2 REQUIRED)
|
|||
ADD_DEFINITIONS(${SDL2_DEFINITIONS})
|
||||
|
||||
if( ENABLE_LINK )
|
||||
if(WIN32 OR APPLE)
|
||||
if(WIN32)
|
||||
set(SFML_STATIC_LIBRARIES TRUE)
|
||||
endif(WIN32 OR APPLE)
|
||||
endif(WIN32)
|
||||
FIND_PACKAGE ( SFML 2 COMPONENTS network system )
|
||||
endif( ENABLE_LINK )
|
||||
|
||||
|
|
|
@ -3,12 +3,7 @@
|
|||
SET( CMAKE_CXX_FLAGS -std=gnu++11 )
|
||||
|
||||
# not yet implemented
|
||||
IF(APPLE)
|
||||
# does not work, no reason to link to it
|
||||
SET(CAIRO_DEFAULT OFF)
|
||||
ELSE(APPLE)
|
||||
SET(CAIRO_DEFAULT ON)
|
||||
ENDIF(APPLE)
|
||||
SET(CAIRO_DEFAULT OFF)
|
||||
|
||||
option(ENABLE_CAIRO "Enable Cairo rendering for the wxWidgets port" ${CAIRO_DEFAULT})
|
||||
|
||||
|
|
|
@ -23,6 +23,8 @@ public:
|
|||
|
||||
protected:
|
||||
void DrawArea(wxWindowDC& dc);
|
||||
void OnSize(wxSizeEvent& ev);
|
||||
void AdjustViewport();
|
||||
#if wxCHECK_VERSION(2, 9, 0)
|
||||
wxGLContext* ctx;
|
||||
#endif
|
||||
|
|
|
@ -27,3 +27,13 @@ void HiDPIAware::RequestHighResolutionOpenGLSurface()
|
|||
[view setWantsBestResolutionOpenGLSurface:YES];
|
||||
}
|
||||
}
|
||||
|
||||
void HiDPIAware::GetRealPixelClientSize(int* x, int* y)
|
||||
{
|
||||
NSView* view = (NSView*)(GetWindow()->GetHandle());
|
||||
|
||||
NSSize backing_size = [view convertSizeToBacking:view.bounds.size];
|
||||
|
||||
*x = backing_size.width;
|
||||
*y = backing_size.height;
|
||||
}
|
||||
|
|
|
@ -2037,12 +2037,9 @@ void GLDrawingPanel::DrawingPanelInit()
|
|||
|
||||
DrawingPanel::DrawingPanelInit();
|
||||
|
||||
#ifdef DEBUG
|
||||
// you can use this to check that the gl surface is indeed high res
|
||||
GLint m_viewport[4];
|
||||
glGetIntegerv(GL_VIEWPORT, m_viewport);
|
||||
vbamDebug("GL VIEWPORT: %d, %d, %d, %d", m_viewport[0], m_viewport[1], m_viewport[2], m_viewport[3]);
|
||||
#endif
|
||||
AdjustViewport();
|
||||
|
||||
Connect(wxEVT_SIZE, wxSizeEventHandler(GLDrawingPanel::OnSize), NULL, this);
|
||||
|
||||
// taken from GTK front end almost verbatim
|
||||
glDisable(GL_CULL_FACE);
|
||||
|
@ -2123,6 +2120,25 @@ void GLDrawingPanel::DrawingPanelInit()
|
|||
#endif
|
||||
}
|
||||
|
||||
void GLDrawingPanel::OnSize(wxSizeEvent& ev)
|
||||
{
|
||||
AdjustViewport();
|
||||
}
|
||||
|
||||
void GLDrawingPanel::AdjustViewport()
|
||||
{
|
||||
int x, y;
|
||||
GetRealPixelClientSize(&x, &y);
|
||||
glViewport(0, 0, x, y);
|
||||
|
||||
#ifdef DEBUG
|
||||
// you can use this to check that the gl surface is indeed high res
|
||||
GLint m_viewport[4];
|
||||
glGetIntegerv(GL_VIEWPORT, m_viewport);
|
||||
vbamDebug("GL VIEWPORT: %d, %d, %d, %d", m_viewport[0], m_viewport[1], m_viewport[2], m_viewport[3]);
|
||||
#endif
|
||||
}
|
||||
|
||||
void GLDrawingPanel::DrawArea(wxWindowDC& dc)
|
||||
{
|
||||
#if wxCHECK_VERSION(2, 9, 0)
|
||||
|
@ -2463,4 +2479,9 @@ double HiDPIAware::HiDPIScaleFactor()
|
|||
void HiDPIAware::RequestHighResolutionOpenGLSurface()
|
||||
{
|
||||
}
|
||||
|
||||
void HiDPIAware::GetRealPixelClientSize(int* x, int* y)
|
||||
{
|
||||
GetWindow()->GetClientSize(x, y);
|
||||
}
|
||||
#endif // HiDPI stubs
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
version=0.6
|
||||
version=0.7
|
||||
|
||||
main() {
|
||||
# parse options
|
||||
|
@ -237,7 +237,7 @@ relink() {
|
|||
# remove full path and version of lib in executable
|
||||
lib_link_path=$(
|
||||
otool -l "$target" 2>/dev/null | \
|
||||
sed -n 's,^ *name \(/.*/*'"$lib_basename_unversioned_re"'[0-9.-]*\.dylib\) (offset .*,\1,p' | \
|
||||
sed -n 's,^ *name \(.*/*'"$lib_basename_unversioned_re"'[0-9.-]*\.dylib\) (offset .*,\1,p' | \
|
||||
head -1
|
||||
)
|
||||
|
||||
|
|
|
@ -347,6 +347,7 @@ class HiDPIAware {
|
|||
public:
|
||||
virtual double HiDPIScaleFactor();
|
||||
virtual void RequestHighResolutionOpenGLSurface();
|
||||
virtual void GetRealPixelClientSize(int* x, int* y);
|
||||
virtual wxWindow* GetWindow() = 0;
|
||||
private:
|
||||
double hidpi_scale_factor = 0;
|
||||
|
|
3
todo.md
3
todo.md
|
@ -7,7 +7,7 @@
|
|||
- [ ] add OnSize handler for GLDrawingPanel in wx back to reset the GL viewport, and set viewport on init as well
|
||||
- [x] fix wx accels that are a game key with a modifier, e.g. ALT+ENTER when ENTER is a game key
|
||||
- [ ] add an option to the video config dialog to choose native or non-native fullscreen for Mac (and check if the OS supports it)
|
||||
- [ ] fix SFML cmake stuff to detect brew SFML on Mac
|
||||
- [ ] fix SFML cmake stuff so that static linking works on Mac
|
||||
- [ ] update FindSDL2.cmake to use sdl2-config if available and pkg-config is not, get PR merged upstream
|
||||
- [ ] optimize all options defaults for modern hardware
|
||||
- [ ] fix filter options in wx to apply to both fullscreen and window mode
|
||||
|
@ -22,6 +22,7 @@
|
|||
- [ ] set up automatic builds for all platforms
|
||||
- [ ] see what code we can steal from other emu folks, e.g. filters etc.
|
||||
- [ ] update config handling, to switch to XDG on linux etc.
|
||||
- [ ] add simple 'mute audio' option for wx interface
|
||||
|
||||
# Coding Guidelines (for those that want to help out and send a pull request.)
|
||||
|
||||
|
|
Loading…
Reference in New Issue