Compare commits

...

2 Commits

Author SHA1 Message Date
Jay 9d2cca67eb Merge branch 'master' of https://github.com/teverse/teverse 2020-04-15 20:26:40 +01:00
Jay beb35bbc8f Develop and app dashboard 2020-04-15 20:26:38 +01:00
5 changed files with 217 additions and 138 deletions

View File

@ -3,6 +3,23 @@ return {
iconId = "shapes",
iconType = "faSolid",
setup = function(page)
teverse.construct("guiTextBox", {
parent = page,
size = guiCoord(1.0, -20, 0, 48),
position = guiCoord(0, 10, 0, 10),
backgroundAlpha = 0,
text = "Apps",
textSize = 48,
textAlign = "middleLeft"
})
teverse.construct("guiTextBox", {
parent = page,
size = guiCoord(1.0, -20, 0, 18),
position = guiCoord(0, 10, 0, 58),
backgroundAlpha = 0,
text = "Coming soon in a minor update!",
textSize = 18,
textAlign = "middleLeft"
})
end
}

View File

@ -3,6 +3,66 @@ return {
iconId = "layer-group",
iconType = "faSolid",
setup = function(page)
teverse.construct("guiTextBox", {
parent = page,
size = guiCoord(1.0, -20, 0, 48),
position = guiCoord(0, 10, 0, 10),
backgroundAlpha = 0,
text = "Develop",
textSize = 48,
textAlign = "middleLeft"
})
local newSandboxBtn = teverse.construct("guiFrame", {
parent = page,
size = guiCoord(1/3, -20, 0, 70),
position = guiCoord(0, 10, 0, 60),
backgroundColour = colour.rgb(74, 140, 122),
strokeRadius = 3
})
teverse.guiHelper
.bind(newSandboxBtn, "xs", {
size = guiCoord(1, -20, 0, 70),
position = guiCoord(0, 10, 0, 60)
})
.bind(newSandboxBtn, "sm", {
size = guiCoord(1/3, -20, 0, 70),
position = guiCoord(0, 10, 0, 60)
})
.bind(newSandboxBtn, "lg", {
size = guiCoord(1/3, -20, 0, 70),
position = guiCoord(0, 10, 0, 60)
})
.hoverColour(newSandboxBtn, colour.rgb(235, 187, 83))
newSandboxBtn:on("mouseLeftUp", function()
teverse.apps:prompt()
end)
teverse.construct("guiTextBox", {
parent = newSandboxBtn,
size = guiCoord(0.5, -10, 0, 18),
position = guiCoord(0.5, 0, 0.5, -9),
backgroundAlpha = 0,
text = "Run Script",
textSize = 18,
textAlign = "middleLeft",
textColour = colour(1, 1, 1),
active = false
--textFont = "tevurl:fonts/openSansLight.ttf"
})
teverse.construct("guiIcon", {
parent = newSandboxBtn,
size = guiCoord(0, 40, 0, 40),
position = guiCoord(0.5, -60, 0.5, -20),
iconMax = 40,
iconColour = colour(1, 1, 1),
iconType = "faSolid",
iconId = "code",
iconAlpha = 0.9,
active = false
})
end
}

View File

