* Add MakeRectangle helper to convert from SDL_Rect
* Add Rectangle::inset method for shrinking a rectangle
Turns out some of the other use cases I though this could apply to were actually doing something based on a fixed region
* Simplify initialisation of settings menu rects
1. Do not modify the map after loading. Instead, return string views
(guaranteed to be null-terminated) from look up functions and return
the key directly if not found.
2. Use an `unorded_map` instead of `map` where available (C++20).
Saves a bit of RAM (~50 KiB) and improves lookup performance.
The backgrounds can be quite large, for example
the Hellfire title background is a 2.4 MiB PCX file.
Previously, we converted all background to SDL surfaces.
This required extra memory, e.g. the 2.4 MiB Hellfire
title background uses 4.6 MiB as an SDL surface.
Changes the background to render directly from PCX instead
to reduce the allocator pressure.
SDL_RWsize is documented as returning any negative value on error (even though in practice errors are always indicated by a value of -1) so allow for that instead of only checking for unknown size.
There were also a few unnecessary arithmetic operations being done to calculate the size to read, straightforward to simplify.
SDL_CreateRGBSurfaceWithFormat expects width and height to be positive values < 2^16. Could get away with using unsigned if the SDL API did but it doesn't so stick with signed types even when it doesn't really fit the use.
bufferPitch is an oddity, ultimately it's only used to determine a pointer offset so making the param ptrdiff_t as it's more appropriate than size_t.
Introduces a `ControlDevice` global which is distinct from `ControlMode`
in that it is set to `Gamepad` even when simulating a mouse.
This allows us to avoid a number of edge cases related to mode changes.
Fixes#4242
Hardware cursor should get initialized even for non mouse control types
(e.g. `ControlTypes::None`), because by the time the control type gets
initialized or changes the cursor is already set up and won't change.
Fixes#4233