subject people to a tutorial
This commit is contained in:
parent
cfb5f2dd7d
commit
b92820fa9b
|
@ -5,6 +5,7 @@ on.initialize = function()
|
|||
Menu_left, Menu_top, Safe_width, Safe_height = love.window.getSafeArea()
|
||||
Menu_height = 5 + Line_height + 5
|
||||
Menu_bottom = Menu_top + Menu_height
|
||||
Panes = map(Example_panes, example_pane)
|
||||
table.insert(Panes, new_pane())
|
||||
Current_pane_index = 1
|
||||
Current_pane = Panes[Current_pane_index]
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
example_pane = function(lines)
|
||||
local result = new_pane()
|
||||
result.editor_state.lines = load_array(lines)
|
||||
Text.redraw_all(result.editor_state)
|
||||
return result
|
||||
end
|
|
@ -0,0 +1,56 @@
|
|||
-- some examples
|
||||
-- each element of this array is itself an array of lines that will get loaded into a pane
|
||||
Example_panes = {
|
||||
{
|
||||
"-- 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'
|
||||
},
|
||||
{
|
||||
'-- print() calls show up in the area below',
|
||||
"-- hit 'run' and then scroll through the results",
|
||||
'for i=1,20 do print(i) end',
|
||||
},
|
||||
{
|
||||
'-- you can draw on the screen',
|
||||
"-- after you hit 'run', try hitting 'hide'",
|
||||
'love.graphics.line(100,100, 200,300)'
|
||||
},
|
||||
{
|
||||
'-- some color',
|
||||
'love.graphics.setColor(1,0,0)',
|
||||
"love.graphics.rectangle('fill', 100,100, 200,300)",
|
||||
},
|
||||
{
|
||||
'-- 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',
|
||||
},
|
||||
{
|
||||
'-- 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)",
|
||||
},
|
||||
{
|
||||
"-- over to you; hope you enjoy Carousel Shell!",
|
||||
'',
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue