changes to api to support teverse 1.0.0

This commit is contained in:
teverse 2019-07-21 21:57:51 +01:00
parent 53ae1a2ccf
commit 48d61fadab
16 changed files with 84 additions and 75 deletions

View File

@ -14,7 +14,7 @@ local function setupCharacterLocally(client, char)
size = guiCoord(0,100,0,16),
align = enums.align.middle,
text = client.name,
alpha = 0,
textAlpha = 0,
fontSize = 16,
fontFile = "OpenSans-SemiBold.ttf"
})

View File

@ -9,7 +9,7 @@ local container = engine.construct("guiFrame", engine.interface, {
position=guiCoord(0, 30, 1, -655),
backgroundColour=colour(0.1,0.1,0.1),
handleEvents=false,
alpha = 0.1,
backgroundAlpha = 0.1,
zIndex=1001
})
@ -17,7 +17,8 @@ local container = engine.construct("guiFrame", engine.interface, {
local messagesTextBox = engine.construct("guiTextBox",container, {
size=guiCoord(1, -8, 1, -4),
position=guiCoord(0,4,0,2),
guiStyle = enums.guiStyle.noBackground,
--backgroundAlpha = 0.5,
backgroundAlpha = 0,
handleEvents=false,
align = enums.align.bottomLeft,
fontSize = 21,
@ -32,14 +33,14 @@ local messageInputFrame = engine.construct("guiFrame", engine.interface, {
position=guiCoord(0, 30, 1, -55),
backgroundColour=colour(0.1,0.1,0.1),
handleEvents=false,
alpha = 0.8,
backgroundAlpha = 0.8,
zIndex=1001
})
local messageInputBox = engine.construct("guiTextBox",messageInputFrame, {
size=guiCoord(1, -8, 1, -4),
position=guiCoord(0,4,0,2),
guiStyle = enums.guiStyle.noBackground,
backgroundAlpha = 0.5,
align = enums.align.middleLeft,
fontSize = 21,
text="type here, and enter!",

View File

@ -8,7 +8,7 @@ local container = engine.construct("guiFrame", engine.interface, {
position=guiCoord(0, 30, 0, 30),
backgroundColour=colour(0.1,0.1,0.1),
handleEvents=false,
alpha = 0.5,
backgroundAlpha = 0.5,
zIndex=1001
})

View File

@ -100,7 +100,7 @@ consoleController.createConsole = function(workshop)
end)
engine.input:keyPressed(function(inputObj)
if inputObj.key == enums.key.f12 or inputObj.key == enums.key.number0 then
if inputObj.key == enums.key.f12 then
if inputObj.systemHandled then return end
consoleController.consoleObject.visible = not consoleController.consoleObject.visible
elseif cmdBarActive == true then

View File

@ -99,7 +99,7 @@ local function renderHelper(parent, direction, pos)
controller.ui.create("guiImage", frame, {
size = guiCoord(0, 18, 0, 18),
position = guiCoord(0.5,-9,0,18),
alpha = 0.75,
backgroundAlpha = 0.75,
texture = "fa:r-window-maximize"
}, "light")
@ -107,12 +107,12 @@ local function renderHelper(parent, direction, pos)
end
controller.renderDockLocationHelpers = function()
local helpers = engine.construct("guiFrame", controller.ui.workshop.interface, { zIndex=100, size = guiCoord(1,0,1,0), alpha = 0, handleEvents=false})
local helpers = engine.construct("guiFrame", controller.ui.workshop.interface, { zIndex=100, size = guiCoord(1,0,1,0), backgroundAlpha = 0, handleEvents=false})
local outline = controller.ui.create("guiFrame", helpers, {
name = "outline",
size = guiCoord(0, 100, 0, 220),
alpha = 0,
backgroundAlpha = 0,
borderRadius = 2,
borderWidth = 1,
borderAlpha = 1,
@ -269,11 +269,11 @@ end
controller.beginWindowDrag = function(window, dontDock)
controller.undockWindow(window)
local offset = window.absolutePosition - engine.input.mousePosition
local startAlpha = window.alpha
local startAlpha = window.backgroundAlpha
local startZ = window.zIndex
window.zIndex = 99
window.alpha = startAlpha*0.5;
window.backgroundAlpha = startAlpha*0.5;
local helpers
if not dontDock then
@ -316,7 +316,7 @@ controller.beginWindowDrag = function(window, dontDock)
end
end
window.alpha = startAlpha
window.backgroundAlpha = startAlpha
window.zIndex = startZ
lastUpdate = os.clock()

View File

@ -73,6 +73,7 @@ controller.registerLight = function(light)
end
local function handleChild(c)
print("child added", c, type(c))
if type(c) == "light" then
controller.registerLight(c)
end

View File

@ -150,7 +150,7 @@ controller.updateHandlers = {
controller.createInput = {
default = function(instance, property, value)
return uiController.create("guiFrame", nil, {
alpha = 0.25,
backgroundAlpha = 0.25,
name = "inputContainer",
size = guiCoord(0.5, 0, 0, 20),
position = guiCoord(0.5,0,0,0),
@ -161,7 +161,7 @@ controller.createInput = {
block = function(instance, property, value)
local container = controller.createInput.default(value, pType, readOnly)
local x = uiController.create("guiTextBox", container, {
alpha = 0.25,
backgroundAlpha = 0.25,
readOnly = true,
fontSize = 18,
name = "input",
@ -183,12 +183,12 @@ controller.createInput = {
size = guiCoord(0, 18, 1, -2),
position = guiCoord(0, 2, 0, 1),
text = "",
alpha = 0.75,
guiStyle = enums.guiStyle.checkBox
backgroundAlpha = 0.75,
}, "light")
x:mouseLeftReleased(function ()
x.selected = not x.selected
x.text = x.selected and "X" or " " -- temporary
controller.parseInputs[type(value)](property, container)
end)
@ -198,7 +198,7 @@ controller.createInput = {
number = function(instance, property, value)
local container = controller.createInput.default(value, pType, readOnly)
local x = uiController.create("guiTextBox", container, {
alpha = 0.25,
backgroundAlpha = 0.25,
readOnly = false,
multiline = false,
fontSize = 18,
@ -225,7 +225,7 @@ controller.createInput = {
text = "Light Options",
fontSize = 16,
align = enums.align.middle,
alpha = 0.75
backgroundAlpha = 0.75
}, "primary")
local optionsModal = uiController.create("guiFrame", container, {
@ -275,6 +275,7 @@ controller.createInput = {
position = guiCoord(0.75, -12, 0, -15),
handleEvents=false,
zIndex = 10,
backgroundAlpha = 0,
texture = "fa:s-caret-up",
imageColour = optionsModal.backgroundColour
})
@ -328,7 +329,7 @@ controller.createInput = {
local container = controller.createInput.default(value, pType, readOnly)
local x = uiController.create("guiTextBox", container, {
alpha = 0.25,
backgroundAlpha = 0.25,
readOnly = false,
multiline = false,
fontSize = 18,
@ -360,7 +361,7 @@ controller.createInput = {
text = "Mesh Presets",
fontSize = 16,
align = enums.align.middle,
alpha = 0.75
backgroundAlpha = 0.75
}, "primary")
local meshModal = uiController.create("guiFrame", container, {
@ -377,30 +378,34 @@ controller.createInput = {
local function queueCloseModal()
if not pendingHide and meshModal.visible then
pendingHide = true
wait(.4)
if not isFocused then
--still unfocused, lets hide.
meshModal.visible = false
end
pendingHide=false
spawnThread(function ()
-- Code here...
wait(.4)
if not isFocused then
--still unfocused, lets hide.
meshModal.visible = false
end
pendingHide=false
end)
end
end
presetSelect:mouseFocused(function ()
presetSelect:onSync("mouseFocused", function ()
meshModal.visible = true
isFocused = true
end)
meshModal:mouseFocused(function ()
meshModal:onSync("mouseFocused", function ()
isFocused = true
end)
presetSelect:mouseUnfocused(function ()
presetSelect:onSync("mouseUnfocused", function ()
isFocused = false
queueCloseModal()
end)
meshModal:mouseUnfocused(function ()
meshModal:onSync("mouseUnfocused", function ()
isFocused = false
queueCloseModal()
end)
@ -410,6 +415,7 @@ controller.createInput = {
position = guiCoord(0.75, -12, 0, -15),
handleEvents=false,
zIndex = 10,
backgroundAlpha = 0,
texture = "fa:s-caret-up",
imageColour = meshModal.backgroundColour
})
@ -427,10 +433,10 @@ controller.createInput = {
align = enums.align.middle
}, "primary")
btn:mouseFocused(function ()
btn:onSync("mouseFocused", function ()
isFocused = true
end)
btn:mouseUnfocused(function ()
btn:onSync("mouseUnfocused", function ()
isFocused = false
queueCloseModal()
end)
@ -474,7 +480,7 @@ controller.createInput = {
}, "mainText")
local x = uiController.create("guiTextBox", container, {
alpha = 0.25,
backgroundAlpha = 0.25,
readOnly = false,
multiline = false,
fontSize = 18,
@ -536,7 +542,7 @@ controller.createInput = {
}, "mainText")
local x = uiController.create("guiTextBox", container, {
alpha = 0.25,
backgroundAlpha = 0.25,
readOnly = false,
multiline = false,
fontSize = 18,
@ -586,7 +592,7 @@ controller.createInput = {
}, "mainText")
local x = uiController.create("guiTextBox", container, {
alpha = 0.25,
backgroundAlpha = 0.25,
readOnly = false,
multiline = false,
fontSize = 18,
@ -650,7 +656,7 @@ controller.createInput = {
guiCoord = function(instance, property, value)
local container = controller.createInput.default(value, pType, readOnly)
local x = uiController.create("guiTextBox", container, {
alpha = 0.25,
backgroundAlpha = 0.25,
readOnly = false,
multiline = false,
fontSize = 18,
@ -705,7 +711,7 @@ controller.createInput = {
}, "mainText")
local x = uiController.create("guiTextBox", container, {
alpha = 0.25,
backgroundAlpha = 0.25,
readOnly = false,
multiline = false,
fontSize = 18,
@ -792,7 +798,7 @@ function controller.generateProperties(instance)
end
controller.eventHandlers = {}
if instance and instance.events then
if instance then
instanceEditing = instance
controller.instanceEditing = instance
@ -823,7 +829,7 @@ function controller.generateProperties(instance)
container = engine.construct("guiFrame", controller.scrollView,
{
name = "_" .. v.property,
alpha = 0,
backgroundAlpha = 0,
size = guiCoord(1, -10, 0, 20),
cropChildren = false
})

View File

@ -19,7 +19,7 @@ themeController.darkTheme = {
textColour = colour:fromRGB(255, 255, 255),
},
mainText = {
alpha = 0, -- background
backgroundAlpha = 0, -- background
textColour = colour:fromRGB(255, 255, 255),
},
mainTopBar = {
@ -36,7 +36,7 @@ themeController.darkTheme = {
textColour = colour:fromRGB(255,255,255)
},
primaryText = {
alpha = 0, -- background
backgroundAlpha = 0, -- background
textColour = colour:fromRGB(255,255,255)
},
light = {
@ -63,7 +63,7 @@ themeController.lightTheme = {
textColour = colour:fromRGB(0,0,0),
},
mainText = {
alpha = 0,
backgroundAlpha = 0,
textColour = colour:fromRGB(0,0,0),
},
mainTopBar = {

View File

@ -151,7 +151,8 @@ function toolsController:register(tool)
size = TOOL_BUTTON_SIZE,
position = TOOL_BUTTON_DEFAULT_POSITION + guiCoord(0, 0, 0, TOOL_BUTTON_OFFSET * #self.tools),
imageColour = themeController.currentTheme.tools.deselected,
texture = tool.icon
texture = tool.icon,
backgroundAlpha = 0,
},
"main"
)

View File

@ -60,13 +60,13 @@ function controller.createUI(workshop)
local gridAxisInput = uiController.create("guiButton", controller.window.content, {
size = guiCoord(0,18,0,18),
position = guiCoord(0,x,0,28),
text = "",
selected = v[2],
guiStyle = enums.guiStyle.checkBox
text = v[2] and "X" or " ",
selected = v[2]
}, "main")
gridAxisInput:mouseLeftReleased(function ()
controller.axis[i][2] = not controller.axis[i][2]
gridAxisInput.selected = controller.axis[i][2]
gridAxisInput.text = gridAxisInput.selected and "X" or " "
end)
x=x+22
end

View File

@ -97,7 +97,7 @@ uiController.createMainInterface = function(workshop)
size = guiCoord(1, -20, 0.5, -10),
align = enums.align.topMiddle,
fontSize = 21,
alpha = 0,
backgroundAlpha = 0,
text = "Please wait whilst Create Mode loads the latest assets."
}, "main")
@ -185,7 +185,7 @@ uiController.createMainInterface = function(workshop)
local openBtn = toolsController.createButton("topBar", "fa:s-folder-open", "Open")
local publishBtn = toolsController.createButton("topBar", "fa:s-cloud-upload-alt", "Publish")
publishBtn.image.alpha = 0.45
publishBtn.image.backgroundAlpha = 0.45
publishBtn.text.textAlpha = 0.45
--[[
@ -231,10 +231,10 @@ uiController.createMainInterface = function(workshop)
workshop:changed(function (p)
if workshop.gameFilePath ~= "" then
publishBtn.image.alpha = 1
publishBtn.image.backgroundAlpha = 1
publishBtn.text.textAlpha = 1
else
publishBtn.image.alpha = 0.45
publishBtn.image.backgroundAlpha = 0.45
publishBtn.text.textAlpha = 0.45
end
end)

View File

@ -31,7 +31,7 @@ function controller.createTab(container, name, callback)
}, active and controller.widgets[container].selected or controller.widgets[container].deselected)
controller.widgets[container].tabs[btn] = callback
local newX = math.min(130, btn.textSize.x + 40)
local newX = math.min(130, btn.textDimensions.x + 40)
btn.size = guiCoord(0, newX, 0, 18)
controller.widgets[container].currentX = controller.widgets[container].currentX + newX + 10

View File

@ -73,7 +73,7 @@ colourPicker.create = function()
name = "hueBar",
size = guiCoord(0, 30, 1, -10),
position = guiCoord(0, 160, 0, 5),
alpha = 0
backgroundAlpha = 0
})
local hueBarMARKER = engine.construct("guiFrame", hueBar, {
@ -81,7 +81,7 @@ colourPicker.create = function()
size = guiCoord(1, 0, 0, 1),
position = guiCoord(0, 0, 0, 0),
handleEvents=false,
alpha = 0,
backgroundAlpha = 0,
borderColour = colour(0,0,0),
zIndex = 10,
borderWidth = 2,
@ -112,7 +112,7 @@ colourPicker.create = function()
}, "mainText")
local rInput = uiController.create("guiTextBox", window.content, {
alpha = 0.25,
backgroundAlpha = 0.25,
readOnly = false,
multiline = false,
fontSize = 18,

View File

@ -1,9 +1,9 @@
-- Copyright (c) 2019 teverse.com
-- main.lua
return function(workshop)
local controllers = {
console = require("tevgit:create/controllers/console.lua"),
-- 1.0.0 has an internal console
-- = require("tevgit:create/controllers/console.lua"),
selection = require("tevgit:create/controllers/select.lua"),
theme = require("tevgit:create/controllers/theme.lua"),
ui = require("tevgit:create/controllers/ui.lua"),
@ -14,7 +14,7 @@ return function(workshop)
}
controllers.ui.createMainInterface(workshop)
controllers.console.createConsole(workshop)
-- controllers.console.createConsole(workshop)
controllers.property.createUI(workshop)
--loaded here due to dependencies

View File

@ -22,9 +22,9 @@ scriptEditor.mainText = engine.construct("guiTextBox", scriptEditor.mainFrame, {
multiline=true,
readOnly=false,
wrapped = true,
alpha=0.2,
textAlpha=0.2,
text = [[print("Hello Teverse!")]],
guiStyle=enums.guiStyle.noBackground
backgroundAlpha = 0
})
@ -40,7 +40,7 @@ scriptEditor.colouredText = engine.construct("guiTextBox", scriptEditor.mainFram
handleEvents=false,
readOnly=true,
text = "",
guiStyle=enums.guiStyle.noBackground
backgroundAlpha = 0
})
scriptEditor.colours = {
@ -140,7 +140,7 @@ scriptEditor.leftText = engine.construct("guiTextBox", scriptEditor.leftFrame, {
multiline=true,
textColour=scriptEditor.colours.comment,
text = [[0]],
guiStyle=enums.guiStyle.noBackground
backgroundAlpha = 0
})
scriptEditor.lex()

View File

@ -209,7 +209,7 @@ local function addTool(image, activate, deactivate)
toolButton.size = guiCoord(0, 24, 0, 24)
toolButton.position = guiCoord(0, 10 + (30 * #tools), 0, 3)
toolButton.parent = toolBarMain
toolButton.guiStyle = enums.guiStyle.noBackground
toolButton.backgroundAlpha = 0
toolButton.imageColour = themeColourToolDeselected
toolButton.texture = image;
toolButton:mouseLeftReleased(function()
@ -273,9 +273,9 @@ end
local function setReadOnly( textbox, value )
textbox.readOnly = value
if value then
textbox.alpha = 0.8
textbox.backgroundAlpha = 0.8
else
textbox.alpha = 1
textbox.backgroundAlpha = 1
end
end
@ -305,7 +305,7 @@ end
local txtProperty = generateLabel("0 items selected", windowProperties)
txtProperty.name = "txtProperty"
txtProperty.textColour = themeColourWindowText
txtProperty.alpha = 0.9
txtProperty.backgroundAlpha = 0.9
local event = nil -- stores the instance changed event so we can disconnect it
local showing = nil
@ -426,7 +426,7 @@ local function generateProperties( instance )
lblProp.name = "lbl"..prop.property
if readOnly then
lblProp.alpha = 0.5
lblProp.backgroundAlpha = 0.5
end
local propContainer = engine.guiFrame()
@ -434,7 +434,7 @@ local function generateProperties( instance )
propContainer.name = prop.property
propContainer.size = guiCoord(0.54, -9, 0, 21) -- Compensates for the natural padding inside a guiWindow.
propContainer.position = guiCoord(0.45,0,0,y)
propContainer.alpha = 0
propContainer.backgroundAlpha = 0
if propertyType == "vector2" then
@ -663,7 +663,7 @@ local function generateProperties( instance )
placeholder.position = guiCoord(0,0,0,0)
placeholder.size = guiCoord(1, 0, 1, 0)
placeholder.align = enums.align.middle
placeholder.alpha = 0.6
placeholder.backgroundAlpha = 0.6
elseif propertyType == "number" then
local txtProp = generateInputBox(value, propContainer)
@ -1064,9 +1064,9 @@ engine.debug:output(function(msg, type)
-- This function is deprecated.
lbl:setText(text)
local textSize = lbl.textSize
lbl.size = guiCoord(1, -10, 1, textSize.y)
scrollViewOutput.canvasSize = guiCoord(1, 0, 1, textSize.y)
local textDimensions = lbl.textDimensions
lbl.size = guiCoord(1, -10, 1, textDimensions.y)
scrollViewOutput.canvasSize = guiCoord(1, 0, 1, textDimensions.y)
end)
@ -1100,13 +1100,13 @@ local scrollBarHierarchy = engine.guiFrame("scrollBarFrame")
scrollBarHierarchy.size = guiCoord(1,-5,1,-1)
scrollBarHierarchy.parent = windowHierarchy
scrollBarHierarchy.position = guiCoord(1,-20,0,0)
scrollBarHierarchy.alpha = 0.05
scrollBarHierarchy.backgroundAlpha = 0.05
local scrollBarPositionFrame = engine.guiFrame("scrollBarPositionFrame")
scrollBarPositionFrame.size = guiCoord(1, 0, 0.1, 0)
scrollBarPositionFrame.parent = scrollBarHierarchy
scrollBarPositionFrame.position = guiCoord(0, 0, 0, 0)
scrollBarPositionFrame.alpha = 0.1
scrollBarPositionFrame.backgroundAlpha = 0.1
local scrollBarMarkersFolder = engine.folder("scrollBarMarkers")
scrollBarMarkersFolder.parent = scrollBarHierarchy
@ -1115,7 +1115,7 @@ local scrollViewHierarchy = engine.guiFrame("scrollView")
scrollViewHierarchy.size = guiCoord(1,-25,1,-1)
scrollViewHierarchy.parent = windowHierarchy
scrollViewHierarchy.position = guiCoord(0,0,0,0)
scrollViewHierarchy.alpha = 0
scrollViewHierarchy.backgroundAlpha = 0
local buttonLog = {}
local classNameIcons = {