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
|
||||
-- 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 = {
|
||||
[tonumber(enums.keys.KEY_W)] = 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)
|
||||
local mapped = keyMap[tonumber(key)]
|
||||
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)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
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 yaw = quaternion.euler(0, movement.x * rotateStep, 0)
|
||||
|
||||
|
|
|
@ -78,7 +78,6 @@ local new = function(properties)
|
|||
Clears the logs
|
||||
]]
|
||||
list = {}
|
||||
teverse.debug:clearOutputHistory()
|
||||
viewScroll:destroyChildren()
|
||||
interface.reload()
|
||||
viewScroll.canvasOffset = vector2()
|
||||
|
|
|
@ -13,16 +13,14 @@ teverse.construct("guiFrame", {
|
|||
if teverse.dev.localTevGit then
|
||||
teverse.construct("guiTextBox", {
|
||||
parent = teverse.coreInterface,
|
||||
size = guiCoord(0,40, 0, 8),
|
||||
position = guiCoord(0, 2, 1, -10),
|
||||
size = guiCoord(0,60, 0, 12),
|
||||
position = guiCoord(1, -70, 1, -59),
|
||||
zIndex = 1000,
|
||||
textSize = 8,
|
||||
textSize = 12,
|
||||
text = "Local TevGit",
|
||||
textAlign = "middleRight",
|
||||
textAlpha = 0.8,
|
||||
backgroundAlpha = 0.5,
|
||||
textAlign = "middle",
|
||||
strokeRadius = 4
|
||||
textAlpha = 0.5,
|
||||
backgroundAlpha = 0
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -40,11 +38,16 @@ teverse.input:on("keyUp", function(key)
|
|||
end
|
||||
end)
|
||||
|
||||
local settingsButton = teverse.construct("guiFrame", {
|
||||
local settingsButton = teverse.construct("guiIcon", {
|
||||
parent = teverse.coreInterface,
|
||||
size = guiCoord(0, 66, 0, 66),
|
||||
position = guiCoord(1, -33, 1, -33),
|
||||
strokeRadius = 33,
|
||||
size = guiCoord(0, 35, 0, 35),
|
||||
position = guiCoord(1, -45, 1, -45),
|
||||
iconId = "wrench",
|
||||
iconType = "faSolid",
|
||||
iconColour = colour(0, 0, 0),
|
||||
iconMax = 12,
|
||||
iconAlpha = 0.75,
|
||||
strokeRadius = 2,
|
||||
dropShadowAlpha = 0.15,
|
||||
strokeAlpha = 0.05,
|
||||
backgroundAlpha = 1,
|
||||
|
@ -52,167 +55,44 @@ local settingsButton = teverse.construct("guiFrame", {
|
|||
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", {
|
||||
parent = teverse.coreInterface,
|
||||
size = guiCoord(1, 200, 1, 200),
|
||||
position = guiCoord(0, -100, 0, -100),
|
||||
backgroundAlpha = 0.85,
|
||||
backgroundColour = colour.rgb(0, 0, 0),
|
||||
size = guiCoord(0, 100, 0, 35),
|
||||
position = guiCoord(1, -155, 1, -45),
|
||||
backgroundAlpha = 0,
|
||||
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 lastClick = 0
|
||||
local function onClick()
|
||||
settingsButton:on("mouseLeftUp", function()
|
||||
if os.clock() - lastClick < 0.4 then
|
||||
-- double click
|
||||
lastClick = 0
|
||||
console.visible = not console.visible
|
||||
else
|
||||
lastClick = os.clock()
|
||||
settingsButton.visible = false
|
||||
container.visible = true
|
||||
container.backgroundAlpha = 0
|
||||
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
|
||||
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
|
||||
repeat sleep(0.1) until teverse.input.mousePosition.y < container.absolutePosition.y - 25
|
||||
container.visible = false
|
||||
end
|
||||
end)
|
||||
|
||||
local homeButton = teverse.construct("guiIcon", {
|
||||
parent = inner,
|
||||
size = guiCoord(0, 30, 0, 30),
|
||||
position = guiCoord(0, 60, 0, 10),
|
||||
parent = container,
|
||||
size = guiCoord(0, 35, 0, 35),
|
||||
position = guiCoord(1, -35, 0, 0),
|
||||
iconId = "home",
|
||||
iconType = "faSolid",
|
||||
iconColour = colour(0, 0, 0),
|
||||
iconMax = 12,
|
||||
iconAlpha = 0.75,
|
||||
strokeRadius = 15,
|
||||
strokeRadius = 2,
|
||||
dropShadowAlpha = 0.15,
|
||||
strokeAlpha = 0.05,
|
||||
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()
|
||||
teverse.apps:loadDashboard()
|
||||
end)
|
|
@ -5,7 +5,6 @@ return {
|
|||
dev = nil, -- Holds workshop 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
|
||||
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)
|
||||
defaultColours = { -- Default colors used for theming UI components (~\library\ui\components)
|
||||
primary = colour.rgb(52, 58, 64),
|
||||
|
|
|
@ -111,6 +111,7 @@ return {
|
|||
strokeRadius = 3
|
||||
})
|
||||
|
||||
-- Test command Bar
|
||||
local commandBarIcon = teverse.construct("guiIcon", {
|
||||
parent = container,
|
||||
size = guiCoord(0, 32, 0, 32),
|
||||
|
@ -129,6 +130,7 @@ return {
|
|||
parent = container,
|
||||
size = guiCoord(0, 200, 0, 32),
|
||||
position = guiCoord(0, 191, 0, 4),
|
||||
--text = " >",
|
||||
textAlign = "middleLeft",
|
||||
textFont = "tevurl:fonts/firaCodeBold.otf",
|
||||
textSize = 15,
|
||||
|
@ -156,17 +158,19 @@ return {
|
|||
end)
|
||||
|
||||
commandBarField:on("keyDown", function(key)
|
||||
globals.ignoreCameraInput = true -- Restrict the camera from moving if typing in command bar
|
||||
if key == "KEY_RETURN" then
|
||||
print("Command: "..(commandBarField.text))
|
||||
|
||||
-- Invoke Command Trigger
|
||||
commands.parse(commandBarField.text)
|
||||
|
||||
commandBarField.text = " >"
|
||||
globals.ignoreCameraInput = false -- Re-enable the camera when the commandbar is done being used
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
-- End Test Command Bar
|
||||
|
||||
self.registerIcon = function(icon, callback)
|
||||
local icon = teverse.construct("guiIcon", {
|
||||
parent = container,
|
||||
|
|
Loading…
Reference in New Issue