Expanded ATM code
This commit is contained in:
parent
3ea10c9c33
commit
a9a6c34ba8
24
atm.lua
24
atm.lua
|
@ -18,10 +18,28 @@ local function drawFrame()
|
|||
g.drawText(term, 2, 1, "ATM", colors.white, colors.black)
|
||||
end
|
||||
|
||||
local function showStartMenu()
|
||||
local function showLoginUI()
|
||||
drawFrame()
|
||||
g.drawTextCenter(term, W/2, 3, "Welcome to HandieBank ATM!", colors.green, colors.white)
|
||||
g.drawTextCenter(term, W/2, 4, "Insert your card below, or click to log in or create an account.", colors.black, colors.white)
|
||||
g.drawTextCenter(term, W/2, 4, "Insert your card below, or click to login.", colors.black, colors.white)
|
||||
g.fillRect(term, W/2 - 3, 7, 7, 3, colors.lightGray)
|
||||
g.drawTextCenter(term, W/2, 8, "Login", colors.green, colors.lightGray)
|
||||
while true do
|
||||
local event, p1, p2, p3 = os.pullEvent()
|
||||
if event == "disk" then
|
||||
print("Disk: "..p1)
|
||||
return {username = "bleh", password = "bleh"}
|
||||
elseif event == "mouse_click" then
|
||||
local button = p1
|
||||
local x = p2
|
||||
local y = p3
|
||||
if button == 1 and x >= (W/2 - 3) and x <= (W/2 + 4) and y >= 7 and y <= 9 then
|
||||
return {username = "bleh", password = "bleh"}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
showStartMenu()
|
||||
while true do
|
||||
local credentials = showLoginUI()
|
||||
end
|
Loading…
Reference in New Issue