This functionality was added in that release. Since it's only 4 months old, it's
too early to make minimum; it won't be available on some Linux distros yet.
There's currently no way to choose between JPG or PNG files. That can (and should)
be added later. For now, it defaults to JPG files if SDL_Image is of the appropriate
version.
I've also left the BMP fallback path, but that should never be reached now, since
PNG saving is always available
Closes#1448.
When iceiceice (@cbeck88) added "save screenshots as PNGs" support back in 2014
(8dfdc6b185f7d9c5d6166f28dd2693fc64a30a27) we had yet to switch to SDL 2. At the
time, SDL_Image didn't provide any method of saving PNG files on its own. However,
it does as of SDL_Image 2.0.0.
A small caveat is that this built-in PNG save functionality is a bit less efficient
at compression than SDL_SavePNG. A test in DiD S1 with SDL_SavePNG_RW vs IMG_SavePNG_RW
yielded a file ~ 1 MB larger in the latter case.
This removed SDL_SavePNG and it's optional build-time dependency of libpng.
cppcheck (via Codacy) pointed out that a variable was initialized, then reassigned, before the initialed value was used.
Moved the variable declaration to the point the actually-used value was assigned.
Best 90 minutes I've ever spent in my life. I could've done string
comparisons, but somehow I suspect their format is more likely to change
in the future than the numeric versions.
Also, beware that the upstream documentation (both on their wiki and
their source) does not accurately reflect history -- the version numbers
for releases between 0.9.3 and 0.9.5 were vastly different, and this
version of the algorithm I wrote seems to be the best fit for all of
them.)
This removes all legacy SDL1.2 code. It was done by invoking:
coan source --replace --no-transients -D"SDL_VERSION_ATLEAST(X, Y, Z)"=1 <file>
on each file.
This does the bare minimum to get the game compiling and running again with SDL 2. It fixes all of the compile errors, adds a missing seek operation to the SDL_RWops. The missing seek operation caused a NULL pointer dereference during game start.
Registers library versions in a single structure that can be queried
later as many times as necessary (say, from the game UI) instead of
relying on recording this information in different object files in an
inconsistent fashion. Also, it provides a pretty formatter for console
usage (e.g., in --version).
libpng also gets to join in the fun.