Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Notepad app by Miki_Tellurium
- -- Version: 1.0.0
- local textLibrary = require("text")
- local buttonLibrary = require("button")
- local library = require("notepadsettings")
- term.clear()
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- local version = {1, 0, 0}
- local program = nil
- --Settings setup
- notepadsettings.defineSettings()
- notepadsettings.createSettings()
- settings.load("notepad.settings")
- local headerText = settings.get("HeaderText")
- local headerColor = settings.get("HeaderColor")
- local ingameInfoTitleColor = settings.get("IngameInfoTitleColor")
- local ingameInfoColor = settings.get("IngameInfoColor")
- local irlInfoTitleColor = settings.get("IrlInfoTitleColor")
- local irlInfoColor = settings.get("IrlInfoColor")
- -- Buttons definition
- local settingsButton = button:new()
- settingsButton:setLabel("Settings")
- settingsButton:setBackgroundColor(colors.purple)
- settingsButton:setTextColor(colors.black)
- settingsButton:setLocation(3, 17)
- local memosButton = button:new()
- memosButton:setLabel("Memos")
- memosButton:setBackgroundColor(colors.yellow)
- memosButton:setTextColor(colors.black)
- memosButton:setLocation(3, 9)
- term.setBackgroundColor(colors.black)
- term.clear()
- -- Show time informations
- function timeInfos()
- while true do
- local header = headerText
- local ingame_day = os.day("ingame")
- local ingame_time = textutils.formatTime(os.time("ingame"), true)
- local irl_date = os.date("%d/%m/%Y")
- local irl_time = textutils.formatTime(os.time("local"), true)
- text.print(header, 1, 1, headerColor)
- if settings.get("ItalyFlag") == true then
- term.setCursorPos(23, 1)
- term.blit(" ", "fff", "d0e")
- end
- text.print("Ingame day:", 2, 2, ingameInfoTitleColor)
- text.print(ingame_day, 5, 3, ingameInfoColor)
- text.print("Ingame time:", 2, 5, ingameInfoTitleColor)
- text.print(ingame_time.." ", 5, 6, ingameInfoColor)
- text.print("IRL Date:", 16, 2, irlInfoTitleColor)
- text.print(irl_date, 16, 3, irlInfoColor)
- text.print("IRL Time:", 16, 5, irlInfoTitleColor)
- text.print(irl_time.." ", 18, 6, irlInfoColor)
- text.print("v", 1, 20, colors.white)
- text.print(version[1]..".", 2, 20, colors.blue)
- text.print(version[2]..".", 4, 20, colors.cyan)
- text.print(version[3], 6, 20, colors.lightBlue)
- sleep(0.1)
- end
- end
- -- Draw buttons and perform actions
- function buttons()
- settingsButton:paint()
- memosButton:paint()
- local event = {os.pullEvent("mouse_click")}
- if settingsButton:waitForClick(event) then
- program = "settingsapp.lua"
- elseif memosButton:waitForClick(event) then
- program = "memos.lua"
- end
- end
- -- Run the program
- while true do
- parallel.waitForAny(timeInfos, buttons)
- if program ~= nil then
- shell.run(program)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment