improve Prompt and use it to ask for level and file name when exporting

This commit is contained in:
binarycat
2022-03-05 14:29:01 -05:00
parent 8cfc6a9d18
commit edd064c2fd
4 changed files with 31 additions and 4 deletions

View File

@@ -18,6 +18,8 @@ Prompt = {
pos = { x = 10, y = 10 },
input = "",
name = "input",
canceled = false,
closing = false,
active_prompt = nil,
}
@@ -32,9 +34,12 @@ end
function Prompt:keypressed(key, scancode, isrepeat)
if key == "backspace" then
self.input = backspace(self.input)
elseif key == "return" or key == "kpenter" then
elseif key == "return" or key == "kpenter" or key == "escape" then
if key == "escape" then
self.canceled = true
end
self.closing = true
self:func()
Prompt.active_prompt = nil
end
end