Change the Scale control in the DisplayConfig dialog from a SpinCtrl to
a TextCtrl (for a simple text field) because GenericValidator does not
support using a double* with a SpinCtrl.
Also force adjustment on minimum size and resize the window when
necessary on panel creation, so that when the user sets the value
higher, the window size automatically adjusts.
Use dynamic_cast<wxWindow*>(this) in the DrawingPanel abstract class to
implement GetWindow() and Delete() so that all concrete classes do not
have to duplicate the code.
Only load config files with the app name set to "visualboyadvance-m" on
Windows and Mac, on unix keep the default of "vbam" for now so that
users' ~/.vbam directories are found correctly.
TODO:
* migrate all of this properly to XDG paths on unix, giving users the
option to move their config
Use a high-res surface on HiDPI (e.g. retina) Macs for the OpenGL
renderer, and scale window accordingly. Also fix fullscreen toggle not
working in HiDPI mode. And some other stuff.
Aside from the .app not being linked statically, the app is now fully
functional on Mac and ready to ship.
Full change details:
* add -DDEBUG or -DNDEBUG based on CMAKE_BUILD_TYPE (-DNDEBUG for
Release and -DDEBUG for Debug)
* properly search for homebrew/macports/fink directories, and only add
them if they exist
* fix building with wx debug support, when available
* use explicit OpenGL context on Mac too for new versions of wx
* add main_frame pointer in GameArea back to MainFrame, and a
SetMainFrame(MainFrame* parent) public method to set it in guinit
* add full support for reading and writing double value config options
(the GUI still needs to be updated for options that can take doubles,
such as video_scale)
* change video_scale option (Display/Scale) to a double, putting a
double value such as 3.6 in the config file works correctly
* add a HiDPIAware mixin class for GameArea and DrawingPanel, with the
method HiDPIScaleFactor which returns the current window's
backingScaleFactor
* change the GameArea sizing methods (DelBorder(), AdjustMinSize() and
AdjustSize()) to divide the window size by the
HiDPIAware::HiDPIScaleFactor so that the window is scaled properly
* change GameArea::ShowFullScreen to ignore fullscreen events for a
maximized window on Mac, because maximized windows on OS X are
actually native fullscreen windows
* change scale variables to double from int, and use std::ceil() to
round scaled pixel or memory size values
* make a default base class DrawingPane::DrawingPanelInit() virtual
method, call by all concrete class constructors based on the did_init
flag
* call setWantsBestResolutionOpenGLSurface:YES on the view backing the
wxGLCanvas for the OpenGL renderer (GLDrawingPanel) to get a high res
OpenGL surface in HiDPI mode
* remove GLDrawingPanel::OnSize event, the OpenGL viewport resizes
automatically without the need to call glViewport()
* do not hide the mouse pointer if the main frame has menus or dialogs
open
* add variadic vbamDebug(const char* format, ...) function, active only
#ifdef DEBUG, which sets the wx log target to STDERR and logs a
message to it
* use full name of app "visualboyadvance-m" instead of "vbam" when
getting configuration paths, this way the config is saved to
~/Library/Application Support/visualboyadvance-m rather than
~/Library/Application Support/vbam
* listen to the MENU_HIGHLIGHT_ALL event as well, as an extra way to
check when the menus are open
* add public MainFrame::SetMenusOpened(bool state) method to force the
main frame to change the internal menus_opened state, this is
necessary because in HiDPI mode on Mac the keyboard accelerator for
toggle fullscreen sends a menu open event, but not a menu close event,
so on switch to fullscreen the state is changed to menus closed and
the emu is unpaused
TODO:
* GUI option to change toggle fullscreen behavior between native and
non-native fullscreen on Mac
* GUI support for double config values like Display/Scale
* add HiDPI support to simple renderer
* fix SDL sound, or disable the option
* fix Cairo suport on Mac, or disable the option
* use dynamic_cast<> to implement GetWindow() for DrawingPanel instead
of pure virtual method, likewise for Delete()
* link .app statically by default so it can be shipped
* add Homebrew formula
On OS X, the F11 key is by default bound to "show desktop", so is a poor
choice for the "ToggleFullscreen" accelerator.
The default key combo to take apps fullscreen should be Ctrl+Cmd+F
according to:
https://support.apple.com/kb/PH18744?locale=en_US
Fortunately, this was very easy to fix by using the "platform" attribute
in MainMenu.xrc .
NOTE: this does not give us "real" OS X fullscreen yet, where the app is
on its own space, like native fullscreen apps. In the future it would be
nice to add an option to do this.
Currently the "simple" render method is way too slow on OS X, while
Cairo is completely broken. The OpenGL renderer, on the other hand, runs
with almost no stuttering.
Also fix dangling icon file after OS X build.
Fix the dynamic library path for OpenAL to the framework included with
OS X.
Make option initialization set the AudioAPI to OpenAL on mac by default,
since SDL sound is currently completely broken.
There is a lot of stuttering, will have to look at that next.
see: http://dev.vba-m.com/T2
> Every time I launch a server it defaults to the locahost IP instead of my
> actual IP. This is preventing me from linking with friends over Hamachi. When
> they enter my IP it errors on their end and they cannot connect. [report taken
> from <https://sourceforge.net/p/vbam/bugs/219/>]
Also, by chance, added the build folder to `.gitignore` so as to not pollute the
git repo. I meant to do them as separate commits, but I forgot to do so.
Signed-off-by: Jonathan Sifuentes <jayands2k11@ymail.com>
I noticed this very small discrepancy, and so I changed it. The `CMakeLists` is
already using C++11 standard, but the `.clang-format` was not.
Signed-off-by: Jonathan Sifuentes <jayands2k11@ymail.com>
Currently, the build is broken on Linux as fixed width integers (for
example uint32) are used via <cstdint> without a namespace. This is only
allowed in C++11 and later.
See http://en.cppreference.com/w/cpp/types/integer for details.
See comment in FindSDL2.cmake:
Note that the header path has changed from SDL2/SDL.h to just SDL.h
This needed to change because "proper" SDL convention
is #include "SDL.h", not <SDL2/SDL.h>. This is done for portability
reasons because not all systems place things in SDL2/ (see FreeBSD).