mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-26 07:21:22 +02:00
This commit is contained in:
@@ -303,15 +303,12 @@ local function coreRows(opts, hooks)
|
||||
end)
|
||||
end
|
||||
|
||||
-- ORIENTATION (#592): Android only -- the lock rides SDL's orientation
|
||||
-- hint, which iOS reads only at startup (the Info.plist governs there) and
|
||||
-- desktop ignores. Unlike the other launcher rows this one live-applies:
|
||||
-- the window exists here too, and rotating under the player's finger is
|
||||
-- the only feedback that reads.
|
||||
-- ORIENTATION (#592, #1638): mobile only. Unlike the other launcher rows
|
||||
-- this one live-applies: the window exists here too, and rotating under
|
||||
-- the player's finger is the only feedback that reads.
|
||||
do
|
||||
local osName = love.system and love.system.getOS and love.system.getOS()
|
||||
local okOr, Orientation = pcall(require, "src.core.Orientation")
|
||||
if okOr and osName == "Android" then
|
||||
if okOr and (Orientation.isAndroid() or Orientation.isIOS()) then
|
||||
add(Strings("ORIENTATION"),
|
||||
function() return Strings(Orientation.modeLabel(opts.orientation)) end,
|
||||
function(dir)
|
||||
|
||||
@@ -3017,9 +3017,13 @@ local function buildTextModal(imp, m, key, title, body, closeFn)
|
||||
local h = math.floor(math.min(m.H - 2 * m.pad, 460 * m.s))
|
||||
local px, py, pw, ph = modalPanel(m, w, h)
|
||||
local cy = py + pad
|
||||
Kit.text("button", Kit.ellipsize("button", title, pw - 2 * pad),
|
||||
local xW = math.max(Kit.tapMin(), math.floor(30 * m.s))
|
||||
Kit.text("button", Kit.ellipsize("button", title,
|
||||
pw - 2 * pad - xW - math.floor(8 * m.s)),
|
||||
px + pad, cy, PAL.heading)
|
||||
cy = cy + Kit.textHeight("button") + math.floor(10 * m.s)
|
||||
btn(imp, px + pw - pad - xW, cy, xW, xW, key .. "-x", "X",
|
||||
{ font = "small", action = closeFn })
|
||||
cy = cy + math.max(Kit.textHeight("button"), xW) + math.floor(10 * m.s)
|
||||
|
||||
local pagerH = math.max(Kit.tapMin(), math.floor(30 * m.s))
|
||||
local bodyH = (py + ph - pad) - cy - m.btnH - math.floor(10 * m.s)
|
||||
@@ -5071,6 +5075,7 @@ function LauncherView.draw(imp)
|
||||
-- whole stage draws shielded (no clicks, no hover, no focus ring) while
|
||||
-- one is up; buildModals lowers the shield for the modal's own controls.
|
||||
imp._modalUpNow = modalUp(imp)
|
||||
if imp._modalUpNow then imp:_blurPanelFields() end
|
||||
Kit.blockClicks = imp._modalUpNow
|
||||
|
||||
local step = Kit.scrollStep(m.s)
|
||||
|
||||
@@ -2854,6 +2854,7 @@ function RomImporter:_updatePadCursor(dt)
|
||||
local overY = 0
|
||||
if ny > oy + h then overY = ny - (oy + h)
|
||||
elseif ny < oy then overY = ny - oy end
|
||||
if math.abs(ay) > PAD_DEAD and not self._padStickCentered then overY = 0 end
|
||||
if overY ~= 0 and self._flex then
|
||||
require("src.import.LauncherView").wheelmoved(self, 0, -overY / 48)
|
||||
end
|
||||
@@ -2913,7 +2914,11 @@ end
|
||||
function RomImporter:gamepadaxis(_, axis, value)
|
||||
if axis == "leftx" or axis == "lefty" or axis == "righty" then
|
||||
self._padAxis[axis] = value
|
||||
if math.abs(value) > PAD_DEAD then self:_activatePadCursor() end
|
||||
if math.abs(value) > PAD_DEAD then
|
||||
self:_activatePadCursor()
|
||||
elseif axis == "lefty" then
|
||||
self._padStickCentered = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2922,18 +2927,21 @@ end
|
||||
-- fire the virtual cursor's click twice off one A press (#620).
|
||||
function RomImporter:joystickpressed(joystick, button)
|
||||
if GamepadMap.ignoreRawForJoystick(joystick) then return end
|
||||
if GamepadMap.isAccelerometer(joystick) then return end
|
||||
local padButton = GamepadMap.mapRawToGamepadButton(button)
|
||||
if padButton then self:gamepadpressed(joystick, padButton) end
|
||||
end
|
||||
|
||||
function RomImporter:joystickreleased(joystick, button)
|
||||
if GamepadMap.ignoreRawForJoystick(joystick) then return end
|
||||
if GamepadMap.isAccelerometer(joystick) then return end
|
||||
local padButton = GamepadMap.mapRawToGamepadButton(button)
|
||||
if padButton then self:gamepadreleased(joystick, padButton) end
|
||||
end
|
||||
|
||||
function RomImporter:joystickaxis(joystick, axis, value)
|
||||
if GamepadMap.ignoreRawForJoystick(joystick) then return end
|
||||
if GamepadMap.isAccelerometer(joystick) then return end
|
||||
if axis == 1 then
|
||||
self:gamepadaxis(joystick, "leftx", value)
|
||||
elseif axis == 2 then
|
||||
@@ -2943,6 +2951,7 @@ end
|
||||
|
||||
function RomImporter:joystickhat(joystick, hat, direction)
|
||||
if GamepadMap.ignoreRawForJoystick(joystick) then return end
|
||||
if GamepadMap.isAccelerometer(joystick) then return end
|
||||
for _, dir in ipairs(self._rawHatDirs[hat] or {}) do
|
||||
self._padDir[dir] = nil
|
||||
end
|
||||
@@ -4003,6 +4012,18 @@ function RomImporter:_disarmTextInput()
|
||||
end
|
||||
end
|
||||
|
||||
function RomImporter:_blurPanelFields()
|
||||
if not (self._findSearchFocus or self._skinUrlFocus) then return end
|
||||
if self._indexPrompt or self._rename or self._settingsText
|
||||
or self._profileSavePrompt or self._profileRenamePrompt
|
||||
or (self._syncModal and self._syncFocus) then
|
||||
return
|
||||
end
|
||||
self._findSearchFocus = false
|
||||
self._skinUrlFocus = false
|
||||
self:_disarmTextInput()
|
||||
end
|
||||
|
||||
function RomImporter:_beginRename(version, id)
|
||||
local label
|
||||
for _, slot in ipairs(self.slots[version] or {}) do
|
||||
|
||||
Reference in New Issue
Block a user