Lots of interconnected changes in this commit:
- Removed unnecessary name/author/filename members all over the place.
- Started using exceptions to deliver preset loading and rendering errors to the topmost ProjectM class.
- Added stream loading methods to factories and the base Preset class.
- Added new events for requesting preset switch and telling the user about loading errors.
- Consolidated preset switching logic in ProjectM class a bit.
Path scanning is using C++17's std::filesystem if available, but uses boost::filesystem as fallback. Using boost can be forced using the ENABLE_BOOST_FILESYSTEM CMake option.
Also make sure to propagate the changed value to the preset code via the PipelineContext class. Keeping it in the settings struct for now. Storing a dynamic value in settings makes no sense, so it will be removed later.
This removes:
- "Toast" messages
- The help text
- Statistics
- Preset name and (unimplemented) song title display
- Preset selection list and search menu
Some of the above functionality might later be added as an optional library, in a separate repository and with proper UTF-8 support.
The native presets did not build anymore due to refactorings, cause other build issues on Windows (e.g. require linking to psapi.lib) and would need a complete makeover anyway.
In this case, the weighted random chooser would divide by zero, which will cause a crash. In the case this happens, we'll simply use a uniform random distribution as all ratings are equally zero.
The external gltext.h is C, thus forward declare GLTtext as a struct
instead of a class.
In file included from /projectm/src/libprojectM/Renderer/MenuText.cpp:7:
/projectm/src/libprojectM/Renderer/../gltext.h:108:9: warning: struct 'GLTtext' was previously declared as a class; this is valid, but may result in linker errors under the Microsoft C++ ABI [-Wmismatched-tags]
typedef struct GLTtext GLTtext;
^
/projectm/src/libprojectM/Renderer/MenuText.h:9:7: note: previous use is here
class GLTtext;
^
In file included from /projectm/src/libprojectM/Renderer/MenuText.cpp:7:
/projectm/src/libprojectM/Renderer/../gltext.h:211:1: warning: 'GLTtext' defined as a struct here but previously declared as a class; this is valid, but may result in linker errors under the Microsoft C++ ABI [-Wmismatched-tags]
struct GLTtext {
^
/projectm/src/libprojectM/Renderer/MenuText.h:9:1: note: did you mean struct here?
class GLTtext;
^~~~~
struct
CMake defines WIN32 by default on Windows, but we shouldn't rely on it.
_WIN32 is defined by all compilers targeting Windows.
Also cleaned up some header includes.
CMake defines WIN32 by default on Windows, but we shouldn't rely on it,
as it is also defined when using MinGW. Since the comments suggest MSVC-
specific code, scope to MSVC only.
Unfortunately, windows.h breaks the standard library because it
defines max() as a macro by default.
To fix this, add NOMINMAX (and WIN32_LEAN_AND_MEAN for good measure) to
the compile options. Ideally, this would be set on a per-target basis,
but with so many OBJECT targets, that is really tedious. Luckily,
add_compile_definitions() is scoped to the current directory and sub-
directories only.
In file included from /projectm/src/libprojectM/Renderer/Renderer.cpp:1:
/projectm/src/libprojectM/Renderer/Renderer.hpp:191:10: error: ‘unique_ptr’ in namespace ‘std’ does not name a template type
191 | std::unique_ptr<TextureManager> m_textureManager;
| ^~~~~~~~~~
Amends the previous commit.
In order to avoid unused parameter warnings when building the library
itself, also unname these parameters here.
The names of these parameters are still named in ProjectM.hpp, so they
serve as documentation. In ProjectM.cpp, they are mere stubs.
As a drive-by, removed some unneeded newlines.
Fixes multiple "warning: unknown pragma ignored [-Wunknown-pragmas]"
diagnostics on GCC/Clang when used with MinGW, both when building the
library aswell as in client applications.