From 434b5e6865f6c13aaa349f0aa87c1914baa12114 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Tue, 12 Feb 2019 18:35:52 +0100 Subject: [PATCH] core/menusystem: place the cursor drawing script in a separate file --- .../core/modules/menusystem/widgets/init.lua | 29 ---------------- .../core/modules/menusystem/widgets/utils.lua | 34 +++++++++++++++++++ 2 files changed, 34 insertions(+), 29 deletions(-) create mode 100644 sonic-boost.love/core/modules/menusystem/widgets/utils.lua diff --git a/sonic-boost.love/core/modules/menusystem/widgets/init.lua b/sonic-boost.love/core/modules/menusystem/widgets/init.lua index 7aa78d9..a09bfab 100644 --- a/sonic-boost.love/core/modules/menusystem/widgets/init.lua +++ b/sonic-boost.love/core/modules/menusystem/widgets/init.lua @@ -106,35 +106,6 @@ function BaseWidget:destroy() self.destroyed = true 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 return Widget diff --git a/sonic-boost.love/core/modules/menusystem/widgets/utils.lua b/sonic-boost.love/core/modules/menusystem/widgets/utils.lua new file mode 100644 index 0000000..ab4a48c --- /dev/null +++ b/sonic-boost.love/core/modules/menusystem/widgets/utils.lua @@ -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