diff --git a/button.lua b/button.lua index ec586fc..6313073 100644 --- a/button.lua +++ b/button.lua @@ -13,12 +13,12 @@ end function Button:update(dt) if self.b == "triggerleft" or self.b == "triggerright" then if fightstick:getGamepadAxis(self.b) == 1 then - self.press = true + self.press = true else self.press = false end else - if fightstick:isGamepadDown(self.b) then + if fightstick:isGamepadDown(self.b) then self.press = true else self.press = false diff --git a/conf.lua b/conf.lua index e261ea0..b6303c7 100644 --- a/conf.lua +++ b/conf.lua @@ -1,14 +1,13 @@ WINDOWSCALE = 1 -WINDOWWIDTH = 373*WINDOWSCALE -WINDOWHEIGHT = 212*WINDOWSCALE +WINDOWWIDTH = 480*WINDOWSCALE +WINDOWHEIGHT = 270*WINDOWSCALE BORDERLESS = true -BLACK = true + function love.conf(t) t.window.width = WINDOWWIDTH t.window.height = WINDOWHEIGHT t.window.borderless = BORDERLESS t.window.title = "input display" t.window.icon = "icon.png" - t.modules.physics = false -end \ No newline at end of file +end diff --git a/icon.png b/icon.png index 8215d73..b3ac575 100644 Binary files a/icon.png and b/icon.png differ diff --git a/main.lua b/main.lua index eacaabd..23a037d 100644 --- a/main.lua +++ b/main.lua @@ -1,80 +1,62 @@ 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"), - } + require("sdl") + joysticks = love.joystick.getJoysticks() + fightstick = joysticks[1] + local Button = require "button" + --movement keys + movement = { + Button(25, 40, 29, "dpleft"), + Button(90, 40, 29, "dpdown"), + Button(147, 71, 29, "dpright"), + Button(168, 180, 36, "dpup"), + } + --attack keys, add {x,x,x} value to change color of button + attack = { + Button(207, 43, 29, "x"), + Button(265, 17, 29, "y"), + Button(330, 22, 29, "rightshoulder"), + Button(395, 38, 29, "leftshoulder"), + Button(202, 110, 29, "a"), + Button(263, 86, 29, "b"), + Button(330, 88, 29, "triggerright"), + Button(394, 105, 29, "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 + --pressing b will change the borderless setting, and the position of the window is prevented from resetting during this + if key == "b" 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 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 + 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 + love.graphics.scale(WINDOWSCALE, WINDOWSCALE) + love.graphics.setLineWidth(2) + --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