SDL_DisplayMode now includes the pixel size, the screen size and the relationship between the two. For example, a 4K display at 200% scale could have a pixel size of 3840x2160, a screen size of 1920x1080, and a display scale of 2.0.
Appropriate CPU directive can be used in #pragma aux so that it is not
necessary to hardcode instruction bytes.
(cherry picked from commit 507fc462db1ede9f3ca2c581809a7f1492ac1ff5)
* SDL 3.0 is going to be high DPI aware and officially separates screen coordinates from client pixel area
The public APIs to disable high DPI support have been removed
Work in progress on https://github.com/libsdl-org/SDL/issues/7134
libdecor plugins can change the min/max window size values internally to enforce a minimum window size, and errors and crashes can result if the window size is below the internal limit.
On versions of libdecor >= 0.1.1, the minimum width and height can be queried and the minimum required window size will be enforced. The application requested window size is still respected, however, the actual window may be slightly larger than the drawable area to accommodate the required libdecor minimum size.
On version 0.1.0 of libdecor, which lacks the function to retrieve the minimum size, the internal limits are overridden before committing a frame, so that the internal limits always match the window size as a workaround, even if the window is technically smaller than the plugin would normally allow.
Fixes DPI awareness of testdrawchessboard (previously, the surface was
being created in points instead of pixels, resulting in the demo app
only drawing in a corner of the screen on High-DPI displays)
*_CreateWindowFramebuffer()/*_UpdateWindowFramebuffer(): are updated
to use SDL_GetWindowSizeInPixels instead of SDL_GetWindowSize() or
window->w/window->h.
Most of the _CreateWindowFramebuffer backends are untested except
for Windows.
Fixes#7047
This fixes the clang warning "Cast between pointer-to-function and pointer-to-object is an extension"
You can define SDL_FUNCTION_POINTER_IS_VOID_POINTER in your project to restore the previous behavior.
Fixes https://github.com/libsdl-org/SDL/issues/2866
You can enable and disable subsystems with SDL_ENABLE_SYSWM_*/SDL_DISABLE_SYSWM_* and you can disable the type forward declarations with SDL_DISABLE_SYSWM_*_TYPES
This simplifies the API and removes a level of API translation between the int variants of the functions and the float implementation
Fixes https://github.com/libsdl-org/SDL/issues/6656
Also cleaned up logic for whether we need to poll for events:
- We need to periodically poll for joysticks to handle hotplug.
- We need to frequently poll for joysticks and sensors when they're open so their state can be updated
This function is useful for accumulating relative mouse motion if you want to only handle whole pixel movement.
e.g.
static float dx_frac, dy_frac;
float dx, dy;
/* Accumulate new motion with previous sub-pixel motion */
dx = event.motion.xrel + dx_frac;
dy = event.motion.yrel + dy_frac;
/* Split the integral and fractional motion, dx and dy will contain whole pixel deltas */
dx_frac = SDL_modff(dx, &dx);
dy_frac = SDL_modff(dy, &dy);
if (dx != 0.0f || dy != 0.0f) {
...
}
I don't think there's any point in console_*main() for non-MSVC - I think
it can't be called anyway now that SDL_main is header-only.
So I renamed those functions to main() and wmain() and made them MSVC-only
For reference, MinGW (at least the version I tested) supports both main()
and WinMain(), no matter if compiled with -mconsole or -mwindows (it seems
to prefer main() over WinMain() if both are available, in both cases).
But when building with -municode, it needs wmain() or wWinMain(), so
that case is now handled with wWinMain()
Feedback from @icculus:
"IsTablet" uses "is" as a form of "to be" ...like, the actual question is of its nature.
The rest is just a superfluous word in the question and it flows as better English with if (RectEmpty) than if (IsRectEmpty)
Fixes https://github.com/libsdl-org/SDL/issues/6932
`SDL_QUERY`, `SDL_IGNORE`, `SDL_ENABLE`, and `SDL_DISABLE` have been removed.
SDL_EventState() has been replaced with SDL_SetEventEnabled()
SDL_GetEventState() has been replaced with SDL_EventEnabled()
SDL_GameControllerEventState has been replaced with SDL_SetGamepadEventsEnabled() and SDL_GamepadEventsEnabled()
SDL_JoystickEventState has been replaced with SDL_SetJoystickEventsEnabled() and SDL_JoystickEventsEnabled()
SDL_ShowCursor() has been split into three functions: SDL_ShowCursor(), SDL_HideCursor(), and SDL_CursorVisible()
Fixes https://github.com/libsdl-org/SDL/issues/6929
Instead of indexing into an internal list of devices which requires locking, we return a list of device IDs which can then be queried individually.
Reference: https://github.com/libsdl-org/SDL/issues/6889