#193 pocket main application core
This commit is contained in:
@@ -16,7 +16,7 @@ local config = require("pocket.config")
|
||||
local pocket = require("pocket.pocket")
|
||||
local renderer = require("pocket.renderer")
|
||||
|
||||
local POCKET_VERSION = "alpha-v0.1.0"
|
||||
local POCKET_VERSION = "alpha-v0.1.1"
|
||||
|
||||
-- local print = util.print
|
||||
local println = util.println
|
||||
|
||||
22
pocket/ui/components/boiler_page.lua
Normal file
22
pocket/ui/components/boiler_page.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
local style = require("pocket.ui.style")
|
||||
|
||||
local core = require("graphics.core")
|
||||
|
||||
local Div = require("graphics.elements.div")
|
||||
local TextBox = require("graphics.elements.textbox")
|
||||
|
||||
local cpair = core.graphics.cpair
|
||||
|
||||
local TEXT_ALIGN = core.graphics.TEXT_ALIGN
|
||||
|
||||
-- new boiler page view
|
||||
---@param root graphics_element parent
|
||||
local function new_view(root)
|
||||
local main = Div{parent=root,x=1,y=1}
|
||||
|
||||
TextBox{parent=main,text="BOILERS",x=1,y=1,height=1,alignment=TEXT_ALIGN.CENTER}
|
||||
|
||||
return main
|
||||
end
|
||||
|
||||
return new_view
|
||||
22
pocket/ui/components/home_page.lua
Normal file
22
pocket/ui/components/home_page.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
local style = require("pocket.ui.style")
|
||||
|
||||
local core = require("graphics.core")
|
||||
|
||||
local Div = require("graphics.elements.div")
|
||||
local TextBox = require("graphics.elements.textbox")
|
||||
|
||||
local cpair = core.graphics.cpair
|
||||
|
||||
local TEXT_ALIGN = core.graphics.TEXT_ALIGN
|
||||
|
||||
-- new home page view
|
||||
---@param root graphics_element parent
|
||||
local function new_view(root)
|
||||
local main = Div{parent=root,x=1,y=1}
|
||||
|
||||
TextBox{parent=main,text="HOME",x=1,y=1,height=1,alignment=TEXT_ALIGN.CENTER}
|
||||
|
||||
return main
|
||||
end
|
||||
|
||||
return new_view
|
||||
22
pocket/ui/components/reactor_page.lua
Normal file
22
pocket/ui/components/reactor_page.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
local style = require("pocket.ui.style")
|
||||
|
||||
local core = require("graphics.core")
|
||||
|
||||
local Div = require("graphics.elements.div")
|
||||
local TextBox = require("graphics.elements.textbox")
|
||||
|
||||
local cpair = core.graphics.cpair
|
||||
|
||||
local TEXT_ALIGN = core.graphics.TEXT_ALIGN
|
||||
|
||||
-- new reactor page view
|
||||
---@param root graphics_element parent
|
||||
local function new_view(root)
|
||||
local main = Div{parent=root,x=1,y=1}
|
||||
|
||||
TextBox{parent=main,text="REACTOR",x=1,y=1,height=1,alignment=TEXT_ALIGN.CENTER}
|
||||
|
||||
return main
|
||||
end
|
||||
|
||||
return new_view
|
||||
22
pocket/ui/components/turbine_page.lua
Normal file
22
pocket/ui/components/turbine_page.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
local style = require("pocket.ui.style")
|
||||
|
||||
local core = require("graphics.core")
|
||||
|
||||
local Div = require("graphics.elements.div")
|
||||
local TextBox = require("graphics.elements.textbox")
|
||||
|
||||
local cpair = core.graphics.cpair
|
||||
|
||||
local TEXT_ALIGN = core.graphics.TEXT_ALIGN
|
||||
|
||||
-- new turbine page view
|
||||
---@param root graphics_element parent
|
||||
local function new_view(root)
|
||||
local main = Div{parent=root,x=1,y=1}
|
||||
|
||||
TextBox{parent=main,text="TURBINES",x=1,y=1,height=1,alignment=TEXT_ALIGN.CENTER}
|
||||
|
||||
return main
|
||||
end
|
||||
|
||||
return new_view
|
||||
22
pocket/ui/components/unit_page.lua
Normal file
22
pocket/ui/components/unit_page.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
local style = require("pocket.ui.style")
|
||||
|
||||
local core = require("graphics.core")
|
||||
|
||||
local Div = require("graphics.elements.div")
|
||||
local TextBox = require("graphics.elements.textbox")
|
||||
|
||||
local cpair = core.graphics.cpair
|
||||
|
||||
local TEXT_ALIGN = core.graphics.TEXT_ALIGN
|
||||
|
||||
-- new unit page view
|
||||
---@param root graphics_element parent
|
||||
local function new_view(root)
|
||||
local main = Div{parent=root,x=1,y=1}
|
||||
|
||||
TextBox{parent=main,text="UNITS",x=1,y=1,height=1,alignment=TEXT_ALIGN.CENTER}
|
||||
|
||||
return main
|
||||
end
|
||||
|
||||
return new_view
|
||||
@@ -8,11 +8,18 @@ local style = require("pocket.ui.style")
|
||||
|
||||
local conn_waiting = require("pocket.ui.components.conn_waiting")
|
||||
|
||||
local home_page = require("pocket.ui.components.home_page")
|
||||
local unit_page = require("pocket.ui.components.unit_page")
|
||||
local reactor_page = require("pocket.ui.components.reactor_page")
|
||||
local boiler_page = require("pocket.ui.components.boiler_page")
|
||||
local turbine_page = require("pocket.ui.components.turbine_page")
|
||||
|
||||
local core = require("graphics.core")
|
||||
|
||||
local ColorMap = require("graphics.elements.colormap")
|
||||
local DisplayBox = require("graphics.elements.displaybox")
|
||||
local Div = require("graphics.elements.div")
|
||||
local MultiPane = require("graphics.elements.multipane")
|
||||
local TextBox = require("graphics.elements.textbox")
|
||||
|
||||
local PushButton = require("graphics.elements.controls.push_button")
|
||||
@@ -59,7 +66,19 @@ local function init(monitor)
|
||||
}
|
||||
}
|
||||
|
||||
local sidebar = Sidebar{parent=main,x=1,y=2,tabs=sidebar_tabs,fg_bg=cpair(colors.white,colors.gray),callback=function()end}
|
||||
local mp_div = Div{parent=main,x=4,y=2}
|
||||
|
||||
local pane_1 = home_page(mp_div)
|
||||
local pane_2 = unit_page(mp_div)
|
||||
local pane_3 = reactor_page(mp_div)
|
||||
local pane_4 = boiler_page(mp_div)
|
||||
local pane_5 = turbine_page(mp_div)
|
||||
|
||||
local panes = { pane_1, pane_2, pane_3, pane_4, pane_5 }
|
||||
|
||||
local multipane = MultiPane{parent=mp_div,x=1,y=1,panes=panes}
|
||||
|
||||
local sidebar = Sidebar{parent=main,x=1,y=2,tabs=sidebar_tabs,fg_bg=cpair(colors.white,colors.gray),callback=multipane.set_value}
|
||||
|
||||
return main
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user