controller support and unfocused window added

This commit is contained in:
Mango 2025-08-23 20:48:07 -07:00
commit 94ba18772b
4 changed files with 46 additions and 17 deletions

View file

@ -1,23 +1,29 @@
function love.load()
require("sdl")
require("invis")
local Button = require "button"
joysticks = love.joystick.getJoysticks()
fightstick = joysticks[1]
--movement keys
movement = {}
mL = Button(8, 27, 24, "a")
mD = Button(62, 27, 24, "s")
mR = Button(109, 53, 24, "d")
mU = Button(127, 144, 30, "space")
mL = Button(8, 27, 24, "dpleft")
mD = Button(62, 27, 24, "dpdown")
mR = Button(109, 53, 24, "dpright")
mU = Button(127, 144, 30, "dpup")
--attack keys
attack = {}
bA = Button(159, 29, 24, "u")
bB = Button(208, 8, 24, "i")
bC = Button(262, 9, 24, "o")
bD = Button(317, 16, 24, "p")
bE = Button(155, 85, 24, "j")
bF = Button(206, 64, 24, "k")
bG = Button(262, 64, 24, "l")
bH = Button(315,72, 24, ";")
bA = Button(159, 29, 24, "x")
bB = Button(208, 8, 24, "y")
bC = Button(262, 9, 24, "rightshoulder")
bD = Button(317, 16, 24, "leftshoulder")
bE = Button(155, 85, 24, "a")
bF = Button(206, 64, 24, "b")
bG = Button(262, 64, 24, "triggerright")
bH = Button(315,72, 24, "triggerleft")
end
function love.update(dt)
@ -40,6 +46,10 @@ end
function love.draw()
for i, joystick in ipairs(joysticks) do
love.graphics.print(joystick:getName(), 10, i * 20)
end
love.graphics.setBackgroundColor(1, 179/255, 102/255)
--movement keys