added custom button colors and borderless toggle

This commit is contained in:
Mango 2025-08-23 23:14:11 -07:00
commit 40034d2f00
4 changed files with 27 additions and 8 deletions

View file

@ -1,11 +1,12 @@
local Object = require "classic" local Object = require "classic"
local Button = Object:extend() local Button = Object:extend()
function Button:new(x, y, r, b) function Button:new(x, y, r, b, c)
self.x = x self.x = x
self.y = y self.y = y
self.r = r self.r = r
self.b = b self.b = b
self.c = c or {1, 1, 1}
self.press = false self.press = false
end end
@ -33,6 +34,7 @@ function Button:draw()
else else
mode = "line" mode = "line"
end end
love.graphics.setColor(self.c)
love.graphics.circle(mode, self.x + self.r, self.y + self.r, self.r) love.graphics.circle(mode, self.x + self.r, self.y + self.r, self.r)
end end

View file

@ -1,10 +1,12 @@
WINDOWWIDTH = 373
WINDOWHEIGHT = 212
BORDERLESS = true
function love.conf(t) function love.conf(t)
t.window.width = 373 t.window.width = WINDOWWIDTH
t.window.height = 212 t.window.height = WINDOWHEIGHT
t.window.borderless = true 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

View file

View file

@ -3,7 +3,6 @@ function love.load()
fightstick = joysticks[1] fightstick = joysticks[1]
require("sdl") require("sdl")
require("invis")
local Button = require "button" local Button = require "button"
love.window.setPosition(1440, 960-373) love.window.setPosition(1440, 960-373)
@ -16,7 +15,7 @@ function love.load()
Button(127, 144, 30, "dpup"), Button(127, 144, 30, "dpup"),
} }
--attack keys --attack keys, add {x,x,x} value to change color of button
attack = { attack = {
Button(159, 29, 24, "x"), Button(159, 29, 24, "x"),
Button(208, 8, 24, "y"), Button(208, 8, 24, "y"),
@ -29,7 +28,21 @@ function love.load()
} }
end 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
end
function love.update(dt) function love.update(dt)
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)
@ -42,7 +55,9 @@ function love.update(dt)
end end
function love.draw() function love.draw()
love.graphics.setBackgroundColor(1, 179/255, 102/255) love.graphics.setBackgroundColor(0,0,0)
--love.graphics.setBackgroundColor(1, 179/255, 102/255)
--love.graphics.print("borderless = " .. (BORDERLESS and "true" or "false"), 0, 0)
--movement keys --movement keys
for i, v in ipairs(movement) do for i, v in ipairs(movement) do