mirror of
https://github.com/love2d/love.git
synced 2026-08-19 20:19:42 +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;
|
int bindcount = 0;
|
||||||
SDL_GamepadBinding **sdlbindings = SDL_GetGamepadBindings(controller, &bindcount);
|
SDL_GamepadBinding **sdlbindings = SDL_GetGamepadBindings(controller, &bindcount);
|
||||||
const SDL_GamepadBinding *sdlbinding = nullptr;
|
|
||||||
for (int i = 0; i < bindcount; i++)
|
for (int i = 0; i < bindcount; i++)
|
||||||
{
|
{
|
||||||
const SDL_GamepadBinding *b = sdlbindings[i];
|
const SDL_GamepadBinding *b = sdlbindings[i];
|
||||||
if ((input.type == INPUT_TYPE_BUTTON && b->outputType == SDL_GAMEPAD_BINDTYPE_BUTTON && b->output.button == sdlbutton)
|
if ((input.type == INPUT_TYPE_BUTTON && b->output_type == SDL_GAMEPAD_BINDTYPE_BUTTON && b->output.button == sdlbutton)
|
||||||
|| (input.type == INPUT_TYPE_AXIS && b->outputType == SDL_GAMEPAD_BINDTYPE_AXIS && b->output.axis.axis == sdlaxis))
|
|| (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:
|
case SDL_GAMEPAD_BINDTYPE_BUTTON:
|
||||||
jinput.type = INPUT_TYPE_BUTTON;
|
jinput.type = INPUT_TYPE_BUTTON;
|
||||||
|
|||||||
@@ -1512,13 +1512,21 @@ void Window::setMouseGrab(bool grab)
|
|||||||
{
|
{
|
||||||
mouseGrabbed = grab;
|
mouseGrabbed = grab;
|
||||||
if (window)
|
if (window)
|
||||||
|
#if SDL_VERSION_ATLEAST(3, 0, 0)
|
||||||
|
SDL_SetWindowMouseGrab(window, (SDL_bool) grab);
|
||||||
|
#else
|
||||||
SDL_SetWindowGrab(window, (SDL_bool) grab);
|
SDL_SetWindowGrab(window, (SDL_bool) grab);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Window::isMouseGrabbed() const
|
bool Window::isMouseGrabbed() const
|
||||||
{
|
{
|
||||||
if (window)
|
if (window)
|
||||||
|
#if SDL_VERSION_ATLEAST(3, 0, 0)
|
||||||
|
return SDL_GetWindowMouseGrab(window);
|
||||||
|
#else
|
||||||
return SDL_GetWindowGrab(window) != SDL_FALSE;
|
return SDL_GetWindowGrab(window) != SDL_FALSE;
|
||||||
|
#endif
|
||||||
else
|
else
|
||||||
return mouseGrabbed;
|
return mouseGrabbed;
|
||||||
}
|
}
|
||||||
@@ -1684,7 +1692,11 @@ int Window::showMessageBox(const MessageBoxData &data)
|
|||||||
{
|
{
|
||||||
SDL_MessageBoxButtonData sdlbutton = {};
|
SDL_MessageBoxButtonData sdlbutton = {};
|
||||||
|
|
||||||
|
#if SDL_VERSION_ATLEAST(3, 0, 0)
|
||||||
|
sdlbutton.buttonID = i;
|
||||||
|
#else
|
||||||
sdlbutton.buttonid = i;
|
sdlbutton.buttonid = i;
|
||||||
|
#endif
|
||||||
sdlbutton.text = data.buttons[i].c_str();
|
sdlbutton.text = data.buttons[i].c_str();
|
||||||
|
|
||||||
if (i == data.enterButtonIndex)
|
if (i == data.enterButtonIndex)
|
||||||
|
|||||||
Reference in New Issue
Block a user