mirror of https://github.com/teverse/teverse
Compare commits
22 Commits
9cc085edf3
...
cf3929e790
Author | SHA1 | Date |
---|---|---|
Jay | cf3929e790 | |
Sanjay | 8ee1e633e2 | |
Sanjay Bhadra | dc2577fb8b | |
Sanjay Bhadra | 547fa8d97b | |
Sanjay Bhadra | 59e8f168ff | |
Sanjay | a09916531e | |
Sanjay Bhadra | 5a829404fc | |
Sanjay Bhadra | ac8feee10f | |
Sanjay Bhadra | 3e3db80ebb | |
Sanjay Bhadra | 77038455d1 | |
Sanjay Bhadra | 51676c685b | |
Sanjay Bhadra | 243e654a3f | |
Sanjay Bhadra | 0c0322b855 | |
Sanjay Bhadra | da410f9eef | |
Sanjay Bhadra | c4f3c75900 | |
Sanjay Bhadra | e042e4b71b | |
Sanjay Bhadra | 7b49c94906 | |
Sanjay Bhadra | 1cf50c3fc2 | |
Sanjay Bhadra | 02a0068bd5 | |
teverse | 519fa3ee76 | |
Sanjay Bhadra | 4d7d284a02 | |
Sanjay Bhadra | 7ffb2dfe47 |
47
api.json
47
api.json
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
"os": "OSX",
|
||||
"arch": "x64",
|
||||
"version": "0.20.9",
|
||||
"generatedAt": "08/05/2020 20:22:50",
|
||||
"version": "0.20.13",
|
||||
"generatedAt": "10/05/2020 22:07:37",
|
||||
"sandbox": {
|
||||
"coroutine": {
|
||||
"status": "function",
|
||||
|
@ -20,7 +20,7 @@
|
|||
"xpcall": "function",
|
||||
"_DEVICE_PAD_BOTTOM": 0,
|
||||
"ipairs": "function",
|
||||
"_TEV_BUILD": "0209",
|
||||
"_TEV_BUILD": "02013",
|
||||
"colour": "cdata",
|
||||
"print": "function",
|
||||
"_TEV_VERSION_MINOR": 20,
|
||||
|
@ -45,11 +45,11 @@
|
|||
"insert": "function"
|
||||
},
|
||||
"error": "function",
|
||||
"_TEV_VERSION": "0.20.9",
|
||||
"_TEV_VERSION": "0.20.13",
|
||||
"_DEVICE": "Mac",
|
||||
"require": "function",
|
||||
"_VERSION": "Lua 5.1",
|
||||
"_TEV_VERSION_PATCH": 9,
|
||||
"_TEV_VERSION_PATCH": 13,
|
||||
"next": "function",
|
||||
"math": {
|
||||
"ceil": "function",
|
||||
|
@ -407,7 +407,20 @@
|
|||
},
|
||||
"classes": {
|
||||
"input": {
|
||||
"methods": [],
|
||||
"methods": {
|
||||
"isKeyDown": {
|
||||
"parameters": [
|
||||
{
|
||||
"type": "keyCode",
|
||||
"name": "code"
|
||||
}
|
||||
],
|
||||
"returns": [
|
||||
"boolean"
|
||||
],
|
||||
"description": "Returns true if the provided key is down"
|
||||
}
|
||||
},
|
||||
"className": "input",
|
||||
"events": {
|
||||
"mouseRightUp": {
|
||||
|
@ -1791,23 +1804,29 @@
|
|||
"properties": []
|
||||
},
|
||||
"dev": {
|
||||
"methods": [],
|
||||
"methods": {
|
||||
"promptTevGit": {
|
||||
"parameters": [],
|
||||
"returns": [],
|
||||
"description": "Prompts the user to select a directory for tevgit."
|
||||
}
|
||||
},
|
||||
"className": "dev",
|
||||
"events": [],
|
||||
"constructable": false,
|
||||
"properties": {
|
||||
"state": {
|
||||
"hasGetter": true,
|
||||
"type": "string",
|
||||
"description": "Mostly for internal use, represents what the user is currently doing.",
|
||||
"hasSetter": true
|
||||
},
|
||||
"interface": {
|
||||
"hasGetter": true,
|
||||
"type": "interface",
|
||||
"description": "Workshop level interface, renders above the teverse.interfave singleton",
|
||||
"hasSetter": false
|
||||
},
|
||||
"state": {
|
||||
"hasGetter": true,
|
||||
"type": "string",
|
||||
"description": "Mostly for internal use, represents what the user is currently doing.",
|
||||
"hasSetter": true
|
||||
},
|
||||
"localTevGit": {
|
||||
"hasGetter": true,
|
||||
"type": "boolean",
|
||||
|
@ -1883,5 +1902,5 @@
|
|||
"properties": []
|
||||
}
|
||||
},
|
||||
"build": "0209"
|
||||
"build": "02013"
|
||||
}
|
2500
apiDump.json
2500
apiDump.json
File diff suppressed because it is too large
Load Diff
44
create.lua
44
create.lua
|
@ -1,44 +0,0 @@
|
|||
--[[
|
||||
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
282
tevEd/main.lua
|
@ -1,282 +0,0 @@
|
|||
--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
|
|
@ -1,13 +0,0 @@
|
|||
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
|
|
@ -1,12 +0,0 @@
|
|||
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
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
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 isn’t 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 user’s
|
||||
-- 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!"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue