This commit is contained in:
jill 2021-01-25 18:17:32 +03:00
parent 101ba11709
commit c4d1846765
Signed by: oat
GPG key ID: DD83A9617A252385
5 changed files with 28 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View file

@ -20,6 +20,7 @@ sprites = {}
sound_path = {}
music_path = {}
fonts = {}
cursors = {}
debug = false
@ -48,6 +49,12 @@ function love.load()
fonts.default = love.graphics.newFont(12)
if scene.load then scene.load() end
cursors.default = love.mouse.newCursor('assets/sprites/cursor/pointer.png', sprites['cursor/pointer']:getWidth()/2, sprites['cursor/pointer']:getHeight()/2)
cursors.hover = love.mouse.newCursor('assets/sprites/cursor/hand.png', sprites['cursor/hand']:getWidth()/2, sprites['cursor/hand']:getHeight()/2)
cursors.drag = love.mouse.newCursor('assets/sprites/cursor/dragging.png', sprites['cursor/dragging']:getWidth()/2, sprites['cursor/dragging']:getHeight()/2)
love.mouse.setCursor(cursors.default)
end
frame = 0

View file

@ -106,9 +106,29 @@ end
function self.update(dt)
bench.startBenchmark('update_buttons')
for _,btn in ipairs(headerbuttons) do
local x = 19
local y = 3
local anyhover = false
for b,btn in ipairs(headerbuttons) do
btn.openanim = btn.openanim + dt * 6
local size = (love.graphics.getWidth()/640)
local hovered = mouseOverBox(x * size, y * size, sprites['header/buttonbg']:getWidth() * size, sprites['header/buttonbg']:getHeight() * size)
if btn.open and hovered then
love.mouse.setCursor(cursors.hover)
anyhover = true
end
local incr = 69 -- its like button positions but forcefully shoved into a recursive function :D
if b == 2 then incr = 57 end
if b >= 3 then incr = 73 end
x = x + incr
end
if not anyhover then
love.mouse.setCursor(cursors.default)
end
bench.stopBenchmark('update_buttons')
bench.startBenchmark('update_food')