naming conventions act 2: the end
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
function MenuDraw(menu)
|
||||
function drawMenu(menu)
|
||||
local font = love.graphics.getFont()
|
||||
love.graphics.setFont(LocaleFont)
|
||||
|
||||
@@ -6,19 +6,19 @@ function MenuDraw(menu)
|
||||
love.graphics.setScale()
|
||||
|
||||
if menu == "pause" then
|
||||
MenuDrawPauseScreen()
|
||||
drawMenuPauseScreen()
|
||||
elseif menu == "dialog" then
|
||||
MenuDrawDialog()
|
||||
drawMenuDialog()
|
||||
end
|
||||
|
||||
for _, element in pairs(UIElement) do
|
||||
element:Draw()
|
||||
element:draw()
|
||||
end
|
||||
|
||||
love.graphics.setFont(font)
|
||||
end
|
||||
|
||||
function MenuDrawPauseScreen()
|
||||
function drawMenuPauseScreen()
|
||||
-- Parameters
|
||||
local pauseWidth = 640
|
||||
local pauseHeight = 480
|
||||
@@ -32,10 +32,10 @@ function MenuDrawPauseScreen()
|
||||
love.graphics.rectangle("fill", pauseX, pauseY, pauseWidth, pauseHeight)
|
||||
end
|
||||
|
||||
function MenuDrawDialog()
|
||||
function drawMenuDialog()
|
||||
end
|
||||
|
||||
function MenuStep(menu)
|
||||
function stepMenu(menu)
|
||||
-- first get mouse
|
||||
local mouse_x, mouse_y = love.mouse.getPosition()
|
||||
for _, element in pairs(UIElement) do
|
||||
@@ -47,64 +47,64 @@ function MenuStep(menu)
|
||||
end
|
||||
if menu == 0 then
|
||||
elseif menu == "pause" then
|
||||
MenuStepPauseScreen()
|
||||
stepMenuPauseScreen()
|
||||
elseif menu == "dialog" then
|
||||
MenuStepDialog()
|
||||
stepMenuDialog()
|
||||
end
|
||||
end
|
||||
|
||||
function MenuStepPauseScreen()
|
||||
function stepMenuPauseScreen()
|
||||
if PauseResume:getVariable() == true then
|
||||
PauseResume = nil
|
||||
PauseOptions = nil
|
||||
PauseExit = nil
|
||||
MenuExit()
|
||||
exitMenu()
|
||||
elseif PauseExit:getVariable() == true then
|
||||
love.event.quit()
|
||||
end
|
||||
end
|
||||
|
||||
function MenuStepDialog()
|
||||
function stepMenuDialog()
|
||||
if DialogContainer.value >= DialogContainer.target_value then
|
||||
DialogContainer = nil
|
||||
MenuExit()
|
||||
exitMenu()
|
||||
end
|
||||
end
|
||||
|
||||
function MenuClear()
|
||||
function clearMenu()
|
||||
for _, element in pairs(UIElement) do
|
||||
element = nil
|
||||
end
|
||||
UIElement = {}
|
||||
end
|
||||
|
||||
function MenuExit(to)
|
||||
MenuClear()
|
||||
function exitMenu(to)
|
||||
clearMenu()
|
||||
local to = to or "no"
|
||||
menu_type = to
|
||||
end
|
||||
|
||||
function MenuInit(menu,parameter)
|
||||
function initMenu(menu,parameter)
|
||||
-- main menu
|
||||
if menu == "pause" then
|
||||
MenuInitPauseScreen()
|
||||
initMenuPauseScreen()
|
||||
elseif menu == "dialog" then
|
||||
if parameter == nil then
|
||||
parameter = DialogSequence.Example
|
||||
end
|
||||
MenuInitDialog(parameter)
|
||||
initMenuDialog(parameter)
|
||||
end
|
||||
end
|
||||
|
||||
function MenuInitDialog(parameter)
|
||||
function initMenuDialog(parameter)
|
||||
DialogContainer = interfaceDialog:new()
|
||||
DialogContainer:loadSequence(parameter)
|
||||
end
|
||||
|
||||
function MenuInitPauseScreen()
|
||||
function initMenuPauseScreen()
|
||||
local buttonStandard = {width = 200, height = 30, separation = 10}
|
||||
-- elements
|
||||
PauseResume = interfaceButton:new(
|
||||
PauseResume = InterfaceButton:new(
|
||||
game.width/2,
|
||||
game.height/2-buttonStandard.height-buttonStandard.separation,
|
||||
buttonStandard.width,
|
||||
@@ -117,7 +117,7 @@ function MenuInitPauseScreen()
|
||||
color2 = {1,1,1}
|
||||
}
|
||||
)
|
||||
PauseOptions = interfaceButton:new(
|
||||
PauseOptions = InterfaceButton:new(
|
||||
game.width/2,
|
||||
game.height/2,
|
||||
buttonStandard.width,
|
||||
@@ -130,7 +130,7 @@ function MenuInitPauseScreen()
|
||||
color2 = {1,1,1}
|
||||
}
|
||||
)
|
||||
PauseExit = interfaceButton:new(
|
||||
PauseExit = InterfaceButton:new(
|
||||
game.width/2,
|
||||
game.height/2+buttonStandard.height+buttonStandard.separation,
|
||||
buttonStandard.width,
|
||||
|
||||
Reference in New Issue
Block a user