mirror of
https://github.com/love2d/love.git
synced 2026-08-15 15:51:12 +02:00
update code for some recent SDL3 renames
This commit is contained in:
@@ -334,14 +334,13 @@ Joystick::JoystickInput Joystick::getGamepadMapping(const GamepadInput &input) c
|
||||
|
||||
int bindcount = 0;
|
||||
SDL_GamepadBinding **sdlbindings = SDL_GetGamepadBindings(controller, &bindcount);
|
||||
const SDL_GamepadBinding *sdlbinding = nullptr;
|
||||
for (int i = 0; i < bindcount; i++)
|
||||
{
|
||||
const SDL_GamepadBinding *b = sdlbindings[i];
|
||||
if ((input.type == INPUT_TYPE_BUTTON && b->outputType == SDL_GAMEPAD_BINDTYPE_BUTTON && b->output.button == sdlbutton)
|
||||
|| (input.type == INPUT_TYPE_AXIS && b->outputType == SDL_GAMEPAD_BINDTYPE_AXIS && b->output.axis.axis == sdlaxis))
|
||||
if ((input.type == INPUT_TYPE_BUTTON && b->output_type == SDL_GAMEPAD_BINDTYPE_BUTTON && b->output.button == sdlbutton)
|
||||
|| (input.type == INPUT_TYPE_AXIS && b->output_type == SDL_GAMEPAD_BINDTYPE_AXIS && b->output.axis.axis == sdlaxis))
|
||||
{
|
||||
switch (b->inputType)
|
||||
switch (b->input_type)
|
||||
{
|
||||
case SDL_GAMEPAD_BINDTYPE_BUTTON:
|
||||
jinput.type = INPUT_TYPE_BUTTON;
|
||||
|
||||
@@ -1512,13 +1512,21 @@ void Window::setMouseGrab(bool grab)
|
||||
{
|
||||
mouseGrabbed = grab;
|
||||
if (window)
|
||||
#if SDL_VERSION_ATLEAST(3, 0, 0)
|
||||
SDL_SetWindowMouseGrab(window, (SDL_bool) grab);
|
||||
#else
|
||||
SDL_SetWindowGrab(window, (SDL_bool) grab);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool Window::isMouseGrabbed() const
|
||||
{
|
||||
if (window)
|
||||
#if SDL_VERSION_ATLEAST(3, 0, 0)
|
||||
return SDL_GetWindowMouseGrab(window);
|
||||
#else
|
||||
return SDL_GetWindowGrab(window) != SDL_FALSE;
|
||||
#endif
|
||||
else
|
||||
return mouseGrabbed;
|
||||
}
|
||||
@@ -1684,7 +1692,11 @@ int Window::showMessageBox(const MessageBoxData &data)
|
||||
{
|
||||
SDL_MessageBoxButtonData sdlbutton = {};
|
||||
|
||||
#if SDL_VERSION_ATLEAST(3, 0, 0)
|
||||
sdlbutton.buttonID = i;
|
||||
#else
|
||||
sdlbutton.buttonid = i;
|
||||
#endif
|
||||
sdlbutton.text = data.buttons[i].c_str();
|
||||
|
||||
if (i == data.enterButtonIndex)
|
||||
|
||||
Reference in New Issue
Block a user