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
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

View File

@ -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