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_NLS "Enable translations" ON )
|
||||||
option( ENABLE_ASM_CORE "Enable x86 ASM CPU cores" OFF )
|
option( ENABLE_ASM_CORE "Enable x86 ASM CPU cores" OFF )
|
||||||
option( ENABLE_ASM_SCALERS "Enable x86 ASM graphic filters" 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_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)
|
if(ENABLE_ASM_SCALERS)
|
||||||
option( ENABLE_MMX "Enable MMX" OFF )
|
option( ENABLE_MMX "Enable MMX" OFF )
|
||||||
endif(ENABLE_ASM_SCALERS)
|
endif(ENABLE_ASM_SCALERS)
|
||||||
|
@ -133,9 +133,9 @@ FIND_PACKAGE(SDL2 REQUIRED)
|
||||||
ADD_DEFINITIONS(${SDL2_DEFINITIONS})
|
ADD_DEFINITIONS(${SDL2_DEFINITIONS})
|
||||||
|
|
||||||
if( ENABLE_LINK )
|
if( ENABLE_LINK )
|
||||||
if(WIN32 OR APPLE)
|
if(WIN32)
|
||||||
set(SFML_STATIC_LIBRARIES TRUE)
|
set(SFML_STATIC_LIBRARIES TRUE)
|
||||||
endif(WIN32 OR APPLE)
|
endif(WIN32)
|
||||||
FIND_PACKAGE ( SFML 2 COMPONENTS network system )
|
FIND_PACKAGE ( SFML 2 COMPONENTS network system )
|
||||||
endif( ENABLE_LINK )
|
endif( ENABLE_LINK )
|
||||||
|
|
||||||
|
|
|
@ -3,12 +3,7 @@
|
||||||
SET( CMAKE_CXX_FLAGS -std=gnu++11 )
|
SET( CMAKE_CXX_FLAGS -std=gnu++11 )
|
||||||
|
|
||||||
# not yet implemented
|
# not yet implemented
|
||||||
IF(APPLE)
|
SET(CAIRO_DEFAULT OFF)
|
||||||
# does not work, no reason to link to it
|
|
||||||
SET(CAIRO_DEFAULT OFF)
|
|
||||||
ELSE(APPLE)
|
|
||||||
SET(CAIRO_DEFAULT ON)
|
|
||||||
ENDIF(APPLE)
|
|
||||||
|
|
||||||
option(ENABLE_CAIRO "Enable Cairo rendering for the wxWidgets port" ${CAIRO_DEFAULT})
|
option(ENABLE_CAIRO "Enable Cairo rendering for the wxWidgets port" ${CAIRO_DEFAULT})
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,8 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void DrawArea(wxWindowDC& dc);
|
void DrawArea(wxWindowDC& dc);
|
||||||
|
void OnSize(wxSizeEvent& ev);
|
||||||
|
void AdjustViewport();
|
||||||
#if wxCHECK_VERSION(2, 9, 0)
|
#if wxCHECK_VERSION(2, 9, 0)
|
||||||
wxGLContext* ctx;
|
wxGLContext* ctx;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -27,3 +27,13 @@ void HiDPIAware::RequestHighResolutionOpenGLSurface()
|
||||||
[view setWantsBestResolutionOpenGLSurface:YES];
|
[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();
|
DrawingPanel::DrawingPanelInit();
|
||||||
|
|
||||||
#ifdef DEBUG
|
AdjustViewport();
|
||||||
// you can use this to check that the gl surface is indeed high res
|
|
||||||
GLint m_viewport[4];
|
Connect(wxEVT_SIZE, wxSizeEventHandler(GLDrawingPanel::OnSize), NULL, this);
|
||||||
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
|
|
||||||
|
|
||||||
// taken from GTK front end almost verbatim
|
// taken from GTK front end almost verbatim
|
||||||
glDisable(GL_CULL_FACE);
|
glDisable(GL_CULL_FACE);
|
||||||
|
@ -2123,6 +2120,25 @@ void GLDrawingPanel::DrawingPanelInit()
|
||||||
#endif
|
#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)
|
void GLDrawingPanel::DrawArea(wxWindowDC& dc)
|
||||||
{
|
{
|
||||||
#if wxCHECK_VERSION(2, 9, 0)
|
#if wxCHECK_VERSION(2, 9, 0)
|
||||||
|
@ -2463,4 +2479,9 @@ double HiDPIAware::HiDPIScaleFactor()
|
||||||
void HiDPIAware::RequestHighResolutionOpenGLSurface()
|
void HiDPIAware::RequestHighResolutionOpenGLSurface()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HiDPIAware::GetRealPixelClientSize(int* x, int* y)
|
||||||
|
{
|
||||||
|
GetWindow()->GetClientSize(x, y);
|
||||||
|
}
|
||||||
#endif // HiDPI stubs
|
#endif // HiDPI stubs
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
version=0.6
|
version=0.7
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
# parse options
|
# parse options
|
||||||
|
@ -237,7 +237,7 @@ relink() {
|
||||||
# remove full path and version of lib in executable
|
# remove full path and version of lib in executable
|
||||||
lib_link_path=$(
|
lib_link_path=$(
|
||||||
otool -l "$target" 2>/dev/null | \
|
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
|
head -1
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -347,6 +347,7 @@ class HiDPIAware {
|
||||||
public:
|
public:
|
||||||
virtual double HiDPIScaleFactor();
|
virtual double HiDPIScaleFactor();
|
||||||
virtual void RequestHighResolutionOpenGLSurface();
|
virtual void RequestHighResolutionOpenGLSurface();
|
||||||
|
virtual void GetRealPixelClientSize(int* x, int* y);
|
||||||
virtual wxWindow* GetWindow() = 0;
|
virtual wxWindow* GetWindow() = 0;
|
||||||
private:
|
private:
|
||||||
double hidpi_scale_factor = 0;
|
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
|
- [ ] 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
|
- [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)
|
- [ ] 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
|
- [ ] 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
|
- [ ] optimize all options defaults for modern hardware
|
||||||
- [ ] fix filter options in wx to apply to both fullscreen and window mode
|
- [ ] fix filter options in wx to apply to both fullscreen and window mode
|
||||||
|
@ -22,6 +22,7 @@
|
||||||
- [ ] set up automatic builds for all platforms
|
- [ ] set up automatic builds for all platforms
|
||||||
- [ ] see what code we can steal from other emu folks, e.g. filters etc.
|
- [ ] see what code we can steal from other emu folks, e.g. filters etc.
|
||||||
- [ ] update config handling, to switch to XDG on linux 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.)
|
# Coding Guidelines (for those that want to help out and send a pull request.)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue