Skip to content

Instantly share code, notes, and snippets.

@dermotbalson
Last active December 22, 2015 15:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dermotbalson/6495824 to your computer and use it in GitHub Desktop.
Save dermotbalson/6495824 to your computer and use it in GitHub Desktop.
StepByStep
--# 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