Commit 982595c7 authored by Danny SMc's avatar Danny SMc

Added new menu, changed colours

parent bcd533cd
--[[
Name: Account -> Login
Description: Login Function
--]]
function program.account.login()
base.screen.colour("white")
program.draw.menubar("Account: Login")
while true do
local args = { os.pullEvent() }
if args[1] == "timer" then
program.draw.menubar("Account: Login")
elseif args[1] == "mouse_click" then
if (args[3] >= 1 and args[3] <= screenx) and (args[4] >= 1 and args[4] <= 2) then
program.draw.menu.handler("Account: Login", args[3], args[4])
end
end
end
end
\ No newline at end of file
......@@ -16,6 +16,7 @@ local paths = {
"main/main.menu.lua";
"main/main.home.lua";
"apps/apps.all.lua";
"account/account.login.lua";
"apps/apps.categories.lua";
"apps/apps.versions.lua";
"apps/apps.search.lua";
......
......@@ -3,10 +3,10 @@
Desc: Sets the environment for the core application
--]]
program = {}; program.core = {}; program.apps = {}; program.snippets = {}; program.cloud = {}; program.mail = {}; program.feed = {}; program.draw = {}; program.main = {}; program.draw.menu = {};
tArgs = { ... }
program = {}; program.core = {}; program.apps = {}; program.snippets = {}; program.cloud = {}; program.mail = {}; program.feed = {}; program.draw = {}; program.main = {}; program.draw.menu = {}; program.chat = {}; program.profiles = {}; program.account = {};
Internal = {
Data = {
Notifications = {};
......@@ -17,4 +17,19 @@ Internal = {
Path = ".DiscoverConfig";
};
Icons = {};
}
\ No newline at end of file
System = {
Platform = false;
ActiveScreen = false;
};
}
local screenx, screeny = term.getSize();
if screenx == 51 and screeny == 19 then
Internal.System.Platform = "Desktop";
elseif screenx == 26 and screeny == 20 then
Internal.System.Platform = "Platform";
elseif screenx == 39 and screeny == 13 then
Internal.System.Platform = "Turtle";
else
Internal.System.Platform = "Unknown";
end
\ No newline at end of file
This diff is collapsed.
function program.main.home()
base.screen.colour("white")
program.draw.menubar("Dashboard")
if Internal.System.Platform == "Desktop" then
base.screen.colour("white")
program.draw.menubar("Dashboard")
local screenx, screeny = term.getSize();
base.draw.box(1, screenx, screeny, 1, " ", "grey", "grey")
local iconnames = {
{
["icon_name"] = "login";
["base_func"] = "account";
["func_name"] = "login";
["thrd_name"] = "Login";
};
-- {
-- ["icon_name"] = "logout";
-- ["base_func"] = "account";
-- ["func_name"] = "logout";
["thrd_name"] = "Logout";
-- };
{
["icon_name"] = "appStore";
["base_func"] = "apps";
["func_name"] = "all";
["thrd_name"] = "Apps";
};
{
["icon_name"] = "snippetStore";
["base_func"] = "snippets";
["func_name"] = "all";
["thrd_name"] = "Snippets";
};
{
["icon_name"] = "cloudStorage";
["base_func"] = "cloud";
["func_name"] = "main";
["thrd_name"] = "Cloud";
};
{
["icon_name"] = "mailbox";
["base_func"] = "mail";
["func_name"] = "inbox";
["thrd_name"] = "Mail";
};
{
["icon_name"] = "newsFeed";
["base_func"] = "feed";
["func_name"] = "view";
["thrd_name"] = "Feed";
};
{
["icon_name"] = "chatRooms";
["base_func"] = "chat";
["func_name"] = "main";
["thrd_name"] = "Chat";
};
{
["icon_name"] = "profiles";
["base_func"] = "profiles";
["func_name"] = "main";
["thrd_name"] = "Profiles";
};
{
["icon_name"] = "accManagement";
["base_func"] = "account";
["func_name"] = "manage";
["thrd_name"] = "Account";
};
{
["icon_name"] = "settings";
["base_func"] = "main";
["func_name"] = "settings";
["thrd_name"] = "Settings";
};
{
["icon_name"] = "updateLogs";
["base_func"] = "main";
["func_name"] = "updates";
["thrd_name"] = "Updates";
};
{
["icon_name"] = "help";
["base_func"] = "main";
["func_name"] = "help";
["thrd_name"] = "Help";
};
{
["icon_name"] = "credits";
["base_func"] = "main";
["func_name"] = "credits";
["thrd_name"] = "Credits";
};
}
local scroll = 0
local iconnames = {
Internal.Icons["accManagement"],
Internal.Icons["appStore"],
Internal.Icons["chatRooms"],
Internal.Icons["cloudStorage"],
Internal.Icons["credits"],
Internal.Icons["help"],
Internal.Icons["login"],
Internal.Icons["logout"],
Internal.Icons["mailbox"],
Internal.Icons["newsFeed"],
Internal.Icons["profiles"],
Internal.Icons["settings"],
Internal.Icons["snippetStore"],
Internal.Icons["socialNetwork"],
Internal.Icons["updateLogs"],
}
local function redraw()
for wid = 0,3 do
for hei = 0,5 do
base.gui.image.render(2+(16*wid),(3+(hei*5))-scroll,iconnames[(wid+1)+(hei*3)])
-- print(type(Internal.Icons[(wid+1)+(hei*3)]))
local page = 1
local iconx = {3,19,35,3,19,35,3,19,35}
local icony = {4,4,4,9,9,9,14,14,14,14}
local pages = math.ceil(#iconnames / 9)
local function render()
local amount = pages * 9
local cpage = page * 9 - 9
for i=1, 9 do
base.draw.box(iconx[i], 14, icony[i], 2, " ", "white", "white")
base.draw.box(iconx[i], 14, icony[i]+2, 2, " ", "white", "white")
local current = cpage + i;
if current <= #iconnames then
base.draw.texta("ICON" .. tostring(current .. ":" .. page), iconx[i], icony[i], false, "red", "white")
base.gui.image.render(iconx[i], icony[i], Internal.Icons[iconnames[current]["icon_name"]])
end
end
base.draw.textl(" Page: " .. tostring(page) .. " / " .. tostring(pages), screeny, false, "cyan", "grey")
end
end
redraw()
while true do
local args = { os.pullEvent() }
if args[1] == "timer" then
program.draw.menubar("Dashboard")
elseif args[1] == "mouse_click" then
program.draw.menu.handler("Home", args[3], args[4])
elseif args[1] == "mouse_scroll" then
if args[2] == -1 then -- Scroll up
if not scroll == 0 then
scroll = scroll-1
redraw()
render();
while true do
local args = { os.pullEvent() }
if args[1] == "timer" then
program.draw.menubar("Dashboard")
elseif args[1] == "mouse_click" then
if (args[3] >= 1 and args[3] <= screenx) and (args[4] >= 1 and args[4] <= 2) then
program.draw.menu.handler("Home", args[3], args[4])
elseif (args[3] >= 1 and args[3] <= screenx) and (args[4] >= 3 and args[4] <= screeny-1) then
local cpage = page * 9 - 9
if (args[3] >= 3 and args[3] <= 16) and (args[4] >= 4 and args[4] <= 7) then
local current = cpage + 1
if #iconnames >= current then
if not base.thread.find(iconnames[current]["thrd_name"]) then
base.thread.create(iconnames[current]["thrd_name"], program[iconnames[current]["base_func"]][iconnames[current]["func_name"]]);
end
base.thread.switch(iconnames[current]["thrd_name"])
end
elseif (args[3] >= 19 and args[3] <= 32) and (args[4] >= 4 and args[4] <= 7) then
local current = cpage + 2
elseif (args[3] >= 35 and args[3] <= 48) and (args[4] >= 4 and args[4] <= 7) then
local current = cpage + 3
elseif (args[3] >= 3 and args[3] <= 16) and (args[4] >= 9 and args[4] <= 12) then
local current = cpage + 4
elseif (args[3] >= 19 and args[3] <= 32) and (args[4] >= 9 and args[4] <= 12) then
local current = cpage + 5
elseif (args[3] >= 35 and args[3] <= 48) and (args[4] >= 9 and args[4] <= 12) then
local current = cpage + 6
elseif (args[3] >= 3 and args[3] <= 16) and (args[4] >= 14 and args[4] <= 17) then
local current = cpage + 7
elseif (args[3] >= 19 and args[3] <= 32) and (args[4] >= 14 and args[4] <= 17) then
local current = cpage + 8
elseif (args[3] >= 35 and args[3] <= 48) and (args[4] >= 14 and args[4] <= 17) then
local current = cpage + 9
end
end
elseif args[2] == 1 then -- Scroll down
if not scroll == 25 then
scroll = scroll+1
redraw()
elseif args[1] == "mouse_scroll" then
if args[2] == -1 then -- Scroll up
if page > 1 then
page = page - 1
render()
end
elseif args[2] == 1 then -- Scroll down
if page < pages then
page = page+1
render()
end
end
end
end
elseif Internal.System.Platform == "Turtle" then
elseif Internal.System.Platform == "Pocket" then
end
end
--[[
###################################################
-- -- -- ---
]]
\ No newline at end of file
......@@ -3,11 +3,13 @@
Desc: Menu bar at the top of everything
--]]
local tasks_bar = false;
Internal.System.ActiveScreen = "Homepage";
function program.draw.menubar(screen)
base.draw.box(1, 51, 1, 2, " ", "grey", "lightGrey")
base.draw.textl("Discover App", 1, false, "blue", "lightGrey")
base.draw.textc(base.time.current(), 1, false, "lime", "lightGrey")
base.draw.textr("(".. #Internal.Data.Notifications .. ") Alerts", 1, false, "red", "lightGrey")
Internal.System.ActiveScreen = tostring(screen);
base.draw.box(1, 51, 1, 2, " ", "grey", "grey")
base.draw.textl("Discover App", 1, false, "cyan", "grey")
base.draw.textc(base.time.current(), 1, false, "lime", "grey")
base.draw.textr("(".. #Internal.Data.Notifications .. ") Alerts", 1, false, "lightGrey", "grey")
if tasks_bar then
program.draw.menu.tasks(true, false)
else
......@@ -34,14 +36,14 @@ function program.draw.menu.tasks(open, animate)
if open then
if animate then
for i=51, 1, -2 do
base.draw.box(i, 2, 2, 1, " ", "grey", "grey")
base.draw.box(i, 2, 2, 1, " ", "lightGrey", "lightGrey")
sleep(0.001)
end
base.draw.textr("Close >", 2, false, "white", "grey")
base.draw.textr("Close >", 2, false, "white", "lightGrey")
local chars = {2, 12, 22, 32}
local text = {"Dash", "Apps", "Cloud", "Mail"}
for k,v in ipairs(chars) do
base.draw.texta(text[k], chars[k], 2, false, "lightBlue", "grey")
base.draw.texta(text[k], chars[k], 2, false, "lightBlue", "lightGrey")
if animate then
sleep(0.01)
end
......@@ -51,20 +53,20 @@ function program.draw.menu.tasks(open, animate)
local x,y = term.getSize();
local chars = {2, 12, 22, 32}
local text = {"Dash", "Apps", "Cloud", "Mail"}
base.draw.box(1, x, 2, 1, " ", "grey", "grey")
base.draw.textr("Close >", 2, false, "white", "grey")
for k,v in ipairs(chars) do base.draw.texta(text[k], chars[k], 2, false, "lightBlue", "grey"); end
base.draw.box(1, x, 2, 1, " ", "lightGrey", "lightGrey")
base.draw.textr("Close >", 2, false, "white", "lightGrey")
for k,v in ipairs(chars) do base.draw.texta(text[k], chars[k], 2, false, "lightBlue", "lightGrey"); end
end
else
if animate then
for i=1, 51, 2 do
base.draw.box(i, 2, 2, 1, " ", "lightGrey", "lightGrey")
base.draw.box(i, 2, 2, 1, " ", "grey", "grey")
sleep(0.001)
end
os.startTimer(1);
end
base.draw.textl("Homepage", 2, false, "black", "lightGrey");
base.draw.textl(Internal.System.ActiveScreen, 2, false, "black", "grey");
if animate then sleep(0.01); end
base.draw.textr("Tasks <", 2, false, "white", "lightGrey")
base.draw.textr("Tasks <", 2, false, "white", "grey")
end
end
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment