StepByStep
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--# Notes | |
--Project notes go here | |
--ignore this, used to manage tabs | |
T1,T2,T3,T4={},{},{},{} | |
tabs={T1,T2,T3,T4} | |
--# T1 | |
--Tab 1 | |
function T1.setup() | |
print("T1") | |
end | |
function T1.draw() | |
background(50) | |
fontSize(48) | |
text("T1",400,400) | |
end | |
--# T2 | |
--Tab 2 | |
function T2.setup() | |
print("T2") | |
end | |
function T2.draw() | |
background(50) | |
fontSize(48) | |
text("T2",400,400) | |
end | |
--# T3 | |
--Tab 3 | |
function T3.setup() | |
print("T3") | |
end | |
function T3.draw() | |
background(50) | |
fontSize(48) | |
text("T3",400,400) | |
end | |
--# T4 | |
--Tab 4 | |
function T4.setup() | |
print("T4") | |
end | |
function T4.draw() | |
background(50) | |
fontSize(48) | |
text("T4",400,400) | |
end | |
--# Main | |
--This code manages which Code tab is run | |
--it remembers your last choice, and if you select a different one, it runs that instead | |
function setup() | |
LastCode=readProjectData("Code") or 1 | |
parameter.integer("Choose_a_tab",1,#tabs,LastCode,RunCode) | |
end | |
function RunCode() | |
output.clear() | |
saveProjectData("Code",Choose_a_tab) | |
print("CODE "..Choose_a_tab) | |
if c and c.cleanup then c.cleanup() end | |
c=tabs[Choose_a_tab] | |
c.setup() | |
end | |
function draw() | |
c.draw() | |
end | |
function collide(contact) | |
if c.collide then c.collide(contact) end | |
end | |
function touched(touch) | |
if c.touched then c.touched(touch) end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment