cleaned code, fixed icon, buttons, and resolution
This commit is contained in:
parent
594e47ffd1
commit
6ba4f47466
4 changed files with 57 additions and 76 deletions
|
@ -13,12 +13,12 @@ end
|
||||||
function Button:update(dt)
|
function Button:update(dt)
|
||||||
if self.b == "triggerleft" or self.b == "triggerright" then
|
if self.b == "triggerleft" or self.b == "triggerright" then
|
||||||
if fightstick:getGamepadAxis(self.b) == 1 then
|
if fightstick:getGamepadAxis(self.b) == 1 then
|
||||||
self.press = true
|
self.press = true
|
||||||
else
|
else
|
||||||
self.press = false
|
self.press = false
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if fightstick:isGamepadDown(self.b) then
|
if fightstick:isGamepadDown(self.b) then
|
||||||
self.press = true
|
self.press = true
|
||||||
else
|
else
|
||||||
self.press = false
|
self.press = false
|
||||||
|
|
7
conf.lua
7
conf.lua
|
@ -1,14 +1,13 @@
|
||||||
WINDOWSCALE = 1
|
WINDOWSCALE = 1
|
||||||
WINDOWWIDTH = 373*WINDOWSCALE
|
WINDOWWIDTH = 480*WINDOWSCALE
|
||||||
WINDOWHEIGHT = 212*WINDOWSCALE
|
WINDOWHEIGHT = 270*WINDOWSCALE
|
||||||
BORDERLESS = true
|
BORDERLESS = true
|
||||||
BLACK = true
|
|
||||||
function love.conf(t)
|
function love.conf(t)
|
||||||
t.window.width = WINDOWWIDTH
|
t.window.width = WINDOWWIDTH
|
||||||
t.window.height = WINDOWHEIGHT
|
t.window.height = WINDOWHEIGHT
|
||||||
t.window.borderless = BORDERLESS
|
t.window.borderless = BORDERLESS
|
||||||
t.window.title = "input display"
|
t.window.title = "input display"
|
||||||
t.window.icon = "icon.png"
|
t.window.icon = "icon.png"
|
||||||
|
|
||||||
t.modules.physics = false
|
t.modules.physics = false
|
||||||
end
|
end
|
BIN
icon.png
BIN
icon.png
Binary file not shown.
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 140 KiB |
120
main.lua
120
main.lua
|
@ -1,80 +1,62 @@
|
||||||
function love.load()
|
function love.load()
|
||||||
|
require("sdl")
|
||||||
joysticks = love.joystick.getJoysticks()
|
joysticks = love.joystick.getJoysticks()
|
||||||
fightstick = joysticks[1]
|
fightstick = joysticks[1]
|
||||||
|
local Button = require "button"
|
||||||
require("sdl")
|
--movement keys
|
||||||
local Button = require "button"
|
movement = {
|
||||||
|
Button(25, 40, 29, "dpleft"),
|
||||||
love.window.setPosition(1440, 960-373)
|
Button(90, 40, 29, "dpdown"),
|
||||||
|
Button(147, 71, 29, "dpright"),
|
||||||
--movement keys
|
Button(168, 180, 36, "dpup"),
|
||||||
movement = {
|
}
|
||||||
Button(8, 27, 24, "dpleft"),
|
--attack keys, add {x,x,x} value to change color of button
|
||||||
Button(62, 27, 24, "dpdown"),
|
attack = {
|
||||||
Button(109, 53, 24, "dpright"),
|
Button(207, 43, 29, "x"),
|
||||||
Button(127, 144, 30, "dpup"),
|
Button(265, 17, 29, "y"),
|
||||||
}
|
Button(330, 22, 29, "rightshoulder"),
|
||||||
|
Button(395, 38, 29, "leftshoulder"),
|
||||||
--attack keys, add {x,x,x} value to change color of button
|
Button(202, 110, 29, "a"),
|
||||||
attack = {
|
Button(263, 86, 29, "b"),
|
||||||
Button(159, 29, 24, "x"),
|
Button(330, 88, 29, "triggerright"),
|
||||||
Button(208, 8, 24, "y"),
|
Button(394, 105, 29, "triggerleft"),
|
||||||
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
|
end
|
||||||
|
|
||||||
--switches the borderless window setting, remembering the position
|
|
||||||
function love.keypressed(key)
|
function love.keypressed(key)
|
||||||
if key == "space" then
|
--pressing b will change the borderless setting, and the position of the window is prevented from resetting during this
|
||||||
if BORDERLESS then
|
if key == "b" then
|
||||||
BORDERLESS = false
|
if BORDERLESS then
|
||||||
love.window.setMode(WINDOWWIDTH, WINDOWHEIGHT, {borderless=false, x=windowx, y=windowy})
|
BORDERLESS = false
|
||||||
else
|
love.window.setMode(WINDOWWIDTH, WINDOWHEIGHT, {borderless=false, x=windowx, y=windowy})
|
||||||
BORDERLESS = true
|
else
|
||||||
love.window.setMode(WINDOWWIDTH, WINDOWHEIGHT, {borderless=true, x=windowx, y=windowy})
|
BORDERLESS = true
|
||||||
end
|
love.window.setMode(WINDOWWIDTH, WINDOWHEIGHT, {borderless=true, x=windowx, y=windowy})
|
||||||
end
|
end
|
||||||
if key == "c" then
|
end
|
||||||
if BLACK then
|
|
||||||
BLACK = false
|
|
||||||
love.graphics.setBackgroundColor(0,1,0)
|
|
||||||
else
|
|
||||||
BLACK = true
|
|
||||||
love.graphics.setBackgroundColor(0,0,0)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function love.update(dt)
|
function love.update(dt)
|
||||||
windowx, windowy, _ = love.window.getPosition()
|
windowx, windowy, _ = love.window.getPosition()
|
||||||
|
--movement keys
|
||||||
--movement keys
|
for i, v in ipairs(movement) do
|
||||||
for i, v in ipairs(movement) do
|
v:update(dt)
|
||||||
v:update(dt)
|
end
|
||||||
end
|
--attack keys
|
||||||
|
for i, v in ipairs(attack) do
|
||||||
--attack keys
|
v:update(dt)
|
||||||
for i, v in ipairs(attack) do
|
end
|
||||||
v:update(dt)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function love.draw()
|
function love.draw()
|
||||||
love.graphics.scale(WINDOWSCALE, WINDOWSCALE)
|
love.graphics.scale(WINDOWSCALE, WINDOWSCALE)
|
||||||
|
love.graphics.setLineWidth(2)
|
||||||
--movement keys
|
--movement keys
|
||||||
for i, v in ipairs(movement) do
|
for i, v in ipairs(movement) do
|
||||||
v:draw()
|
v:draw()
|
||||||
end
|
end
|
||||||
|
--attack keys
|
||||||
--attack keys
|
for i, v in ipairs(attack) do
|
||||||
for i, v in ipairs(attack) do
|
v:draw()
|
||||||
v:draw()
|
end
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue