From e32356335f2ba2c9c7a998abaccb814c30b6f21a Mon Sep 17 00:00:00 2001 From: lustlion Date: Sun, 27 Feb 2022 03:40:41 +0100 Subject: [PATCH] fixed pause crash --- code/ui/button.lua | 9 +++------ code/ui/dialog.lua | 4 ++-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/code/ui/button.lua b/code/ui/button.lua index 4826c9f..b8b4396 100644 --- a/code/ui/button.lua +++ b/code/ui/button.lua @@ -2,8 +2,8 @@ interfaceButton = {type = "Button"} -- centered buttons function interfaceButton:New(x,y,w,h,table_values,value,style) + local o = {} - o = {} o.pos = { x = x, y = y @@ -11,7 +11,6 @@ function interfaceButton:New(x,y,w,h,table_values,value,style) o.size = { w = w, h = h - } o.values = table_values or {false,true} @@ -40,12 +39,10 @@ function interfaceButton:New(x,y,w,h,table_values,value,style) scale_proportion = 1.5 } - AddElement(o) setmetatable(o, self) self.__index = self - return o end @@ -59,7 +56,7 @@ function interfaceButton:checkMouse(mouse_x, mouse_y) and mouse_x > self.pos.x - self.size.w/2 and mouse_y < self.pos.y + self.size.h/2 and mouse_y > self.pos.y - self.size.h/2 then - self.style.scale_proportion = o.style.selected.scale_proportion + self.style.scale_proportion = self.style.selected.scale_proportion if love.mouse.isDown(1) then self.clicked = true self.value = self.value + 1 @@ -69,7 +66,7 @@ function interfaceButton:checkMouse(mouse_x, mouse_y) self.target_variable = self.values[self.value] end elseif not love.mouse.isDown(1) then - self.style.scale_proportion = o.style.unselected.scale_proportion + self.style.scale_proportion = self.style.unselected.scale_proportion self.clicked = false end end diff --git a/code/ui/dialog.lua b/code/ui/dialog.lua index 0e69c95..35f2396 100644 --- a/code/ui/dialog.lua +++ b/code/ui/dialog.lua @@ -1,8 +1,8 @@ interfaceDialog = {type = "Dialog"} -- dialog boxes function interfaceDialog:New(style) - - o = {} + local o = {} + o.pos = { x = 0, y = game.height*80/100