fixed pause crash

This commit is contained in:
lustlion 2022-02-27 03:40:41 +01:00
parent e62eae1564
commit e32356335f
2 changed files with 5 additions and 8 deletions

View File

@ -2,8 +2,8 @@ interfaceButton = {type = "Button"}
-- centered buttons -- centered buttons
function interfaceButton:New(x,y,w,h,table_values,value,style) function interfaceButton:New(x,y,w,h,table_values,value,style)
local o = {}
o = {}
o.pos = { o.pos = {
x = x, x = x,
y = y y = y
@ -11,7 +11,6 @@ function interfaceButton:New(x,y,w,h,table_values,value,style)
o.size = { o.size = {
w = w, w = w,
h = h h = h
} }
o.values = table_values or {false,true} 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 scale_proportion = 1.5
} }
AddElement(o) AddElement(o)
setmetatable(o, self) setmetatable(o, self)
self.__index = self self.__index = self
return o return o
end end
@ -59,7 +56,7 @@ function interfaceButton:checkMouse(mouse_x, mouse_y)
and mouse_x > self.pos.x - self.size.w/2 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
and mouse_y > self.pos.y - self.size.h/2 then 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 if love.mouse.isDown(1) then
self.clicked = true self.clicked = true
self.value = self.value + 1 self.value = self.value + 1
@ -69,7 +66,7 @@ function interfaceButton:checkMouse(mouse_x, mouse_y)
self.target_variable = self.values[self.value] self.target_variable = self.values[self.value]
end end
elseif not love.mouse.isDown(1) then 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 self.clicked = false
end end
end end

View File

@ -1,8 +1,8 @@
interfaceDialog = {type = "Dialog"} interfaceDialog = {type = "Dialog"}
-- dialog boxes -- dialog boxes
function interfaceDialog:New(style) function interfaceDialog:New(style)
local o = {}
o = {}
o.pos = { o.pos = {
x = 0, x = 0,
y = game.height*80/100 y = game.height*80/100