naming convention for most stuff but not all

This commit is contained in:
lustlion
2022-03-04 23:28:30 +01:00
parent c978855711
commit cef2096577
29 changed files with 354 additions and 436 deletions

View File

@@ -1,7 +1,7 @@
interfaceButton = {type = "Button"}
InterfaceButton = {type = "Button"}
-- 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.pos = {
@@ -46,11 +46,11 @@ function interfaceButton:New(x,y,w,h,table_values,value,style)
return o
end
function interfaceButton:getVariable()
function InterfaceButton:getVariable()
return self.target_variable
end
function interfaceButton:checkMouse(mouse_x, mouse_y)
function InterfaceButton:checkMouse(mouse_x, mouse_y)
if not self.clicked
and mouse_x < self.pos.x + self.size.w/2
and mouse_x > self.pos.x - self.size.w/2
@@ -71,7 +71,7 @@ function interfaceButton:checkMouse(mouse_x, mouse_y)
end
end
function interfaceButton:Draw()
function InterfaceButton:Draw()
local c1, c2, c3, a = love.graphics.getColor()
love.graphics.setColor(self.style.color[1],self.style.color[2],self.style.color[3],self.style.alpha)

View File

@@ -1,6 +1,6 @@
interfaceDialog = {type = "Dialog"}
InterfaceDialog = {type = "Dialog"}
-- dialog boxes
function interfaceDialog:New(style)
function InterfaceDialog:new(style)
local o = {}
o.pos = {
@@ -36,7 +36,7 @@ function interfaceDialog:New(style)
return o
end
function interfaceDialog:updateContents()
function InterfaceDialog:updateContents()
if self.value < self.target_value then
self.contents = self.sequence[self.value]
if self.contents[1] == nil then self.contents[1] = "" end
@@ -45,14 +45,14 @@ function interfaceDialog:updateContents()
end
end
function interfaceDialog:loadSequence(sequence)
function InterfaceDialog:loadSequence(sequence)
self.sequence = sequence
self.value = 1
self.target_value = 1+#sequence
self:updateContents()
end
function interfaceDialog:checkConfirm()
function InterfaceDialog:checkConfirm()
if not self.clicked then
if love.mouse.isDown(1) then
self.clicked = true
@@ -65,7 +65,7 @@ function interfaceDialog:checkConfirm()
end
end
function interfaceDialog:Draw()
function InterfaceDialog:Draw()
local c1, c2, c3, a = love.graphics.getColor()
love.graphics.setColor(self.style.color[1],self.style.color[2],self.style.color[3],self.style.alpha)