diff --git a/main.lua b/main.lua index 62175e4d..04cf3dc6 100644 --- a/main.lua +++ b/main.lua @@ -656,7 +656,7 @@ function love.gamepadpressed(joystick, button) end return end - if Studio then return end + if Studio then return Studio.gamepadpressed(joystick, button) end if Importer then return Importer:gamepadpressed(joystick, button) end if not Game then return end Game:gamepadpressed(joystick, button) @@ -676,7 +676,7 @@ function love.gamepadreleased(joystick, button) end return end - if Studio then return end + if Studio then return Studio.gamepadreleased(joystick, button) end if Importer then return Importer:gamepadreleased(joystick, button) end if not Game then return end Game:gamepadreleased(joystick, button) @@ -696,7 +696,7 @@ function love.gamepadaxis(joystick, axis, value) end return end - if Studio then return end + if Studio then return Studio.gamepadaxis(joystick, axis, value) end if Importer then return Importer:gamepadaxis(joystick, axis, value) end if not Game then return end Game:gamepadaxis(joystick, axis, value) @@ -716,7 +716,7 @@ function love.joystickpressed(joystick, button) end return end - if Studio then return end + if Studio then return Studio.joystickpressed(joystick, button) end if Importer then return Importer:joystickpressed(joystick, button) end if not Game then return end Game:joystickpressed(joystick, button) @@ -736,7 +736,7 @@ function love.joystickreleased(joystick, button) end return end - if Studio then return end + if Studio then return Studio.joystickreleased(joystick, button) end if Importer then return Importer:joystickreleased(joystick, button) end if not Game then return end Game:joystickreleased(joystick, button) @@ -756,7 +756,7 @@ function love.joystickaxis(joystick, axis, value) end return end - if Studio then return end + if Studio then return Studio.joystickaxis(joystick, axis, value) end if Importer then return Importer:joystickaxis(joystick, axis, value) end if not Game then return end Game:joystickaxis(joystick, axis, value) @@ -776,7 +776,7 @@ function love.joystickhat(joystick, hat, direction) end return end - if Studio then return end + if Studio then return Studio.joystickhat(joystick, hat, direction) end if Importer then return Importer:joystickhat(joystick, hat, direction) end if not Game then return end Game:joystickhat(joystick, hat, direction) diff --git a/ports/uwp/third_party/love/README.md b/ports/uwp/third_party/love/README.md index cca8b2fa..2d0ea9d5 100644 --- a/ports/uwp/third_party/love/README.md +++ b/ports/uwp/third_party/love/README.md @@ -1,6 +1,6 @@ # LÖVE UWP binaries -These x64 UWP Release binaries were built from [`caorthann-celt/love-xbox-uwp`](https://github.com/caorthann-celt/love-xbox-uwp) at commit `cdf85f28ed794c95d6f5f7e3a8f23ca9ee1fbdcb`. +These x64 UWP Release binaries were built from [`caorthann-celt/love-xbox-uwp`](https://github.com/caorthann-celt/love-xbox-uwp) at commit `3f51bf0be5f3f86e5934da3893caba2b817f82c1`. The build uses LÖVE 11.5, LuaJIT, SDL2, and ANGLE. Keep the DLLs and import libraries together; they are one binary interface. diff --git a/ports/uwp/third_party/love/bin/love.dll b/ports/uwp/third_party/love/bin/love.dll index 306fc5c5..aff9cd5c 100644 Binary files a/ports/uwp/third_party/love/bin/love.dll and b/ports/uwp/third_party/love/bin/love.dll differ diff --git a/ports/uwp/third_party/love/lib/lovestatic.lib b/ports/uwp/third_party/love/lib/lovestatic.lib index af2d8ad1..31fbc9cb 100644 Binary files a/ports/uwp/third_party/love/lib/lovestatic.lib and b/ports/uwp/third_party/love/lib/lovestatic.lib differ diff --git a/ports/uwp/third_party/manifest.json b/ports/uwp/third_party/manifest.json index ec790a24..f0db3d4f 100644 --- a/ports/uwp/third_party/manifest.json +++ b/ports/uwp/third_party/manifest.json @@ -7,7 +7,7 @@ "love": { "version": "11.5", "repository": "https://github.com/caorthann-celt/love-xbox-uwp.git", - "commit": "cdf85f28ed794c95d6f5f7e3a8f23ca9ee1fbdcb" + "commit": "3f51bf0be5f3f86e5934da3893caba2b817f82c1" }, "luajit": { "repository": "https://github.com/LuaJIT/LuaJIT.git", @@ -99,7 +99,7 @@ }, { "path": "love/bin/love.dll", - "sha256": "A3622828014F03DDB502D2A7807DC8F94432172595BE03508099BD66937FD45F" + "sha256": "E2CE334817636AA9EFF97E181FB5C33C506971F2AC7C653F2CA751B5CDE2FCE6" }, { "path": "love/bin/lua51.dll", @@ -111,7 +111,7 @@ }, { "path": "love/lib/lovestatic.lib", - "sha256": "15FB3A9CB3C3CDAB8B33DE5B1D1F8D8FF6CE9719E9AA7BC2CF3D7B51CDCE0C98" + "sha256": "3794690ED3F44DB6F0C83BBC1673979922627929E852E7668C9911DE1F72B972" }, { "path": "love/lib/lua51.lib", diff --git a/src/ui/SkinStudio.lua b/src/ui/SkinStudio.lua index b27aa26e..d7a111d8 100644 --- a/src/ui/SkinStudio.lua +++ b/src/ui/SkinStudio.lua @@ -6,6 +6,8 @@ local TouchControls = require("src.core.TouchControls") local SaveData = require("src.core.SaveData") local FilePicker = require("src.core.FilePicker") local SafeArea = require("src.core.SafeArea") +local GamepadMap = require("src.core.GamepadMap") +local PadCursor = require("src.ui.PadCursor") local Studio = {} @@ -501,6 +503,7 @@ function Studio.load(opts) Studio.thumbs = {} Studio.pointerX, Studio.pointerY = nil, nil Studio.pointerDown, Studio.touchId = false, nil + PadCursor.reset() -- Studio always opens on the library. Creating and choosing a skin are -- first-class tasks, not controls buried inside the editor workspace. Studio.mode = "library" @@ -758,6 +761,7 @@ function Studio.unload() Studio.undoStack, Studio.redoStack = {}, {} Studio.pointerX, Studio.pointerY = nil, nil Studio.pointerDown, Studio.touchId = false, nil + PadCursor.reset() end -- The Studio is a real touch editor on Android and iOS. Keeping this here, @@ -2678,7 +2682,12 @@ function Studio.draw() local f = Studio._frame Kit.layout(f.w, f.h) local mx, my = love.mouse.getPosition() - if Studio.pointerX ~= nil then mx, my = Studio.pointerX, Studio.pointerY end + local px, py, padActive = PadCursor.pointer() + if padActive then + mx, my = px, py + elseif Studio.pointerX ~= nil then + mx, my = Studio.pointerX, Studio.pointerY + end Kit.beginFrame(mx, my, Studio.clicked, Studio.wheel) Studio.clicked, Studio.wheel = false, 0 Theme.fill(0, 0, W, H, PAL.bg, 1) @@ -2691,19 +2700,26 @@ function Studio.draw() Kit.blockClicks = false Studio.drawOverlay(f.w, f.h) Kit.endFrame() + PadCursor.draw() end -- ---------------------------------------------------------------- input -function Studio.update() +function Studio.update(dt) + PadCursor.update(dt or 0) + local x, y, active = PadCursor.pointer() + if active and Studio.pointerDown then Studio.mousemoved(x, y) end + local wheel = PadCursor.takeWheel() + if wheel ~= 0 then Studio.wheelmoved(0, wheel) end if not Studio.pendingPlay then return end Studio.pendingPlay = false local onPlay, version, canvas = Studio.onPlay, Studio.version, Studio.canvas() if onPlay then onPlay(version, canvas) end end -function Studio.mousepressed(x, y, button) +function Studio.mousepressed(x, y, button, fromPad) if button ~= 1 then return end + if not fromPad then PadCursor.yieldToPointer() end Studio.pointerX, Studio.pointerY = x, y Studio.pointerDown = true Studio.clicked = true @@ -2760,6 +2776,65 @@ function Studio.touchpressed(id, x, y) return Studio.mousepressed(x, y, 1) end +local function closeFromPad() + if Studio.confirm then + Studio.confirmNo() + elseif Studio.modal then + Studio.closeModal() + elseif Studio.mode == "editor" then + Studio.backToLibrary() + elseif Studio.onClose then + Studio.onClose() + end +end + +local function handlePadAction(action) + if action == "a" then + local x, y = PadCursor.pointer() + Studio.mousepressed(x, y, 1, true) + elseif action == "b" then + closeFromPad() + end +end + +function Studio.gamepadpressed(joystick, button) + handlePadAction(PadCursor.gamepadpressed(joystick, button)) +end + +function Studio.gamepadreleased(joystick, button) + PadCursor.gamepadreleased(joystick, button) + if GamepadMap.mapGamepadButton(button) == "a" then + local x, y = PadCursor.pointer() + Studio.mousereleased(x, y, 1) + end +end + +function Studio.gamepadaxis(joystick, axis, value) + PadCursor.gamepadaxis(joystick, axis, value) +end + +function Studio.joystickpressed(joystick, button) + handlePadAction(PadCursor.joystickpressed(joystick, button)) +end + +function Studio.joystickreleased(joystick, button) + PadCursor.joystickreleased(joystick, button) + if GamepadMap.ignoreRawForJoystick(joystick) then return end + local padButton = GamepadMap.mapRawToGamepadButton(button) + if padButton and GamepadMap.mapGamepadButton(padButton) == "a" then + local x, y = PadCursor.pointer() + Studio.mousereleased(x, y, 1) + end +end + +function Studio.joystickaxis(joystick, axis, value) + PadCursor.joystickaxis(joystick, axis, value) +end + +function Studio.joystickhat(joystick, hat, direction) + PadCursor.joystickhat(joystick, hat, direction) +end + function Studio.touchmoved(id, x, y) if Studio.touchId ~= id then return end return Studio.mousemoved(x, y) @@ -2774,7 +2849,8 @@ end function Studio.wheelmoved(_, dy) if Studio.mode == "editor" and not Studio.modalUp() and dy and dy ~= 0 then local work = Studio.canvasWorkspace - local mx, my = Studio.pointerX, Studio.pointerY + local mx, my, active = PadCursor.pointer() + if not active then mx, my = Studio.pointerX, Studio.pointerY end if (not mx or not my) and love and love.mouse and love.mouse.getPosition then mx, my = love.mouse.getPosition() end