Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local gpu = require("component").gpu
- local event = require("event")
- local fs = require("filesystem")
- --local arc = require("arc").GameStart
- local w, h = gpu.getResolution()
- maps={}
- N = 0
- function PutPixel(x, y, color, text)
- gpu.setBackground(color)
- gpu.set(x, y, text)
- gpu.setBackground(0)
- end
- function Menu_2()
- if N == 0 then
- gpu.fill(1, 1, w, h, " ")
- for file in fs.list("../maps/") do
- N = N + 1
- maps[N] = file
- PutPixel(w / 2 - string.len(file) / 2, N * 4, 666666, file)
- end
- end
- _, _, mx, my, _ = event.pull("touch")
- if my % 4 == 0 then
- N = my / 4
- if maps[N] ~= nil then
- if mx + 1 > w / 2 - string.len(maps[N]) / 2 and mx < w / 2 + string.len(maps[N]) / 2 then
- --arc(maps[N])
- -- break
- else
- Menu_2()
- end
- else
- Menu_2()
- end
- else
- Menu_2()
- end
- end
- function Menu_1()
- gpu.setBackground(0)
- gpu.fill(1, 1, w, h, " ")
- PutPixel(w / 2 - 6, h / 2 - 4, 777777, "Начать игру")
- PutPixel(w / 2 - 7, h / 2, 777777, "Редактор карт")
- PutPixel(w / 2 - 3, h / 2 + 4, 777777, "Выход")
- _, _, mx, my, _ = event.pull("touch")
- if mx + 1 > w / 2 - string.len("Начать игру") / 4 and mx + 1 < w / 2 + string.len("Начать игру") / 4 and my == h / 2 - 4 then
- Menu_2()
- elseif mx + 1 > w / 2 - string.len("Редактор карт") / 4 and mx + 1 < w / 2 + string.len("Редактор карт") / 4 and my == h / 2 then
- print("1")
- elseif mx + 1 > w / 2 - string.len("Выход") / 4 and mx + 1 < w / 2 + string.len("Выход") / 4 and my == h / 2 + 4 then
- print(string.len("Выход"))
- else
- Menu_1()
- end
- end
- Menu_1()
Advertisement
Add Comment
Please, Sign In to add comment