80 lines
1.9 KiB
Lua
80 lines
1.9 KiB
Lua
function love.load()
|
|
|
|
joysticks = love.joystick.getJoysticks()
|
|
fightstick = joysticks[1]
|
|
|
|
require("sdl")
|
|
local Button = require "button"
|
|
|
|
love.window.setPosition(1440, 960-373)
|
|
|
|
--movement keys
|
|
movement = {
|
|
Button(8, 27, 24, "dpleft"),
|
|
Button(62, 27, 24, "dpdown"),
|
|
Button(109, 53, 24, "dpright"),
|
|
Button(127, 144, 30, "dpup"),
|
|
}
|
|
|
|
--attack keys, add {x,x,x} value to change color of button
|
|
attack = {
|
|
Button(159, 29, 24, "x"),
|
|
Button(208, 8, 24, "y"),
|
|
Button(262, 9, 24, "rightshoulder"),
|
|
Button(317, 16, 24, "leftshoulder"),
|
|
Button(155, 85, 24, "a"),
|
|
Button(206, 64, 24, "b"),
|
|
Button(262, 64, 24, "triggerright"),
|
|
Button(315,72, 24, "triggerleft"),
|
|
}
|
|
end
|
|
|
|
--switches the borderless window setting, remembering the position
|
|
function love.keypressed(key)
|
|
if key == "space" then
|
|
if BORDERLESS then
|
|
BORDERLESS = false
|
|
love.window.setMode(WINDOWWIDTH, WINDOWHEIGHT, {borderless=false, x=windowx, y=windowy})
|
|
else
|
|
BORDERLESS = true
|
|
love.window.setMode(WINDOWWIDTH, WINDOWHEIGHT, {borderless=true, x=windowx, y=windowy})
|
|
end
|
|
end
|
|
if key == "c" then
|
|
if BLACK then
|
|
BLACK = false
|
|
love.graphics.setBackgroundColor(0,1,0)
|
|
else
|
|
BLACK = true
|
|
love.graphics.setBackgroundColor(0,0,0)
|
|
end
|
|
end
|
|
end
|
|
|
|
function love.update(dt)
|
|
windowx, windowy, _ = love.window.getPosition()
|
|
|
|
--movement keys
|
|
for i, v in ipairs(movement) do
|
|
v:update(dt)
|
|
end
|
|
|
|
--attack keys
|
|
for i, v in ipairs(attack) do
|
|
v:update(dt)
|
|
end
|
|
end
|
|
|
|
function love.draw()
|
|
love.graphics.scale(WINDOWSCALE, WINDOWSCALE)
|
|
|
|
--movement keys
|
|
for i, v in ipairs(movement) do
|
|
v:draw()
|
|
end
|
|
|
|
--attack keys
|
|
for i, v in ipairs(attack) do
|
|
v:draw()
|
|
end
|
|
end
|