Compare commits

..

No commits in common. "cf3929e790357de35a2a62956ac7104b08e62a9c" and "9cc085edf39830049b99349ab65b3a482182076b" have entirely different histories.

7 changed files with 2886 additions and 33 deletions

View File

@ -1,8 +1,8 @@
{ {
"os": "OSX", "os": "OSX",
"arch": "x64", "arch": "x64",
"version": "0.20.13", "version": "0.20.9",
"generatedAt": "10/05/2020 22:07:37", "generatedAt": "08/05/2020 20:22:50",
"sandbox": { "sandbox": {
"coroutine": { "coroutine": {
"status": "function", "status": "function",
@ -20,7 +20,7 @@
"xpcall": "function", "xpcall": "function",
"_DEVICE_PAD_BOTTOM": 0, "_DEVICE_PAD_BOTTOM": 0,
"ipairs": "function", "ipairs": "function",
"_TEV_BUILD": "02013", "_TEV_BUILD": "0209",
"colour": "cdata", "colour": "cdata",
"print": "function", "print": "function",
"_TEV_VERSION_MINOR": 20, "_TEV_VERSION_MINOR": 20,
@ -45,11 +45,11 @@
"insert": "function" "insert": "function"
}, },
"error": "function", "error": "function",
"_TEV_VERSION": "0.20.13", "_TEV_VERSION": "0.20.9",
"_DEVICE": "Mac", "_DEVICE": "Mac",
"require": "function", "require": "function",
"_VERSION": "Lua 5.1", "_VERSION": "Lua 5.1",
"_TEV_VERSION_PATCH": 13, "_TEV_VERSION_PATCH": 9,
"next": "function", "next": "function",
"math": { "math": {
"ceil": "function", "ceil": "function",
@ -407,20 +407,7 @@
}, },
"classes": { "classes": {
"input": { "input": {
"methods": { "methods": [],
"isKeyDown": {
"parameters": [
{
"type": "keyCode",
"name": "code"
}
],
"returns": [
"boolean"
],
"description": "Returns true if the provided key is down"
}
},
"className": "input", "className": "input",
"events": { "events": {
"mouseRightUp": { "mouseRightUp": {
@ -1804,29 +1791,23 @@
"properties": [] "properties": []
}, },
"dev": { "dev": {
"methods": { "methods": [],
"promptTevGit": {
"parameters": [],
"returns": [],
"description": "Prompts the user to select a directory for tevgit."
}
},
"className": "dev", "className": "dev",
"events": [], "events": [],
"constructable": false, "constructable": false,
"properties": { "properties": {
"interface": {
"hasGetter": true,
"type": "interface",
"description": "Workshop level interface, renders above the teverse.interfave singleton",
"hasSetter": false
},
"state": { "state": {
"hasGetter": true, "hasGetter": true,
"type": "string", "type": "string",
"description": "Mostly for internal use, represents what the user is currently doing.", "description": "Mostly for internal use, represents what the user is currently doing.",
"hasSetter": true "hasSetter": true
}, },
"interface": {
"hasGetter": true,
"type": "interface",
"description": "Workshop level interface, renders above the teverse.interfave singleton",
"hasSetter": false
},
"localTevGit": { "localTevGit": {
"hasGetter": true, "hasGetter": true,
"type": "boolean", "type": "boolean",
@ -1902,5 +1883,5 @@
"properties": [] "properties": []
} }
}, },
"build": "02013" "build": "0209"
} }

2500
apiDump.json Normal file

File diff suppressed because it is too large Load Diff

44
create.lua Normal file
View File

@ -0,0 +1,44 @@
--[[
create.lua
Copyright (c) 2020 teverse.com
This script is ran when the user loads create mode,
it is given workshop level sandboxing permissions.
However, scripts required from this script will not inherit workshop apis.
We overcome this by manually passing a reference to the workshop object to the required "main.lua" script.
------------------------------------------------
-- SETTING UP A LOCAL DEVELOPMENT CREATE MODE --
------------------------------------------------
1) Make sure you're looking at your local version
of this script and not the git version.
On Windows, this script can be found at "%localappdata%/teverse/create.lua"
2) Clone the Teverse Repo from Github anywhere on your PC e.g. your Desktop,
preferably away from the Teverse directory.
>> git clone https://github.com/teverse/teverse.git
3) Uncomment LINE 42 below,
making sure to include the FULL PATH to your newly cloned repo.
(!) You must include a following forward slash (!)
(!) Do not use backslashes (!)
VALID examples:
>> engine.workshop:setTevGit("C:/Users/YOURNAME/Desktop/teverse/")
>> engine.workshop:setTevGit("C:/teverse/")
>> engine.workshop:setTevGit("C:/Users/YOURNAME/Documents/teverse/")
(!) BAD examples:
(!) >> engine.workshop:setTevGit("C:/Users/YOURNAME/Desktop/teverse") -- missing slash on the end
(!) >> engine.workshop:setTevGit("C:\Users\YOURNAME\Desktop\teverse\") -- backslashes
]]
--engine.workshop:setTevGit('C:/Users/YOURNAME/Desktop/teverse/')
require("tevgit:workshop/main.lua")(engine.workshop)

282
tevEd/main.lua Normal file
View File

@ -0,0 +1,282 @@
--local module = {}
local tevEd = require("tevgit:tevEd/tevEd.lua")
tevEd.addTutorial("Introduction", "Getting Started", "tevEd/tutorials/intro.lua")
--[[
tevEd.addTutorial("Introduction", "Introducing Blocks", "tevEd/tutorials/intro.lua")
tevEd.addTutorial("Introduction", "Introducing GUIs", "tevEd/tutorials/intro.lua")
tevEd.addTutorial("3D", "Using Meshes", "tevEd/tutorials/intro.lua")
tevEd.addTutorial("3D", "Physics Forces", "tevEd/tutorials/intro.lua")
tevEd.addTutorial("3D", "Making an Interactive Scene", "tevEd/tutorials/intro.lua")
tevEd.addTutorial("Interfaces", "Fun with Frames", "tevEd/tutorials/intro.lua")
tevEd.addTutorial("Interfaces", "Introducing Images", "tevEd/tutorials/intro.lua")
--]]
local mainContainer = nil
local workshop = nil
local function runTutorial(module)
mainContainer:destroyChildren()
local tutorial = require("tevgit:"..module)
local tutorialContainer = engine.construct("guiFrame", mainContainer, {
size = guiCoord(1, 0, 1, -20),
backgroundAlpha = 0.1,
backgroundColour=colour:black(),
})
local header = engine.construct("guiFrame", mainContainer, {
size = guiCoord(1, 0, 0, 50),
backgroundAlpha = 0.1,
backgroundColour=colour:white(),
})
local title = engine.construct("guiTextBox", header, {
size = guiCoord(1,-20,1,0),
position = guiCoord(0,10,0,0),
backgroundAlpha = 0,
align = enums.align.middleLeft,
fontFile = "local:OpenSans-SemiBold.ttf",
fontSize = 24,
text = tutorial.name
})
engine.construct("guiTextBox", header, {
size = guiCoord(1,-(title.textDimensions.x + 30),1,0),
position = guiCoord(0,(title.textDimensions.x + 20),0,0),
backgroundAlpha = 0,
align = enums.align.middleLeft,
fontFile = "local:OpenSans-Regular.ttf",
fontSize = 18,
textAlpha = 0.5,
text = tutorial.description
})
local body = engine.construct("guiFrame", tutorialContainer, {
size = guiCoord(1, 0, 1, -50),
backgroundAlpha = 0,
position = guiCoord(0,0,0,50)
})
local instructions = engine.construct("guiFrame", body, {
size = guiCoord(1/4, 0, 1, 0),
backgroundColour=colour:fromRGB(37, 37, 44),
})
local code = engine.construct("guiFrame", body, {
size = guiCoord(1/2, 0, 1, 0),
position = guiCoord(1/4, 0, 0, 0),
backgroundColour= colour:fromRGB(40,42,54),
})
local codeTxt = engine.construct("guiTextBox", code, {
size = guiCoord(1, -20, 1, -14),
position = guiCoord(0, 10, 0, 7),
align = enums.align.topLeft,
fontFile = "tevurl:font/FiraCode-Regular.otf",
fontSize = 20,
backgroundAlpha = 0,
multiline = true,
readOnly = true,
wrap = true,
text = ""
})
for _,page in pairs(tutorial.tutorial) do
instructions:destroyChildren()
if type(page) == "string" then
local txt = engine.construct("guiTextBox", instructions, {
size = guiCoord(1,-10,1,-10),
position = guiCoord(0,5,0,5),
backgroundAlpha = 0,
align = enums.align.topLeft,
textWrap = true,
fontFile = "local:OpenSans-Regular.ttf",
fontSize = 20,
text = page,
textColour = colour:white(),
handleEvents = false
})
local yield = true
local btn = engine.construct("guiTextBox", instructions, {
size = guiCoord(0, 120, 0, 24),
position = guiCoord(0,5,0,txt.textDimensions.y + 15),
align = enums.align.middle,
fontFile = "local:OpenSans-Regular.ttf",
fontSize = 20,
text = "Next",
backgroundColour= colour(0.4, 0.4, 0.4),
borderRadius = 4
})
btn:once("mouseLeftReleased", function ()
yield = false
end)
repeat wait() until not yield
btn:destroy()
elseif type(page) == "table" then
local y = 5
for _,v in pairs(page) do
if type(v) == "string" then
local txt = engine.construct("guiTextBox", instructions, {
size = guiCoord(1,-10,1,-10),
position = guiCoord(0,5,0,y),
backgroundAlpha = 0,
align = enums.align.topLeft,
wrap = true,
fontFile = "local:OpenSans-Regular.ttf",
fontSize = 20,
text = v,
textColour = colour:white(),
handleEvents = false
})
y = y + txt.textDimensions.y + 15
local yield = true
local btn = engine.construct("guiTextBox", instructions, {
size = guiCoord(0, 120, 0, 22),
position = guiCoord(0,5,0,y),
align = enums.align.middle,
fontFile = "local:OpenSans-Regular.ttf",
fontSize = 20,
text = "Continue",
backgroundColour= colour(0.4, 0.4, 0.4),
borderRadius = 4
})
btn:once("mouseLeftReleased", function ()
yield = false
end)
repeat wait() until not yield
btn:destroy()
elseif type(v) == "table" then
if v.type == "script" then
codeTxt.text = v.script
local btn = engine.construct("guiTextBox", instructions, {
size = guiCoord(0, 120, 0, 22),
position = guiCoord(0,5,0,y),
align = enums.align.middle,
fontFile = "local:OpenSans-Regular.ttf",
fontSize = 20,
text = v.btnText,
backgroundColour= colour(0.4, 0.4, 0.4),
borderRadius = 4
})
btn:once("mouseLeftReleased", function ()
v.action(workshop, codeTxt.text)
btn:destroy()
end)
elseif v.type == "helpText" then
local txt = engine.construct("guiTextBox", instructions, {
size = guiCoord(1,-10,1,-10),
position = guiCoord(0,5,0,y),
backgroundAlpha = 0,
align = enums.align.topLeft,
wrap = true,
fontFile = "tevurl:font/OpenSans-Italic.ttf",
fontSize = 20,
text = v.text,
textColour = colour:white(),
handleEvents = false
})
y = y + txt.textDimensions.y + 15
end
end
end
end
end
end
local function createMainInterface()
mainContainer:destroyChildren()
local sectionYPos = 0
for section, tutorials in pairs(tevEd.tutorials) do
local sectionContainer = engine.construct("guiFrame", mainContainer, {
position = guiCoord(0, 0, 0, sectionYPos),
backgroundAlpha = 0.1,
borderRadius = 4
})
engine.construct("guiTextBox", sectionContainer, {
size = guiCoord(1,-20,0,24),
position = guiCoord(0,10,0,10),
backgroundAlpha = 0,
align = enums.align.middleLeft,
fontFile = "local:OpenSans-SemiBold.ttf",
fontSize = 24,
text = section
})
local yPos = 44
for i,tutorial in pairs(tutorials) do
local tutorialContainer = engine.construct("guiFrame", sectionContainer, {
size = guiCoord(1, -20, 0, 30),
position = guiCoord(0, 10, 0, yPos),
backgroundColour = colour:black(),
backgroundAlpha = 0.1,
hoverCursor = "fa:s-hand-pointer"
})
tutorialContainer:mouseLeftReleased(function ()
runTutorial(tutorial[2])
end)
tutorialContainer:mouseFocused(function ()
tutorialContainer.backgroundAlpha = 0.2
end)
tutorialContainer:mouseUnfocused(function ()
tutorialContainer.backgroundAlpha = 0.1
end)
engine.construct("guiTextBox", tutorialContainer, {
size = guiCoord(0, 30,0,30),
position = guiCoord(0,0,0,0),
backgroundAlpha = 0.1,
textAlpha = 0.5,
align = enums.align.middle,
fontFile = "local:OpenSans-SemiBold.ttf",
fontSize = 20,
backgroundColour= colour:black(),
text = tostring(i),
handleEvents = false,
})
engine.construct("guiTextBox", tutorialContainer, {
size = guiCoord(1,-45,0,20),
position = guiCoord(0,40,0,5),
backgroundAlpha = 0,
align = enums.align.middleLeft,
fontFile = "local:OpenSans-Regular.ttf",
fontSize = 20,
text = tutorial[1],
handleEvents = false,
})
yPos = yPos + 40
end
sectionContainer.size = guiCoord(0, 240, 0, yPos)
sectionYPos = sectionYPos + yPos + 10
end
end
return function(c, w)
mainContainer = c
workshop = w
createMainInterface()
end

13
tevEd/tevEd.lua Normal file
View File

@ -0,0 +1,13 @@
local tevEd = {}
tevEd.tutorials = {}
tevEd.addTutorial = function( section, name, module )
if not tevEd.tutorials[section] then
tevEd.tutorials[section] = {}
end
table.insert(tevEd.tutorials[section], {name, module})
end
return tevEd

View File

@ -0,0 +1,12 @@
return {
runAndContinue = function (workshop, code)
workshop:loadString(code)
return true -- continue
end,
code = function(code, action)
return { type = "script", script = code, btnText = "Run", action = action }
end,
helpText = function(text)
return { type = "helpText", text = text }
end
}

21
tevEd/tutorials/intro.lua Normal file
View File

@ -0,0 +1,21 @@
local helpers = require("tevgit:tevEd/tutorials/helpers.lua")
return {
name = "Introduction",
description = "This tutorial will introduce the very basics of coding in a 3D sandbox with Lua.",
difficulty = 1,
tutorial = {
"Example Tutorial, This isnt a real tutorial!",
{"This string is shown to the user", "This message is shown on the sampe page when the user hits next."},
{
"Teverse uses Lua, lets test some sample code before getting started...",
helpers.helpText("Press run to test this code."),
-- helpers.runAndContinue is a function that processes the users
-- input when they hit run. Any function can be used however,
-- helpers.runAndContinue is a quick way to simply execute the input w/o validation.
helpers.code("print(\"Hello Teverse!\")", helpers.runAndContinue),
},
"Congratulations, check the output on the right to see your creation!"
}
}