@ -61,6 +61,8 @@ return {
iconId = "sliders-h",
iconType = "faSolid",
setup = function(page)
page.backgroundAlpha = 1.0
local feed = teverse.construct("guiScrollView", {
parent = page,
size = guiCoord(1, 0, 1, 50),
@ -69,7 +71,7 @@ return {
strokeRadius = 3
})
teverse.bp
teverse.guiHelper
.bind(feed, "xs", {
size = guiCoord(1, 0, 1, 50),
position = guiCoord(0, 0, 0, -50)
@ -87,7 +89,7 @@ return {
strokeRadius = 3
})
teverse.bp
teverse.guiHelper
.bind(tevs, "xs", {
size = guiCoord(1, -20, 0, 70),
position = guiCoord(0, 10, 0, 50)
@ -144,7 +146,7 @@ return {
strokeRadius = 3
})
teverse.bp
teverse.guiHelper
.bind(membership, "xs", {
size = guiCoord(1, -20, 0, 70),
position = guiCoord(0, 10, 0, 80 + 50)
@ -209,7 +211,7 @@ return {
strokeRadius = 3
})
teverse.bp
teverse.guiHelper
.bind(version, "xs", {
size = guiCoord(1, -20, 0, 70),
position = guiCoord(0, 10, 0, 160 + 50)
@ -272,7 +274,7 @@ return {
clip = true
})
teverse.bp
teverse.guiHelper
.bind(feedItems, "xs", {
size = guiCoord(1, -20, 1, -(240 + 50)),
position = guiCoord(0, 10, 0, 240 + 50)
@ -309,6 +311,7 @@ return {
local json = teverse.json:decode(body)
if json[1].id == newestFeed then
-- no change from last refresh
return nil
else
-- may require refactoring
for _,v in pairs(feedItems.children) do
@ -317,6 +320,7 @@ return {
end
end
end
newestFeed = json[1].id
local y = 50
for _,v in pairs(json) do
local date = os.date("%d/%m/%Y %H:%M", os.parseISO8601(v.postedAt))

View File

@ -13,7 +13,7 @@ controller.setup = function()
backgroundAlpha = 0
})
teverse.bp
teverse.guiHelper
.gridConstraint(navContainer, {
cellSize = guiCoord(0, 40, 0, 40),
cellMargin = guiCoord(0, 25, 0, 25)
@ -68,7 +68,7 @@ controller.setup = function()
backgroundColour = colour.rgb(242, 244, 245)
})
teverse.bp
teverse.guiHelper
.bind(body, "xs", {
size = guiCoord(1, 90, 1, -5),
position = guiCoord(0, -45, 0, -60)
@ -90,7 +90,7 @@ controller.setup = function()
visible = false
})
teverse.bp
teverse.guiHelper
.bind(container, "xs", {
size = guiCoord(1, -120, 1, -80),
position = guiCoord(0, 60, 0, 80)

View File

@ -1,142 +1,140 @@
return function()
-- Textbox colour/border radius/shadow demo
local colours = {
colour(1, 0, 0),
colour(1, 1, 0),
colour(0, 1, 0),
colour(0, 1, 1),
colour(0, 0, 1),
colour(1, 0, 1),
colour(1, 1, 1),
colour(0, 0, 0)
}
-- Textbox colour/border radius/shadow demo
local size = 1/#colours
local lastColour = colour(0,0,0)
for i = 1, #colours do
teverse.construct("guiTextBox", {
parent = teverse.interface,
size = guiCoord(size, 0, 0, 50),
position = guiCoord(size * (i - 1), 0, 0, 0),
backgroundColour = colours[i],
text = "#" .. colours[i]:hex(),
textShadowSize = 2,
textColour = colour(1, 1, 1)
})
local colours = {
colour(1, 0, 0),
colour(1, 1, 0),
colour(0, 1, 0),
colour(0, 1, 1),
colour(0, 0, 1),
colour(1, 0, 1),
colour(1, 1, 1),
colour(0, 0, 0)
}
local c = colours[i] * colour(0.9, 0.9, 0.9)
teverse.construct("guiGradientFrame", {
parent = teverse.interface,
size = guiCoord(size, 2, 0, 20),
position = guiCoord(size * (i - 1), -1, 0, 60),
backgroundColour = lastColour,
backgroundColourB = c,
start = guiCoord(0.4, 0, 0, 0),
finish = guiCoord(0.6, 0, size * (i - 1), 0)
})
local size = 1/#colours
local lastColour = colour(0,0,0)
for i = 1, #colours do
teverse.construct("guiTextBox", {
parent = teverse.interface,
size = guiCoord(size, 0, 0, 50),
position = guiCoord(size * (i - 1), 0, 0, 0),
backgroundColour = colours[i],
text = "#" .. colours[i]:hex(),
textShadowSize = 2,
textColour = colour(1, 1, 1)
})
lastColour = c
local c = colours[i] * colour(0.9, 0.9, 0.9)
teverse.construct("guiGradientFrame", {
parent = teverse.interface,
size = guiCoord(size, 2, 0, 20),
position = guiCoord(size * (i - 1), -1, 0, 60),
backgroundColour = lastColour,
backgroundColourB = c,
start = guiCoord(0.4, 0, 0, 0),
finish = guiCoord(0.6, 0, size * (i - 1), 0)
})
lastColour = c
end
-- Textbox Align Demo
local reverseAlign = {}
for k,v in pairs(enums.align) do
reverseAlign[tonumber(v)] = k
end
local txtGuis = {}
local size = 1/3
local i = 0
local y = 90
for a = 0, 8 do
i = i + 1
local gui = teverse.construct("guiTextBox", {
parent = teverse.interface,
size = guiCoord(size, -1, 0, 28),
position = guiCoord(size * (i - 1), 0, 0, y),
backgroundColour = colour(1, 1, 1),
text = "enums.align." .. reverseAlign[a],
textSize = 14,
textAlign = a,
strokeRadius = 5
})
table.insert(txtGuis, gui)
if i > 2 then
i = 0
y = y + 29
end
end
-- Textbox Align Demo
for i = 1, #colours do
teverse.construct("guiImage", {
position = guiCoord(0, (i-1) * 75, 0, y),
size = guiCoord(0, 75, 0, 50),
parent = teverse.interface,
backgroundAlpha = 0,
image = "tevurl:img/tTiled.png",
imageBottomRight = vector2(3, 2),
imageColour = colours[i]
})
end
local reverseAlign = {}
for k,v in pairs(enums.align) do
reverseAlign[v] = k
end
local size = 1/#colours
y = y + 60
local previous = 0
for i = 1, #colours do
local new = math.random(1, 50)
local a = teverse.construct("guiLine", {
pointA = guiCoord(size*(i-1), 0, 0, y + previous),
pointB = guiCoord(size*(i), 0, 0, y + new),
parent = teverse.interface,
lineWidth = 5,
lineAlpha = 0.5,
lineColour = colours[i],
lineCap = enums.lineCap.round
})
previous = new
end
local txtGuis = {}
local size = 1/3
local i = 0
local y = 90
for a = 0, 8 do
i = i + 1
local gui = teverse.construct("guiTextBox", {
parent = teverse.interface,
size = guiCoord(size, -1, 0, 28),
position = guiCoord(size * (i - 1), 0, 0, y),
backgroundColour = colour(1, 1, 1),
text = "enums.align." .. reverseAlign[a],
textSize = 14,
textAlign = a,
strokeRadius = 5
})
table.insert(txtGuis, gui)
if i > 2 then
i = 0
y = y + 29
end
end
for i = 1, #colours do
teverse.construct("guiImage", {
position = guiCoord(0, (i-1) * 75, 0, y),
size = guiCoord(0, 75, 0, 50),
parent = teverse.interface,
backgroundAlpha = 0,
image = "tevurl:img/tTiled.png",
imageBottomRight = vector2(3, 2),
imageColour = colours[i]
})
end
local size = 1/#colours
y = y + 60
local previous = 0
for i = 1, #colours do
local new = math.random(1, 50)
local a = teverse.construct("guiLine", {
pointA = guiCoord(size*(i-1), 0, 0, y + previous),
pointB = guiCoord(size*(i), 0, 0, y + new),
parent = teverse.interface,
lineWidth = 5,
lineAlpha = 0.5,
lineColour = colours[i],
lineCap = enums.lineCap.round
})
previous = new
end
for i = 1, #colours do
local new = math.random(1, 50)
local a = teverse.construct("guiLineBezier", {
pointA = guiCoord(0, 0, 0, y + (i * 10)),
controlA = guiCoord(0, 50, 0, y+100),
pointB = guiCoord(1, 0, 0, y - 30 + (i * 10)),
controlB = guiCoord(1, -200, 0, y-100),
parent = teverse.interface,
lineWidth = 2,
lineColour = colours[i],
lineCap = enums.lineCap.round
})
previous = new
end
y = y + 60
-- create an arrow using lines:
local arrow = teverse.construct("guiLine", {
pointA = guiCoord(0, 100, 0, y ),
pointB = guiCoord(0, 100, 0, y + 50),
for i = 1, #colours do
local new = math.random(1, 50)
local a = teverse.construct("guiLineBezier", {
pointA = guiCoord(0, 0, 0, y + (i * 10)),
controlA = guiCoord(0, 50, 0, y+100),
pointB = guiCoord(1, 0, 0, y - 30 + (i * 10)),
controlB = guiCoord(1, -200, 0, y-100),
parent = teverse.interface,
lineWidth = 2,
-- rotation = 0.4
lineColour = colours[i],
lineCap = enums.lineCap.round
})
previous = new
end
teverse.construct("guiLine", {
parent = arrow,
pointA = guiCoord(0, 0, 0, 0 ),
pointB = guiCoord(0, 10, 0, -10),
lineWidth = 2
})
y = y + 60
teverse.construct("guiLine", {
parent = arrow,
pointA = guiCoord(0, 0, 0, 0 ),
pointB = guiCoord(0, -10, 0, -10),
lineWidth = 2
})
end
-- create an arrow using lines:
local arrow = teverse.construct("guiLine", {
pointA = guiCoord(0, 100, 0, y ),
pointB = guiCoord(0, 100, 0, y + 50),
parent = teverse.interface,
lineWidth = 2,
-- rotation = 0.4
})
teverse.construct("guiLine", {
parent = arrow,
pointA = guiCoord(0, 0, 0, 0 ),
pointB = guiCoord(0, 10, 0, -10),
lineWidth = 2
})
teverse.construct("guiLine", {
parent = arrow,
pointA = guiCoord(0, 0, 0, 0 ),
pointB = guiCoord(0, -10, 0, -10),
lineWidth = 2
})