mirror of https://github.com/teverse/teverse
Compare commits
38 Commits
bfc2f95a5c
...
00abd0fa2d
Author | SHA1 | Date |
---|---|---|
Jay | 00abd0fa2d | |
Jay | 2d1edef756 | |
Jay | 2254ea0567 | |
Jay | 101ebdd612 | |
Sanjay | 016135116c | |
Sanjay Bhadra | 4a2bbd66b4 | |
Sanjay | 687898493f | |
Sanjay Bhadra | d3841a3db7 | |
Sanjay Bhadra | 5218fa7804 | |
Sanjay Bhadra | 57fdb64a08 | |
Sanjay Bhadra | ca16ccbd55 | |
Sanjay Bhadra | 279552d399 | |
Sanjay Bhadra | 2961293ec0 | |
Sanjay Bhadra | 4b0a2d0d04 | |
Sanjay Bhadra | 1b62b5147b | |
Sanjay Bhadra | ef40aa99e4 | |
Sanjay Bhadra | 9c7cd0d0e2 | |
Sanjay Bhadra | 241a6189af | |
Sanjay Bhadra | 55c2de261a | |
Sanjay Bhadra | 4d54028ded | |
Sanjay Bhadra | 40082cf91b | |
Sanjay Bhadra | 6e3549231b | |
Sanjay Bhadra | a0a1c718e4 | |
Sanjay Bhadra | 29d3d91245 | |
Sanjay Bhadra | b706eb031a | |
Sanjay Bhadra | dc3ad175a1 | |
Sanjay Bhadra | 65134d6b3c | |
Sanjay Bhadra | c89cb736d9 | |
Sanjay Bhadra | 4c54c818f3 | |
Sanjay Bhadra | 80c8f479bd | |
Sanjay Bhadra | f713a64176 | |
Sanjay Bhadra | f632affc57 | |
Sanjay Bhadra | 681050139d | |
Sanjay Bhadra | 89ff5aba45 | |
Sanjay Bhadra | a82eddab75 | |
Sanjay Bhadra | 68cff74b1f | |
Sanjay Bhadra | 81a3ca294c | |
Sanjay Bhadra | 299c254c9f |
|
@ -1,6 +1,8 @@
|
||||||
-- 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),
|
||||||
|
@ -19,14 +21,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) do
|
while sleep() and teverse.input:isKeyDown(key) and not globals.ignoreCameraInput 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) then
|
if teverse.input:isMouseButtonDown(3) and not globals.ignoreCameraInput 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,6 +78,7 @@ 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,14 +13,16 @@ 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,60, 0, 12),
|
size = guiCoord(0,40, 0, 8),
|
||||||
position = guiCoord(1, -70, 1, -59),
|
position = guiCoord(0, 2, 1, -10),
|
||||||
zIndex = 1000,
|
zIndex = 1000,
|
||||||
textSize = 12,
|
textSize = 8,
|
||||||
text = "Local TevGit",
|
text = "Local TevGit",
|
||||||
textAlign = "middleRight",
|
textAlign = "middleRight",
|
||||||
textAlpha = 0.5,
|
textAlpha = 0.8,
|
||||||
backgroundAlpha = 0
|
backgroundAlpha = 0.5,
|
||||||
|
textAlign = "middle",
|
||||||
|
strokeRadius = 4
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -38,16 +40,11 @@ teverse.input:on("keyUp", function(key)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local settingsButton = teverse.construct("guiIcon", {
|
local settingsButton = teverse.construct("guiFrame", {
|
||||||
parent = teverse.coreInterface,
|
parent = teverse.coreInterface,
|
||||||
size = guiCoord(0, 35, 0, 35),
|
size = guiCoord(0, 66, 0, 66),
|
||||||
position = guiCoord(1, -45, 1, -45),
|
position = guiCoord(1, -33, 1, -33),
|
||||||
iconId = "wrench",
|
strokeRadius = 33,
|
||||||
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,
|
||||||
|
@ -55,44 +52,167 @@ local settingsButton = teverse.construct("guiIcon", {
|
||||||
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(0, 100, 0, 35),
|
size = guiCoord(1, 200, 1, 200),
|
||||||
position = guiCoord(1, -155, 1, -45),
|
position = guiCoord(0, -100, 0, -100),
|
||||||
backgroundAlpha = 0,
|
backgroundAlpha = 0.85,
|
||||||
|
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
|
||||||
settingsButton:on("mouseLeftUp", function()
|
local function onClick()
|
||||||
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
|
||||||
repeat sleep(0.1) until teverse.input.mousePosition.y < container.absolutePosition.y - 25
|
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
|
container.visible = false
|
||||||
|
if not keyboardSupport then
|
||||||
|
settingsButton.visible = true
|
||||||
|
end
|
||||||
|
else
|
||||||
|
onClick()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local homeButton = teverse.construct("guiIcon", {
|
local closeButton = teverse.construct("guiIcon", {
|
||||||
parent = container,
|
parent = inner,
|
||||||
size = guiCoord(0, 35, 0, 35),
|
size = guiCoord(0, 30, 0, 30),
|
||||||
position = guiCoord(1, -35, 0, 0),
|
position = guiCoord(0, 10, 0, 10),
|
||||||
iconId = "home",
|
iconId = "arrow-left",
|
||||||
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 = 2,
|
strokeRadius = 15,
|
||||||
dropShadowAlpha = 0.15,
|
dropShadowAlpha = 0.15,
|
||||||
strokeAlpha = 0.05,
|
strokeAlpha = 0.05,
|
||||||
backgroundAlpha = 1
|
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)
|
||||||
|
|
||||||
|
local homeButton = teverse.construct("guiIcon", {
|
||||||
|
parent = inner,
|
||||||
|
size = guiCoord(0, 30, 0, 30),
|
||||||
|
position = guiCoord(0, 60, 0, 10),
|
||||||
|
iconId = "home",
|
||||||
|
iconType = "faSolid",
|
||||||
|
iconColour = colour(0, 0, 0),
|
||||||
|
iconMax = 12,
|
||||||
|
iconAlpha = 0.75,
|
||||||
|
strokeRadius = 15,
|
||||||
|
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()
|
homeButton:on("mouseLeftUp", function()
|
||||||
teverse.apps:loadDashboard()
|
teverse.apps:loadDashboard()
|
||||||
end)
|
end)
|
|
@ -5,6 +5,7 @@ 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,7 +111,6 @@ 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),
|
||||||
|
@ -130,7 +129,6 @@ 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,
|
||||||
|
@ -158,19 +156,17 @@ 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