Update doctest.h because the old version causes build failures on Linux.
Also move it from third_party/include/doctest to third_party/include.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Previously, wxJoyEvent surfaced the internal state of the joystick
changes, forcing consumers of this class to convert the values to the
mod and key values used in the rest of the code base. This streamlines
the wxJoyEvent API so the events sent to the consumers can be used
as-is. In particular, this allows us to remove manual generation of
"ghost" events in GameArea.
Breaking change: This has the side effect of disabling setting
diagonals from a joystick HAT as a discrete control. However, this only
ever worked with game controllers not compatible with the newer SDL
GameController API, since it handles HATs as 4 discrete buttons. For
compatibility purposes, these have been moved 1/8 turn
counter-clockwise - i.e. NE is now N.
Issue: #745
Fix the state of the File -> Play -> Start/Stop menu after playing a
movie by calling systemStopGamePlayback() when the playback stops.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Add new format for recording VBA Movies that records inputs since the
time of the last input instead of the beginning of the movie.
Keep the extension `.vmv` the same, the format is determined from the
header of the file.
Make this the new default format for recording VBA Movies.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
On MSYS2, stop using the MINGW64 windres.exe Windows resource file
compiler instead of the CLANG64 provided one, because the CLANG64
windres.exe works correctly now, while using the MINGW64 windres.exe no
longer works.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Switch usage of std::optional to nonstd::optional for now because of an
error from the Mac builder script, I cannot reproduce the problem yet
but will try to fix it later, it may not be fixable when targeting 10.7.
The header is from:
https://github.com/martinmoene/optional-lite
.
Usage is about the same, to include:
`#include "nonstd/optional.hpp"`
Then use nonstd::optional and nonstd::nullopt instead of the std::
counterparts.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This introduces abstractions for a game key (`wxGameKey`), a game
control (`wxGameControl`) and a common global handler for in-game
user input processing (`wxGameControlState`).
User configuration is changed from a vector to a map of `wxGameControl`
to a set of `wxUserInput`, which simplifies input configuration updates.
User input processing for in-game controls is now unified between
keyboard and joypad input, and is much faster in general since access
to game control state is now always logarithmic rather than linear.
This comes at the expense of slightly slower user input configuration
updates. However, in the worst case scenario, this is still done in
O(log(n)).
This removes all uses of `wxJoyKeyBinding`. However, some uses of the
key, mod, joy triplets remain and will be cleaned up in follow-up PRs.
Issue: #745
Previously, a manual polling of every joystick was performed every 25ms,
resulting in many CPU resources being wasted. This seems to have been
put in place to deal with issues in SDL where joysticks connected after
SDL was initialized did not fire SDL events properly. From manual
testing, this issue seems to have been fixed.
This also fixes a bug in handling of legacy joystick hats, where an
incorrect conversion for the event value was performed.
Finally, this fixes minor typoes and renames
`wxSDLJoyState::ProcessEvent()` to `wxSDLJoyState::ProcessSDLEvent()` to
suppress a warning about a method override.
This introduces a new abstraction for any user input. The long-term goal
is to replace every usage of "custom" {key, mod, joy} triplets in the
code base with this new class.
This class implements comparison operators, allowing for faster access
in a set or as a key in a map, compared to the vectors currently used.
Issue: #745
The actual package name for libsdl2 is libsdl2-2.0-0 not libsdl2-2.0 in
Debian/Ubuntu and probably others, and this only worked by accident
due to apt doing a regex search for packages.
Get the correct package for the latest version of libsdl2 from
apt-cache.
Also fix the other lib package searches via apt-cache to return the
latest version.
Resolve#882.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
* Add wxJoystick to abstract what was previously referred to as
|player_index|. This is a first step towards a larger refactor of
input handling.
* Remove "SDL" from types that are not directly SDL-related, namely
"wxSDLJoyEvent", "wxSDLControl".
* Rename "wxSDLJoy" into "wxJoyPoller". This clarifies the use of this
class.
Issue: #745
ccache supports MSVC now, so don't disable it for MSVC builds.
Remove the global RULE_LAUNCH_COMPILE property because it breaks
resource compilation on MSVC and just use CMAKE_CXX_COMPILER_LAUNCHER
etc..
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Thanks to @ZachBacon in 1e0eea3c (recording: fix ffmpeg5 compat, 2022-03-18) the build works with ffmpeg5 from brew.
Update build instructions from installdeps to not disable ffmpeg
anymore.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Replace wxmac obsolete package with wxwidgets.
Use brew install -f (--force) to install all deps.
Unlink and relink gettext, wxwidgets and ffmpeg for every invocation.
Add -DENABLE_FFMPEG=FALSE to cmake invocation instructions because brew
has ffmpeg 5 and we cannot build with it yet.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>