mirror of https://github.com/teverse/teverse
Compare commits
No commits in common. "00abd0fa2d77ca7284fc70cae68421bf77037ec4" and "bfc2f95a5ca9dd168a097e9e4618ec74fd272457" have entirely different histories.
00abd0fa2d
...
bfc2f95a5c
|
@ -1,8 +1,6 @@
|
||||||
-- Copyright 2020- Teverse
|
-- Copyright 2020- Teverse
|
||||||
-- This script is required when workshop is loaded & acts as the 3D Camera for the 3D Environment
|
-- This script is required when workshop is loaded & acts as the 3D Camera for the 3D Environment
|
||||||
|
|
||||||
local globals = require("tevgit:workshop/library/globals.lua") -- globals; variables or instances that can be shared between files
|
|
||||||
|
|
||||||
local keyMap = {
|
local keyMap = {
|
||||||
[tonumber(enums.keys.KEY_W)] = vector3(0, 0, 1),
|
[tonumber(enums.keys.KEY_W)] = vector3(0, 0, 1),
|
||||||
[tonumber(enums.keys.KEY_S)] = vector3(0, 0, -1),
|
[tonumber(enums.keys.KEY_S)] = vector3(0, 0, -1),
|
||||||
|
@ -21,14 +19,14 @@ local db = false
|
||||||
teverse.input:on("keyDown", function(key)
|
teverse.input:on("keyDown", function(key)
|
||||||
local mapped = keyMap[tonumber(key)]
|
local mapped = keyMap[tonumber(key)]
|
||||||
if mapped then
|
if mapped then
|
||||||
while sleep() and teverse.input:isKeyDown(key) and not globals.ignoreCameraInput do
|
while sleep() and teverse.input:isKeyDown(key) do
|
||||||
cam.position = cam.position + (cam.rotation * mapped * moveStep)
|
cam.position = cam.position + (cam.rotation * mapped * moveStep)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
teverse.input:on("mouseMoved", function( movement )
|
teverse.input:on("mouseMoved", function( movement )
|
||||||
if teverse.input:isMouseButtonDown(3) and not globals.ignoreCameraInput then
|
if teverse.input:isMouseButtonDown(3) then
|
||||||
local pitch = quaternion.euler(movement.y * rotateStep, 0, 0)
|
local pitch = quaternion.euler(movement.y * rotateStep, 0, 0)
|
||||||
local yaw = quaternion.euler(0, movement.x * rotateStep, 0)
|
local yaw = quaternion.euler(0, movement.x * rotateStep, 0)
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,6 @@ local new = function(properties)
|
||||||
Clears the logs
|
Clears the logs
|
||||||
]]
|
]]
|
||||||
list = {}
|
list = {}
|
||||||
teverse.debug:clearOutputHistory()
|
|
||||||
viewScroll:destroyChildren()
|
viewScroll:destroyChildren()
|
||||||
interface.reload()
|
interface.reload()
|
||||||
viewScroll.canvasOffset = vector2()
|
viewScroll.canvasOffset = vector2()
|
||||||
|
|
|
@ -13,16 +13,14 @@ teverse.construct("guiFrame", {
|
||||||
if teverse.dev.localTevGit then
|
if teverse.dev.localTevGit then
|
||||||
teverse.construct("guiTextBox", {
|
teverse.construct("guiTextBox", {
|
||||||
parent = teverse.coreInterface,
|
parent = teverse.coreInterface,
|
||||||
size = guiCoord(0,40, 0, 8),
|
size = guiCoord(0,60, 0, 12),
|
||||||
position = guiCoord(0, 2, 1, -10),
|
position = guiCoord(1, -70, 1, -59),
|
||||||
zIndex = 1000,
|
zIndex = 1000,
|
||||||
textSize = 8,
|
textSize = 12,
|
||||||
text = "Local TevGit",
|
text = "Local TevGit",
|
||||||
textAlign = "middleRight",
|
textAlign = "middleRight",
|
||||||
textAlpha = 0.8,
|
textAlpha = 0.5,
|
||||||
backgroundAlpha = 0.5,
|
backgroundAlpha = 0
|
||||||
textAlign = "middle",
|
|
||||||
strokeRadius = 4
|
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -40,11 +38,16 @@ teverse.input:on("keyUp", function(key)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local settingsButton = teverse.construct("guiFrame", {
|
local settingsButton = teverse.construct("guiIcon", {
|
||||||
parent = teverse.coreInterface,
|
parent = teverse.coreInterface,
|
||||||
size = guiCoord(0, 66, 0, 66),
|
size = guiCoord(0, 35, 0, 35),
|
||||||
position = guiCoord(1, -33, 1, -33),
|
position = guiCoord(1, -45, 1, -45),
|
||||||
strokeRadius = 33,
|
iconId = "wrench",
|
||||||
|
iconType = "faSolid",
|
||||||
|
iconColour = colour(0, 0, 0),
|
||||||
|
iconMax = 12,
|
||||||
|
iconAlpha = 0.75,
|
||||||
|
strokeRadius = 2,
|
||||||
dropShadowAlpha = 0.15,
|
dropShadowAlpha = 0.15,
|
||||||
strokeAlpha = 0.05,
|
strokeAlpha = 0.05,
|
||||||
backgroundAlpha = 1,
|
backgroundAlpha = 1,
|
||||||
|
@ -52,167 +55,44 @@ local settingsButton = teverse.construct("guiFrame", {
|
||||||
zIndex = 1000
|
zIndex = 1000
|
||||||
})
|
})
|
||||||
|
|
||||||
local keyboardSupport = false
|
|
||||||
if _TEV_VERSION_MINOR >= 27 then
|
|
||||||
keyboardSupport = not teverse.input.hasScreenKeyboard
|
|
||||||
end
|
|
||||||
|
|
||||||
if keyboardSupport then
|
|
||||||
settingsButton.visible = false
|
|
||||||
|
|
||||||
local reminder = teverse.construct("guiTextBox", {
|
|
||||||
parent = teverse.coreInterface,
|
|
||||||
size = guiCoord(0, 145, 0, 14),
|
|
||||||
position = guiCoord(1, -160, 1, -14),
|
|
||||||
zIndex = 1000,
|
|
||||||
textSize = 12,
|
|
||||||
text = "<ESC> : main menu at anytime",
|
|
||||||
textAlpha = 0,
|
|
||||||
textAlign = "middle",
|
|
||||||
textFont = "tevurl:fonts/openSansBold.ttf",
|
|
||||||
textWrap = true,
|
|
||||||
backgroundColour = colour.rgb(45, 45, 45),
|
|
||||||
textColour = colour.rgb(255, 255, 255),
|
|
||||||
backgroundAlpha = 0
|
|
||||||
})
|
|
||||||
|
|
||||||
spawn(function()
|
|
||||||
teverse.tween:begin(reminder, 0.5, {
|
|
||||||
position = guiCoord(1, -145, 1, -14),
|
|
||||||
textAlpha = 1.0,
|
|
||||||
backgroundAlpha = 1.0,
|
|
||||||
strokeAlpha = 0.1,
|
|
||||||
dropShadowAlpha = 0.1
|
|
||||||
}, "inOutQuad")
|
|
||||||
sleep(1.5)
|
|
||||||
teverse.tween:begin(reminder, 0.5, {
|
|
||||||
position = guiCoord(1, 2, 1, -14)
|
|
||||||
}, "inOutQuad")
|
|
||||||
sleep(0.5)
|
|
||||||
reminder:destroy()
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
teverse.construct("guiIcon", {
|
|
||||||
parent = settingsButton,
|
|
||||||
size = guiCoord(0, 30, 0, 30),
|
|
||||||
position = guiCoord(0, 5, 0, 5),
|
|
||||||
iconId = "wrench",
|
|
||||||
iconType = "faSolid",
|
|
||||||
iconColour = colour(0, 0, 0),
|
|
||||||
iconMax = 10,
|
|
||||||
iconAlpha = 0.75,
|
|
||||||
active = false
|
|
||||||
})
|
|
||||||
|
|
||||||
local container = teverse.construct("guiFrame", {
|
local container = teverse.construct("guiFrame", {
|
||||||
parent = teverse.coreInterface,
|
parent = teverse.coreInterface,
|
||||||
size = guiCoord(1, 200, 1, 200),
|
size = guiCoord(0, 100, 0, 35),
|
||||||
position = guiCoord(0, -100, 0, -100),
|
position = guiCoord(1, -155, 1, -45),
|
||||||
backgroundAlpha = 0.85,
|
backgroundAlpha = 0,
|
||||||
backgroundColour = colour.rgb(0, 0, 0),
|
|
||||||
visible = false
|
visible = false
|
||||||
})
|
})
|
||||||
|
|
||||||
local inner = teverse.construct("guiFrame", {
|
|
||||||
parent = container,
|
|
||||||
size = guiCoord(0, 100, 0, 50),
|
|
||||||
position = guiCoord(0.5, -50, 0.5, -25),
|
|
||||||
strokeRadius = 25,
|
|
||||||
strokeAlpha = 0.3,
|
|
||||||
})
|
|
||||||
|
|
||||||
local console = require("tevgit:core/teverseUI/console.lua")
|
local console = require("tevgit:core/teverseUI/console.lua")
|
||||||
local lastClick = 0
|
local lastClick = 0
|
||||||
local function onClick()
|
settingsButton:on("mouseLeftUp", function()
|
||||||
if os.clock() - lastClick < 0.4 then
|
if os.clock() - lastClick < 0.4 then
|
||||||
-- double click
|
-- double click
|
||||||
lastClick = 0
|
lastClick = 0
|
||||||
console.visible = not console.visible
|
console.visible = not console.visible
|
||||||
else
|
else
|
||||||
lastClick = os.clock()
|
lastClick = os.clock()
|
||||||
settingsButton.visible = false
|
|
||||||
container.visible = true
|
container.visible = true
|
||||||
container.backgroundAlpha = 0
|
repeat sleep(0.1) until teverse.input.mousePosition.y < container.absolutePosition.y - 25
|
||||||
container.position = guiCoord(0, -100, 0, -80)
|
|
||||||
teverse.tween:begin(container, 0.25, {
|
|
||||||
position = guiCoord(0, -100, 0, -100),
|
|
||||||
backgroundAlpha = 0.9
|
|
||||||
}, "inOutQuad")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
settingsButton:on("mouseLeftUp", onClick)
|
|
||||||
teverse.input:on("keyUp", function(key)
|
|
||||||
if key == "KEY_ESCAPE" then
|
|
||||||
if container.visible then
|
|
||||||
container.visible = false
|
container.visible = false
|
||||||
if not keyboardSupport then
|
|
||||||
settingsButton.visible = true
|
|
||||||
end
|
|
||||||
else
|
|
||||||
onClick()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
local closeButton = teverse.construct("guiIcon", {
|
|
||||||
parent = inner,
|
|
||||||
size = guiCoord(0, 30, 0, 30),
|
|
||||||
position = guiCoord(0, 10, 0, 10),
|
|
||||||
iconId = "arrow-left",
|
|
||||||
iconType = "faSolid",
|
|
||||||
iconColour = colour(0, 0, 0),
|
|
||||||
iconMax = 12,
|
|
||||||
iconAlpha = 0.75,
|
|
||||||
strokeRadius = 15,
|
|
||||||
dropShadowAlpha = 0.15,
|
|
||||||
strokeAlpha = 0.05,
|
|
||||||
backgroundAlpha = 1
|
|
||||||
})
|
|
||||||
|
|
||||||
closeButton:on("mouseEnter", function()
|
|
||||||
closeButton.backgroundColour = colour.rgb(45, 45, 45)
|
|
||||||
closeButton.iconColour = colour.rgb(255, 255, 255)
|
|
||||||
end)
|
|
||||||
|
|
||||||
closeButton:on("mouseExit", function()
|
|
||||||
closeButton.backgroundColour = colour.rgb(255, 255, 2555)
|
|
||||||
closeButton.iconColour = colour.rgb(0, 0, 0)
|
|
||||||
end)
|
|
||||||
|
|
||||||
closeButton:on("mouseLeftUp", function()
|
|
||||||
container.visible = false
|
|
||||||
if not keyboardSupport then
|
|
||||||
settingsButton.visible = true
|
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local homeButton = teverse.construct("guiIcon", {
|
local homeButton = teverse.construct("guiIcon", {
|
||||||
parent = inner,
|
parent = container,
|
||||||
size = guiCoord(0, 30, 0, 30),
|
size = guiCoord(0, 35, 0, 35),
|
||||||
position = guiCoord(0, 60, 0, 10),
|
position = guiCoord(1, -35, 0, 0),
|
||||||
iconId = "home",
|
iconId = "home",
|
||||||
iconType = "faSolid",
|
iconType = "faSolid",
|
||||||
iconColour = colour(0, 0, 0),
|
iconColour = colour(0, 0, 0),
|
||||||
iconMax = 12,
|
iconMax = 12,
|
||||||
iconAlpha = 0.75,
|
iconAlpha = 0.75,
|
||||||
strokeRadius = 15,
|
strokeRadius = 2,
|
||||||
dropShadowAlpha = 0.15,
|
dropShadowAlpha = 0.15,
|
||||||
strokeAlpha = 0.05,
|
strokeAlpha = 0.05,
|
||||||
backgroundAlpha = 1
|
backgroundAlpha = 1
|
||||||
})
|
})
|
||||||
|
|
||||||
homeButton:on("mouseEnter", function()
|
|
||||||
homeButton.backgroundColour = colour.rgb(45, 45, 45)
|
|
||||||
homeButton.iconColour = colour.rgb(255, 255, 255)
|
|
||||||
end)
|
|
||||||
|
|
||||||
homeButton:on("mouseExit", function()
|
|
||||||
homeButton.backgroundColour = colour.rgb(255, 255, 2555)
|
|
||||||
homeButton.iconColour = colour.rgb(0, 0, 0)
|
|
||||||
end)
|
|
||||||
|
|
||||||
homeButton:on("mouseLeftUp", function()
|
homeButton:on("mouseLeftUp", function()
|
||||||
teverse.apps:loadDashboard()
|
teverse.apps:loadDashboard()
|
||||||
end)
|
end)
|
|
@ -5,7 +5,6 @@ return {
|
||||||
dev = nil, -- Holds workshop instance and is set in main.lua
|
dev = nil, -- Holds workshop instance and is set in main.lua
|
||||||
user = nil, -- Holds user instance and is set in main.lua
|
user = nil, -- Holds user instance and is set in main.lua
|
||||||
developerMode = false, -- Holds the developer_mode boolean and is set in main.lua
|
developerMode = false, -- Holds the developer_mode boolean and is set in main.lua
|
||||||
ignoreCameraInput = false, -- Determines if the camera should be able to move or not (useful when we're trying to type and we don't want the camera to move)
|
|
||||||
commandGroups = {}, -- Holds the command groups that have been registered (~\library\toolchain\commands.lua)
|
commandGroups = {}, -- Holds the command groups that have been registered (~\library\toolchain\commands.lua)
|
||||||
defaultColours = { -- Default colors used for theming UI components (~\library\ui\components)
|
defaultColours = { -- Default colors used for theming UI components (~\library\ui\components)
|
||||||
primary = colour.rgb(52, 58, 64),
|
primary = colour.rgb(52, 58, 64),
|
||||||
|
|
|
@ -111,6 +111,7 @@ return {
|
||||||
strokeRadius = 3
|
strokeRadius = 3
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- Test command Bar
|
||||||
local commandBarIcon = teverse.construct("guiIcon", {
|
local commandBarIcon = teverse.construct("guiIcon", {
|
||||||
parent = container,
|
parent = container,
|
||||||
size = guiCoord(0, 32, 0, 32),
|
size = guiCoord(0, 32, 0, 32),
|
||||||
|
@ -129,6 +130,7 @@ return {
|
||||||
parent = container,
|
parent = container,
|
||||||
size = guiCoord(0, 200, 0, 32),
|
size = guiCoord(0, 200, 0, 32),
|
||||||
position = guiCoord(0, 191, 0, 4),
|
position = guiCoord(0, 191, 0, 4),
|
||||||
|
--text = " >",
|
||||||
textAlign = "middleLeft",
|
textAlign = "middleLeft",
|
||||||
textFont = "tevurl:fonts/firaCodeBold.otf",
|
textFont = "tevurl:fonts/firaCodeBold.otf",
|
||||||
textSize = 15,
|
textSize = 15,
|
||||||
|
@ -156,17 +158,19 @@ return {
|
||||||
end)
|
end)
|
||||||
|
|
||||||
commandBarField:on("keyDown", function(key)
|
commandBarField:on("keyDown", function(key)
|
||||||
globals.ignoreCameraInput = true -- Restrict the camera from moving if typing in command bar
|
|
||||||
if key == "KEY_RETURN" then
|
if key == "KEY_RETURN" then
|
||||||
print("Command: "..(commandBarField.text))
|
print("Command: "..(commandBarField.text))
|
||||||
|
|
||||||
-- Invoke Command Trigger
|
-- Invoke Command Trigger
|
||||||
commands.parse(commandBarField.text)
|
commands.parse(commandBarField.text)
|
||||||
|
|
||||||
commandBarField.text = " >"
|
commandBarField.text = " >"
|
||||||
globals.ignoreCameraInput = false -- Re-enable the camera when the commandbar is done being used
|
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
-- End Test Command Bar
|
||||||
|
|
||||||
self.registerIcon = function(icon, callback)
|
self.registerIcon = function(icon, callback)
|
||||||
local icon = teverse.construct("guiIcon", {
|
local icon = teverse.construct("guiIcon", {
|
||||||
parent = container,
|
parent = container,
|
||||||
|
|
Loading…
Reference in New Issue