Compare commits

..

2 Commits

Author SHA1 Message Date
Jay b30fbca745 absolute pixel values for sidebar, topbar 2020-05-03 21:57:24 +01:00
Jay 448fb6e37b Fix old use of 0.19 APIs in workshop files 2020-05-03 21:39:26 +01:00
4 changed files with 46 additions and 48 deletions

View File

@ -53,10 +53,10 @@ return {
size = guiCoord(0.95, 0, 0.4, 0), size = guiCoord(0.95, 0, 0.4, 0),
position = guiCoord(0.025, 0, 0.23, 0), position = guiCoord(0.025, 0, 0.23, 0),
backgroundColour = globals.defaultColours.white, backgroundColour = globals.defaultColours.white,
borderAlpha = 1, strokeAlpha = 1,
borderRadius = 5, strokeRadius = 5,
borderWidth = 3, strokeWidth = 3,
borderColour = globals.defaultColours.secondary strokeColour = globals.defaultColours.secondary
}) })
teverse.construct("guiIcon", { teverse.construct("guiIcon", {
@ -74,7 +74,7 @@ return {
size = guiCoord(0.82, 0, 1, 0), size = guiCoord(0.82, 0, 1, 0),
position = guiCoord(0.15, 0, 0, 0), position = guiCoord(0.15, 0, 0, 0),
text = text, text = text,
fontSize = 16, textSize = 16,
textColour = globals.defaultColours.primary, textColour = globals.defaultColours.primary,
backgroundColour = globals.defaultColours.white, backgroundColour = globals.defaultColours.white,
textAlign = enums.align.middle, textAlign = enums.align.middle,
@ -111,17 +111,17 @@ return {
size = guiCoord(0.8, 0, 0.9, 0), size = guiCoord(0.8, 0, 0.9, 0),
position = guiCoord(0.133, 0, 0.05, 0), position = guiCoord(0.133, 0, 0.05, 0),
backgroundColour = globals.defaultColours.white, backgroundColour = globals.defaultColours.white,
borderAlpha = 1, strokeAlpha = 1,
borderRadius = 5, strokeRadius = 5,
borderWidth = 3, strokeWidth = 3,
borderColour = globals.defaultColours.primary strokeColour = globals.defaultColours.primary
}) })
teverse.construct("guiIcon", { teverse.construct("guiIcon", {
parent = bodyContainer, parent = bodyContainer,
size = guiCoord(0, 16, 0, 16), size = guiCoord(0, 16, 0, 16),
position = guiCoord(0.05, 0, 0.3, 0), position = guiCoord(0.05, 0, 0.3, 0),
iconId = "fa:s-info-circle", iconId = "info-circle",
iconType = "faSolid", iconType = "faSolid",
iconColour = globals.defaultColours.primary, iconColour = globals.defaultColours.primary,
backgroundColour = globals.defaultColours.white, backgroundColour = globals.defaultColours.white,
@ -132,7 +132,7 @@ return {
size = guiCoord(0.82, 0, 1, 0), size = guiCoord(0.82, 0, 1, 0),
position = guiCoord(0.15, 0, 0, 0), position = guiCoord(0.15, 0, 0, 0),
text = text, text = text,
fontSize = 16, textSize = 16,
textColour = globals.defaultColours.primary, textColour = globals.defaultColours.primary,
backgroundColour = globals.defaultColours.white, backgroundColour = globals.defaultColours.white,
textAlign = enums.align.middle, textAlign = enums.align.middle,

View File

@ -24,29 +24,29 @@ return {
teverse.construct("guiFrame", { teverse.construct("guiFrame", {
parent = teverse.interface, parent = teverse.interface,
size = guiCoord(0.04, 0, 0.015, 0), size = guiCoord(0, 40, 0, 10),
position = guiCoord(0, 0, 0.05, 0), position = guiCoord(0, 0, 0, 40),
backgroundColour = globals.defaultColours.secondary, backgroundColour = globals.defaultColours.secondary,
}) })
teverse.construct("guiFrame", { teverse.construct("guiFrame", {
parent = teverse.interface, parent = teverse.interface,
size = guiCoord(0.04, 0, 0.015, 0), size = guiCoord(0, 40, 0, 10),
position = guiCoord(0, 0, 0.24, 0), position = guiCoord(0, 0, 0, 180),
backgroundColour = globals.defaultColours.secondary, backgroundColour = globals.defaultColours.secondary,
}) })
local toolsContainer = teverse.construct("guiFrame", { local toolsContainer = teverse.construct("guiFrame", {
parent = teverse.interface, parent = teverse.interface,
size = guiCoord(0.04, 0, 0.18, 0), size = guiCoord(0, 40, 0, 130),
position = guiCoord(0, 0, 0.065, 0), position = guiCoord(0, 0, 0, 50),
backgroundColour = globals.defaultColours.white, backgroundColour = globals.defaultColours.white,
}) })
local selectTool = teverse.construct("guiIcon", { local selectTool = teverse.construct("guiIcon", {
parent = toolsContainer, parent = toolsContainer,
size = guiCoord(0, 20, 0, 20), size = guiCoord(0, 20, 0, 20),
position = guiCoord(0.25, 0, 0.1, 0), position = guiCoord(0.25, 0, 0, 10),
iconId = "location-arrow", iconId = "location-arrow",
iconType = "faSolid", iconType = "faSolid",
iconColour = globals.defaultColours.primary, iconColour = globals.defaultColours.primary,
@ -56,7 +56,7 @@ return {
local moveTool = teverse.construct("guiIcon", { local moveTool = teverse.construct("guiIcon", {
parent = toolsContainer, parent = toolsContainer,
size = guiCoord(0, 20, 0, 20), size = guiCoord(0, 20, 0, 20),
position = guiCoord(0.25, 0, 0.32, 0), position = guiCoord(0.25, 0, 0, 40),
iconId = "arrows-alt-h", iconId = "arrows-alt-h",
iconType = "faSolid", iconType = "faSolid",
iconColour = globals.defaultColours.primary, iconColour = globals.defaultColours.primary,
@ -66,7 +66,7 @@ return {
local rotateTool = teverse.construct("guiIcon", { local rotateTool = teverse.construct("guiIcon", {
parent = toolsContainer, parent = toolsContainer,
size = guiCoord(0, 20, 0, 20), size = guiCoord(0, 20, 0, 20),
position = guiCoord(0.25, 0, 0.54, 0), position = guiCoord(0.25, 0, 0, 70),
iconId = "sync", iconId = "sync",
iconType = "faSolid", iconType = "faSolid",
iconColour = globals.defaultColours.primary, iconColour = globals.defaultColours.primary,
@ -76,8 +76,8 @@ return {
local sizeTool = teverse.construct("guiIcon", { local sizeTool = teverse.construct("guiIcon", {
parent = toolsContainer, parent = toolsContainer,
size = guiCoord(0, 20, 0, 20), size = guiCoord(0, 20, 0, 20),
position = guiCoord(0.25, 0, 0.76, 0), position = guiCoord(0.25, 0, 0, 100),
iconId = "fa:s-expand", iconId = "expand",
iconType = "faSolid", iconType = "faSolid",
iconColour = globals.defaultColours.primary, iconColour = globals.defaultColours.primary,
backgroundColour = globals.defaultColours.white, backgroundColour = globals.defaultColours.white,
@ -86,8 +86,8 @@ return {
local moreToolsContainer = teverse.construct("guiFrame", { local moreToolsContainer = teverse.construct("guiFrame", {
parent = teverse.interface, parent = teverse.interface,
name = "moreToolsContainer", name = "moreToolsContainer",
size = guiCoord(0.04, 0, 1, 0), size = guiCoord(0, 40, 1, -190),
position = guiCoord(0, 0, 0.255, 0), position = guiCoord(0, 0, 0, 190),
backgroundColour = globals.defaultColours.white, backgroundColour = globals.defaultColours.white,
}) })
@ -146,7 +146,7 @@ return {
parent = page, parent = page,
name = name, name = name,
size = guiCoord(0, 20, 0, 20), size = guiCoord(0, 20, 0, 20),
position = guiCoord((0.25+xPositionOverride), 0, 0.02+(#page.children*0.04), 0), -- Shorthand positioning w/o a for-loop position = guiCoord((0.25+xPositionOverride), 0, 0, 10 + (#page.children*30)), -- Shorthand positioning w/o a for-loop
iconId = icon, iconId = icon,
iconType = "faSolid", iconType = "faSolid",
iconColour = globals.defaultColours.primary, iconColour = globals.defaultColours.primary,
@ -158,12 +158,12 @@ return {
--button:mouseLeftPressed(callback) -- When button is clicked, perform callback action --button:mouseLeftPressed(callback) -- When button is clicked, perform callback action
-- When mouse hovers over button, display tooltip -- When mouse hovers over button, display tooltip
iconImage:on("mouseFocused", function() iconImage:on("mouseEnter", function()
_tooltip.display() _tooltip.display()
end) end)
-- When mouse leaves from button, hide tooltip -- When mouse leaves from button, hide tooltip
iconImage:on("mouseUnfocused", function() iconImage:on("mouseExit", function()
_tooltip.hide() _tooltip.hide()
end) end)
end end

View File

@ -28,7 +28,7 @@ return {
local container = teverse.construct("guiFrame", { local container = teverse.construct("guiFrame", {
parent = teverse.interface, parent = teverse.interface,
size = guiCoord(1, 0, 0.05, 0), size = guiCoord(1, 0, 0, 40),
position = guiCoord(0, 0, 0, 0), position = guiCoord(0, 0, 0, 0),
backgroundColour = globals.defaultColours.white, backgroundColour = globals.defaultColours.white,
}) })
@ -50,19 +50,17 @@ return {
position = guiCoord(0.04, 0, 0.05, 0), position = guiCoord(0.04, 0, 0.05, 0),
text = titleValue, text = titleValue,
textColour = globals.defaultColours.primary, textColour = globals.defaultColours.primary,
fontFile = "local:OpenSans-Bold.ttf", textFont = "tevurl:fonts/openSansBold.ttf",
fontSize = 30, textSize = 30
readOnly = true
}) })
teverse.construct("guiTextBox", { teverse.construct("guiTextBox", {
parent = container, parent = container,
size = guiCoord(0.48, 0, 0.1, 0), size = guiCoord(0.48, 0, 0.1, 0),
position = guiCoord(0.86, 0, 0.1, 0), position = guiCoord(0.86, 0, 0.1, 0),
text = globals.user[2], text = globals.user.name,
textColour = globals.defaultColours.primary, textColour = globals.defaultColours.primary,
fontSize = 25, textSize = 25
readOnly = true
}) })
local userIcon = teverse.construct("guiFrame", { local userIcon = teverse.construct("guiFrame", {
@ -70,7 +68,7 @@ return {
size = guiCoord(0, 32, 0, 32), size = guiCoord(0, 32, 0, 32),
position = guiCoord(0.82, 0, 0, 0), position = guiCoord(0.82, 0, 0, 0),
backgroundColour = globals.defaultColours.primary, backgroundColour = globals.defaultColours.primary,
borderRadius = 100 strokeRadius = 100
}) })
local statusIcon = teverse.construct("guiFrame", { local statusIcon = teverse.construct("guiFrame", {
@ -78,10 +76,10 @@ return {
size = guiCoord(0, 16, 0, 16), size = guiCoord(0, 16, 0, 16),
position = guiCoord(0.836, 0, 0.5, 0), position = guiCoord(0.836, 0, 0.5, 0),
backgroundColour = globals.defaultColours.green, backgroundColour = globals.defaultColours.green,
borderWidth = 2, strokeWidth = 2,
borderColour = globals.defaultColours.white, strokeColour = globals.defaultColours.white,
borderAlpha = 1, strokeAlpha = 1,
borderRadius = 32, strokeRadius = 32,
zIndex = 100 zIndex = 100
}) })
@ -114,7 +112,7 @@ return {
iconColour = globals.defaultColours.primary, iconColour = globals.defaultColours.primary,
backgroundColour = globals.defaultColours.white, backgroundColour = globals.defaultColours.white,
}) })
local test = self
self.register = function(name, tooltip, page) self.register = function(name, tooltip, page)
--[[ --[[
@Description @Description
@ -129,21 +127,21 @@ return {
Void, null, nil Void, null, nil
]]-- ]]--
table.insert(self.keys, {name}) table.insert(test.keys, {name})
local button = teverse.construct("guiButton", { local button = teverse.construct("guiTextBox", {
parent = container, parent = container,
size = guiCoord(0.056, 0, 0.9, 0), size = guiCoord(0.056, 0, 0.9, 0),
position = guiCoord(0.2+(#self.keys*0.07), 0, 0.05, 0), position = guiCoord(0.2+(#test.keys*0.07), 0, 0.05, 0),
text = name, text = name,
textColour = globals.defaultColours.primary, textColour = globals.defaultColours.primary,
fontSize = 30, textSize = 22,
textAlign = enums.align.middle, textAlign = enums.align.middle,
zIndex = 100 zIndex = 100
}) })
local _tooltip = toolTip.construct("vertical", button, tooltip) -- Initialize tooltip instance local _tooltip = toolTip.construct("vertical", button, tooltip) -- Initialize tooltip instance
button:mouseLeftPressed(function() button:on("mouseLeftDown", function()
globals.sideBarPageActive.visible = (not globals.sideBarPageActive.visible) -- Unlist active page from view globals.sideBarPageActive.visible = (not globals.sideBarPageActive.visible) -- Unlist active page from view
if globals.sideBarPageActive == page then -- If the same page is clicked twice, unlist and replace with default page if globals.sideBarPageActive == page then -- If the same page is clicked twice, unlist and replace with default page
globals.sideBarPageActive = globals.sideBarPageDefault globals.sideBarPageActive = globals.sideBarPageDefault
@ -155,12 +153,12 @@ return {
end) end)
-- When mouse hovers over button, display tooltip -- When mouse hovers over button, display tooltip
button:on("mouseFocused", function() button:on("mouseEnter", function()
_tooltip.display() _tooltip.display()
end) end)
-- When mouse leaves from button, hide tooltip -- When mouse leaves from button, hide tooltip
button:on("mouseUnfocused", function() button:on("mouseExit", function()
_tooltip.hide() _tooltip.hide()
end) end)
end end

View File

@ -44,7 +44,7 @@ local testPage = sideBar.registerPage("Test") -- Register test page to sidebar i
sideBar.registerIcon(testPage, "consoleIcon", "terminal", " Open console window", nil) sideBar.registerIcon(testPage, "consoleIcon", "terminal", " Open console window", nil)
sideBar.registerIcon(testPage, "playIcon", "play", "Play scene", nil) sideBar.registerIcon(testPage, "playIcon", "play", "Play scene", nil)
sideBar.registerIcon(testPage, "serverIcon", "server", "Configure server", nil) sideBar.registerIcon(testPage, "serverIcon", "server", "Configure server", nil)
sideBar.registerIcon(testPage, "fullScreenIcon", "fullscreen", "Toggle full screen", nil) sideBar.registerIcon(testPage, "fullScreenIcon", "expand-alt", "Toggle full screen", nil)