core/menusystem: place the cursor drawing script in a separate file

This commit is contained in:
Kazhnuz 2019-02-12 18:35:52 +01:00
parent b3febf0fb3
commit 434b5e6865
2 changed files with 34 additions and 29 deletions

View file

@ -106,35 +106,6 @@ function BaseWidget:destroy()
self.destroyed = true self.destroyed = true
end end
function drawWidget_selected(x, y, w, h)
love.graphics.setColor(0,0,0)
love.graphics.rectangle("fill", x, y, 4, 8)
love.graphics.rectangle("fill", x, y, 8, 4)
love.graphics.rectangle("fill", x + w, y, -4, 8)
love.graphics.rectangle("fill", x + w, y, -8, 4)
love.graphics.rectangle("fill", x, y + h, 4, -8)
love.graphics.rectangle("fill", x, y + h, 8, -4)
love.graphics.rectangle("fill", x + w, y + h, -4, -8)
love.graphics.rectangle("fill", x + w, y + h, -8, -4)
love.graphics.setColor(255,255,255)
love.graphics.rectangle("fill", x + 1, y + 1, 2, 6)
love.graphics.rectangle("fill", x + 1, y + 1, 6, 2)
love.graphics.rectangle("fill", x + w - 1, y + 1, -2, 6)
love.graphics.rectangle("fill", x + w - 1, y + 1, -6, 2)
love.graphics.rectangle("fill", x + 1, y + h - 1, 2, -6)
love.graphics.rectangle("fill", x + 1, y + h - 1, 6, -2)
love.graphics.rectangle("fill", x + w - 1, y + h - 1, -2, -6)
love.graphics.rectangle("fill", x + w - 1, y + h - 1, -6, -2)
end
Widget.Base = BaseWidget Widget.Base = BaseWidget
return Widget return Widget

View file

@ -0,0 +1,34 @@
local menuUtils = {}
function menuUtils.drawCursor(x, y, w, h)
love.graphics.setColor(0,0,0)
love.graphics.rectangle("fill", x, y, 4, 8)
love.graphics.rectangle("fill", x, y, 8, 4)
love.graphics.rectangle("fill", x + w, y, -4, 8)
love.graphics.rectangle("fill", x + w, y, -8, 4)
love.graphics.rectangle("fill", x, y + h, 4, -8)
love.graphics.rectangle("fill", x, y + h, 8, -4)
love.graphics.rectangle("fill", x + w, y + h, -4, -8)
love.graphics.rectangle("fill", x + w, y + h, -8, -4)
love.graphics.setColor(255,255,255)
love.graphics.rectangle("fill", x + 1, y + 1, 2, 6)
love.graphics.rectangle("fill", x + 1, y + 1, 6, 2)
love.graphics.rectangle("fill", x + w - 1, y + 1, -2, 6)
love.graphics.rectangle("fill", x + w - 1, y + 1, -6, 2)
love.graphics.rectangle("fill", x + 1, y + h - 1, 2, -6)
love.graphics.rectangle("fill", x + 1, y + h - 1, 6, -2)
love.graphics.rectangle("fill", x + w - 1, y + h - 1, -2, -6)
love.graphics.rectangle("fill", x + w - 1, y + h - 1, -6, -2)
end
return menuUtils