added color sliders, increased window size and removed window scale

This commit is contained in:
Mango 2025-09-05 21:51:51 -07:00
commit 77310ccdc5
3 changed files with 60 additions and 31 deletions

View file

@ -1,31 +1,41 @@
function love.load()
require("sdl")
local Button = require "button"
local Slider = require "slider"
joysticks = love.joystick.getJoysticks()
fightstick = joysticks[1]
font = love.graphics.newFont("NCZ.otf", 12)
MENU = true
local col1 = {255/255, 179/255, 102/255}
local col2 = {150/255, 109/255, 209/255}
local col3 = {255/255, 0/255, 0/255}
col1 = {255/255, 179/255, 102/255}
col2 = {150/255, 109/255, 209/255}
--movement buttons
movement = {
Button(25, 40, 29, "dpleft", col1),
Button(90, 40, 29, "dpdown", col1),
Button(147, 71, 29, "dpright", col1),
Button(168, 180, 36, "dpup", col1),
Button(37.5, 60, 43.5, "dpleft", col1),
Button(135, 60, 43.5, "dpdown", col1),
Button(220.5, 106.5, 43.5, "dpright", col1),
Button(252, 270, 54, "dpup", col1),
}
--attack buttons
attack = {
Button(207, 43, 29, "x", col2),
Button(265, 17, 29, "y", col2),
Button(330, 22, 29, "rightshoulder", col2),
Button(395, 38, 29, "leftshoulder", col2),
Button(202, 110, 29, "a", col2),
Button(263, 86, 29, "b", col2),
Button(330, 88, 29, "triggerright", col2),
Button(394, 105, 29, "triggerleft", col2),
Button(310.5, 64.5, 43.5, "x", col2),
Button(398.5, 25.5, 43.5, "y", col2),
Button(495, 33, 43.5, "rightshoulder", col2),
Button(592.5, 57, 43.5, "leftshoulder", col2),
Button(303, 165, 43.5, "a", col2),
Button(394.5, 127.5, 43.5, "b", col2),
Button(495, 132, 43.5, "triggerright", col2),
Button(592.5, 157.5, 43.5, "triggerleft", col2),
}
--color sliders
slider = {
Slider(48, 192, 256, 6, 255),
Slider(48, 256, 256, 6, 255),
Slider(48, 312, 256, 6, 255),
Slider(416, 192, 256, 6, 255),
Slider(416, 256, 256, 6, 255),
Slider(416, 312, 256, 6, 255)
}
end
@ -34,17 +44,23 @@ function love.keypressed(key)
MENU = not MENU
elseif key == "b" then
BORDERLESS = not BORDERLESS
love.window.setMode(WINDOWWIDTH, WINDOWHEIGHT, {borderless = BORDERLESS})
love.window.setMode(WINDOWWIDTH, WINDOWHEIGHT, {borderless = BORDERLESS, x=windowx, y=windowy})
elseif key == "r" then
resize()
elseif key == "q" then
love.event.quit()
elseif key == "c" then
for i, m in ipairs(movement) do
m.c = {slider[1].level/255, slider[2].level/255, slider[3].level/255}
end
for i, a in ipairs(attack) do
a.c = {slider[4].level/255, slider[5].level/255, slider[6].level/255}
end
end
end
function love.update(dt)
windowx, windowy, _ = love.window.getPosition()
mousex, mousey = love.mouse.getPosition()
if not MENU then
--movement buttons
for i, v in ipairs(movement) do
@ -54,11 +70,14 @@ function love.update(dt)
for i, v in ipairs(attack) do
v:update(dt)
end
elseif MENU then
for i, v in ipairs(slider) do
v:update(dt)
end
end
end
function love.draw()
love.graphics.scale(WINDOWSCALE, WINDOWSCALE)
love.graphics.setLineWidth(2)
if not MENU then
--movement buttons
@ -70,16 +89,27 @@ function love.draw()
v:draw()
end
elseif MENU then
love.graphics.newFont(10)
for i, v in ipairs(slider) do
v:draw()
end
--rectangles showing the results of slider color
love.graphics.rectangle("line", 328, 191, 16, 128)
love.graphics.rectangle("line", 376, 191, 16, 128)
love.graphics.setColor(slider[1].level/255, slider[2].level/255, slider[3].level/255)
love.graphics.rectangle("fill", 328, 191, 16, 128)
love.graphics.setColor(slider[4].level/255, slider[5].level/255, slider[6].level/255)
love.graphics.rectangle("fill", 376, 191, 16, 128)
--text based instrunctions
love.graphics.setFont(font, 20)
love.graphics.setColor(150/255, 150/255, 150/255)
love.graphics.print("hotkeys:", 0, 0)
love.graphics.print("borderless = b", 0, 16)
love.graphics.print("window scale = s", 0, 32)
love.graphics.print("set color = c", 0, 32)
love.graphics.print("quit = q", 0, 48)
love.graphics.printf("open/close this menu with spacebar", 0, 254, 480, "center")
love.graphics.setColor(255/255, 179/255, 102/255)
love.graphics.printf("open/close this menu with spacebar", 0, 385, 720, "center")
love.graphics.setColor(60/255, 60/255, 60/255)
love.graphics.newFont(6)
love.graphics.printf("made by levi leggott - 2025", 0, 238, 480, "center")
love.graphics.printf("by mango", 0, 365, 720, "center")
end
end