give example panes a name
Dependencies
- [2]
X7MRZ5CLsome copy changes - [3]
NV4WC3K4new example: interactivity - [4]
VEAVIL4Xresize handler - [5]
VUF2SX7Bimplement carousel buttons for inserting/switching current pane - [6]
J6O7HP7Jnew example: draw and update callbacks - [7]
5RUFNRJOstart of the visual skeleton - [8]
VAVXKWZVaggregate global state inside a 'pane' object - [9]
OOSUBWKXsubject people to a tutorial - [*]
ZM7NOBRMnew fork: carousel shell
Change contents
- replacement in 0078-Example_panes at line 1
-- some examples-- each element of this array is itself an array of lines that will get loaded into a pane-- some examples that each get loaded into a pane-- each example has a name, so we can avoid bringing back up an example someone deleted. - replacement in 0078-Example_panes at line 5[4.131]→[2.27:161](∅→∅),[2.161]→[4.264:288](∅→∅),[4.264]→[4.264:288](∅→∅),[4.288]→[2.162:283](∅→∅),[2.283]→[4.407:415](∅→∅),[4.407]→[4.407:415](∅→∅)
"-- Some examples; feel free to delete them and they'll never return.",'-- First example: you can perform simple calculations.','-- (scroll down..)',"-- Try hitting the 'run' button above.","-- When you're done, tap on the right margin to go to the next example.",'2+3'name='expr',lines={"-- Some examples; feel free to delete them and they'll never return.",'-- First example: you can perform simple calculations.',"-- (scroll down if you're on a small screen..)","-- Try hitting the 'run' button above.","-- When you're done, tap on the right margin to go to the next example.",'2+3',} - replacement in 0078-Example_panes at line 16
'-- print() calls show up in the area below.',"-- Hit 'run' and then scroll through the results.",'for i=1,20 do print(i) end',name='print',lines={'-- print() calls show up in the area below.',"-- Hit 'run' and then scroll through the results.",'for i=1,20 do print(i) end',}, - replacement in 0078-Example_panes at line 24
'-- You can draw on the screen.',"-- After you hit 'run', try hitting 'hide'.",'love.graphics.line(100,100, 200,300)'name='draw',lines={'-- You can draw on the screen.',"-- After you hit 'run', try hitting 'hide'.",'love.graphics.line(100,100, 200,300)',}, - replacement in 0078-Example_panes at line 32
'-- some color','love.graphics.setColor(1,0,0)',"love.graphics.rectangle('fill', 100,100, 200,300)",name='color',lines={'-- some color','love.graphics.setColor(1,0,0)',"love.graphics.rectangle('fill', 100,100, 200,300)",}, - replacement in 0078-Example_panes at line 40[4.810]→[2.475:570](∅→∅),[2.570]→[4.904:1197](∅→∅),[4.904]→[4.904:1197](∅→∅),[4.1197]→[4.51:60](∅→∅)
'-- A checkerboard','-- Notice Safe_width and Safe_height for the bounds of the screen.','n = 100','for x=0,Safe_width,n do',' for y=0,Safe_height,n do',' if (x+y)/n%2 == 0 then',' love.graphics.setColor(0.9, 0.7, 0.7)',' else',' love.graphics.setColor(0.7, 0.7, 0.9)',' end'," love.graphics.rectangle('fill', x,y, n,n)",' end','end',name='pattern',lines={'-- A checkerboard','-- Notice Safe_width and Safe_height for the bounds of the screen.','n = 100','for x=0,Safe_width,n do',' for y=0,Safe_height,n do',' if (x+y)/n%2 == 0 then',' love.graphics.setColor(0.9, 0.7, 0.7)',' else',' love.graphics.setColor(0.7, 0.7, 0.9)',' end'," love.graphics.rectangle('fill', x,y, n,n)",' end','end',}, - replacement in 0078-Example_panes at line 58[4.67]→[3.101:188](∅→∅),[3.188]→[4.172:225](∅→∅),[4.172]→[4.172:225](∅→∅),[4.225]→[3.189:376](∅→∅),[3.376]→[4.418:575](∅→∅),[4.418]→[4.418:575](∅→∅),[4.575]→[4.1197:1206](∅→∅),[4.1197]→[4.1197:1206](∅→∅),[4.1206]→[4.576:743](∅→∅),[4.743]→[3.377:386](∅→∅)
'-- For animations, you can define various functions that will get called for you.','-- LÖVE supports functions of the form love.*,','-- for example, love.draw, love.update, etc.',"-- You can't define those directly because Carousel Shell needs to define them for its UI, but you can define your own under car.*,",'-- for example, car.draw, car.update, etc.','Radius, dRadius = 100, 10','function car.draw()'," love.graphics.circle('fill', 100,100, Radius)",'end','','function car.update(dt)',' Radius = Radius+dRadius',' if Radius > 500 then dRadius = -dRadius end',' if Radius < 30 then dRadius = -dRadius end','end',name='animation',lines={'-- For animations, you can define various functions that will get called for you.','-- LÖVE supports functions of the form love.*,','-- for example, love.draw, love.update, etc.',"-- You can't define those directly because Carousel Shell needs to define them for its UI, but you can define your own under car.*,",'-- for example, car.draw, car.update, etc.','Radius, dRadius = 100, 10','function car.draw()'," love.graphics.circle('fill', 100,100, Radius)",'end','','function car.update(dt)',' Radius = Radius+dRadius',' if Radius > 500 then dRadius = -dRadius end',' if Radius < 30 then dRadius = -dRadius end','end',}, - replacement in 0078-Example_panes at line 78[3.393]→[3.393:1173](∅→∅),[3.1173]→[4.743:752](∅→∅),[4.743]→[4.743:752](∅→∅),[4.752]→[3.1174:1387](∅→∅)
'-- For interactivity, LÖVE provides functions like love.keypressed, love.mousepressed, etc.','-- As before, define the corresponding car.keypressed, car.mousepressed, etc.',"-- A pane's interactive events only activate when the editor is hidden using the 'hide' button above.","-- Try running this example and then pressing and holding the mouse and pressing and releasing keys.",'-- Then try hiding the editor and again pressing and holding the mouse and pressing and releasing keys','X, Y, dX = 100, 0, 10',"Log = ''",'','function car.draw()',' love.graphics.line(X,Y, X,Y+300)',' love.graphics.print(Log, 50,50)','end','','function car.update(dt)',' if X > 500 then dX = -dX end',' if X < 100 then dX = -dX end',' X = X+dX','end','','function car.mousepressed(x,y, button)',' Y = y','end','','function car.mousereleased(x,y, button)',' Y = 0','end','','function car.keypressed(key)',' Log = Log..key','end',name='interactive',lines={'-- For interactivity, LÖVE provides functions like love.keypressed, love.mousepressed, etc.','-- As before, define the corresponding car.keypressed, car.mousepressed, etc.',"-- A pane's interactive events only activate when the editor is hidden using the 'hide' button above.","-- Try running this example and then pressing and holding the mouse and pressing and releasing keys.",'-- Then try hiding the editor and again pressing and holding the mouse and pressing and releasing keys','X, Y, dX = 100, 0, 10',"Log = ''",'','function car.draw()',' love.graphics.line(X,Y, X,Y+300)',' love.graphics.print(Log, 50,50)','end','','function car.update(dt)',' if X > 500 then dX = -dX end',' if X < 100 then dX = -dX end',' X = X+dX','end','','function car.mousepressed(x,y, button)',' Y = y','end','','function car.mousereleased(x,y, button)',' Y = 0','end','','function car.keypressed(key)',' Log = Log..key','end',}, - replacement in 0078-Example_panes at line 113[4.1213]→[2.571:616](∅→∅),[2.616]→[4.1257:1466](∅→∅),[4.1257]→[4.1257:1466](∅→∅),[4.1466]→[2.617:659](∅→∅),[2.659]→[4.1507:1601](∅→∅),[4.1507]→[4.1507:1601](∅→∅),[4.1601]→[4.753:845](∅→∅)
'-- Some abbreviations to reduce typing.','g = love.graphics','points, line, rectangle, polygon, circle, arc, ellipse = g.points, g.line, g.rectangle, g.polygon, g.circle, g.arc, g.ellipse','color, bgColor = g.setColor, g.setBackgroundColor',"-- Enough abbreviations, let's draw.",'color(1,0,0) bgColor(0,1,0)','line(100,100, 200,300)',"circle('fill', 200,100, 30)",'-- once you load this pane, the abbreviations here will be available in any other pane',name='abbreviations',lines={'-- Some abbreviations to reduce typing.','g = love.graphics','points, line, rectangle, polygon, circle, arc, ellipse = g.points, g.line, g.rectangle, g.polygon, g.circle, g.arc, g.ellipse','color, bgColor = g.setColor, g.setBackgroundColor',"-- Enough abbreviations, let's draw.",'color(1,0,0) bgColor(0,1,0)','line(100,100, 200,300)',"circle('fill', 200,100, 30)",'-- once you load this pane, the abbreviations here will be available in any other pane',}, - replacement in 0078-Example_panes at line 127
"-- Over to you. We hope you enjoy Carousel Shell!",'',}name='beginning',lines={"-- Over to you. We hope you enjoy Carousel Shell!",'',},}, - replacement in 0077-example_pane at line 1
example_pane = function(lines)example_pane = function(name, lines) - edit in 0077-example_pane at line 3
result.name = name - replacement in 0011-on.initialize at line 9
Panes = map(Example_panes, example_pane)load_example_panes()