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
|
||||
-- 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),
|
||||
|
@ -19,14 +21,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) do
|
||||
while sleep() and teverse.input:isKeyDown(key) and not globals.ignoreCameraInput do
|
||||
cam.position = cam.position + (cam.rotation * mapped * moveStep)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
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 yaw = quaternion.euler(0, movement.x * rotateStep, 0)
|
||||
|
||||
|
|
|
@ -78,6 +78,7 @@ local new = function(properties)
|
|||
Clears the logs
|
||||
]]
|
||||
list = {}
|
||||
teverse.debug:clearOutputHistory()
|
||||
viewScroll:destroyChildren()
|
||||
interface.reload()
|
||||
viewScroll.canvasOffset = vector2()
|
||||
|
|
|
@ -13,14 +13,16 @@ teverse.construct("guiFrame", {
|
|||
if teverse.dev.localTevGit then
|
||||
teverse.construct("guiTextBox", {
|
||||
parent = teverse.coreInterface,
|
||||
size = guiCoord(0,60, 0, 12),
|
||||
position = guiCoord(1, -70, 1, -59),
|
||||
size = guiCoord(0,40, 0, 8),
|
||||
position = guiCoord(0, 2, 1, -10),
|
||||
zIndex = 1000,
|
||||
textSize = 12,
|
||||
textSize = 8,
|
||||
text = "Local TevGit",
|
||||
textAlign = "middleRight",
|
||||
textAlpha = 0.5,
|
||||
backgroundAlpha = 0
|
||||
textAlpha = 0.8,
|
||||
backgroundAlpha = 0.5,
|
||||
textAlign = "middle",
|
||||
strokeRadius = 4
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -38,16 +40,11 @@ teverse.input:on("keyUp", function(key)
|
|||
end
|
||||
end)
|
||||
|
||||
local settingsButton = teverse.construct("guiIcon", {
|
||||
local settingsButton = teverse.construct("guiFrame", {
|
||||
parent = teverse.coreInterface,
|
||||
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,
|
||||
size = guiCoord(0, 66, 0, 66),
|
||||
position = guiCoord(1, -33, 1, -33),
|
||||
strokeRadius = 33,
|
||||
dropShadowAlpha = 0.15,
|
||||
strokeAlpha = 0.05,
|
||||
backgroundAlpha = 1,
|
||||
|
@ -55,44 +52,167 @@ local settingsButton = teverse.construct("guiIcon", {
|
|||
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(0, 100, 0, 35),
|
||||
position = guiCoord(1, -155, 1, -45),
|
||||
backgroundAlpha = 0,
|
||||
size = guiCoord(1, 200, 1, 200),
|
||||
position = guiCoord(0, -100, 0, -100),
|
||||
backgroundAlpha = 0.85,
|
||||
backgroundColour = colour.rgb(0, 0, 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
|
||||
settingsButton:on("mouseLeftUp", function()
|
||||
local function onClick()
|
||||
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
|
||||
repeat sleep(0.1) until teverse.input.mousePosition.y < container.absolutePosition.y - 25
|
||||
container.visible = false
|
||||
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 homeButton = teverse.construct("guiIcon", {
|
||||
parent = container,
|
||||
size = guiCoord(0, 35, 0, 35),
|
||||
position = guiCoord(1, -35, 0, 0),
|
||||
iconId = "home",
|
||||
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 = 2,
|
||||
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)
|
||||
|
||||
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()
|
||||
teverse.apps:loadDashboard()
|
||||
end)
|
|
@ -5,6 +5,7 @@ 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,7 +111,6 @@ return {
|
|||
strokeRadius = 3
|
||||
})
|
||||
|
||||
-- Test command Bar
|
||||
local commandBarIcon = teverse.construct("guiIcon", {
|
||||
parent = container,
|
||||
size = guiCoord(0, 32, 0, 32),
|
||||
|
@ -130,7 +129,6 @@ 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,
|
||||
|
@ -158,19 +156,17 @@ 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