get rid of example screens

akkartik
Dec 31, 2023, 11:52 PM
RBWTXOQSHETCUVATHJ6OFHDROTFL45EWD2MLSGLSYYNW5HC3SLIAC

Dependencies

  • [2] 6MQCFHXM remember when someone deletes an example
  • [3] IFEJVPQZ more minor tweaks to examples
  • [4] EUIGBOWB a few more abbreviations
  • [5] RVPXOTFM a couple more abbreviations
  • [6] OWSXL3B7 link to the devlog from tutorial screens
  • [7] 6LJZN727 handle chords
  • [8] 36Z442IV back to commit 8123959e52f without code editing
  • [9] 3QNOKBFM beginnings of a test harness
  • [10] KMSL74GA support selections in the source editor
  • [11] BULPIBEG beginnings of a module for the text editor
  • [12] CAG7PP5Y Merge text.love
  • [13] YEANRUAF clean up the examples and fix a bug
  • [14] QMRQL2FO resolve conflicts
  • [15] ZLJYLPOT Merge lines.love
  • [16] PRE6XPRN responsively increase/decrease font height
  • [17] VLTU33KW resolve conflicts
  • [18] 72OBZ3VM bundle support for .wav files
  • [19] R5QXEHUI somebody stop me
  • [20] VVGWHJBZ fix app identity so successive versions share data
  • [21] W4EQ6IW4 simplify state management for menus
  • [22] ORKN6EOB Merge lines.love
  • [23] PUXFYOQ4 rename a function
  • [24] ZM7NOBRM new fork: carousel shell
  • [25] LXTTOB33 extract a couple of files
  • [26] 3PSFWAIL Merge lines.love
  • [27] NVZTMKER partition handlers between screen regions
  • [28] SJXIMERS type out a filename to load/save
  • [29] 4SR3Z4Y3 document the version of LÖVE I've been using
  • [30] SGMA5JLE save the list of tests in repo
  • [31] N2NUGNN4 include a brief reference enabling many useful apps
  • [32] XX7G2FFJ intermingle freehand line drawings with text
  • [33] BLWAYPKV extract a module
  • [34] RJPNFXVQ new fork: a personal dashboard for mobile devices
  • [35] QD4LOFQR Merge text.love
  • [36] CE4LZV4T drop last couple of manual tests
  • [37] 47VXAH2H delete some old code
  • [38] 4QFVRJ5U get rid of pane transition animations
  • [39] W3RRTO4P extract a second helper for buttons
  • [40] ED4Z6ORC cleaner API for file-system access
  • [41] UEG224LH debug animations
  • [42] 73OCE2MC after much struggle, a brute-force undo
  • [43] YV2GBDNW preserve settings across restart
  • [44] D43U7GQ4 alter on-disk representation (manifest files)
  • [45] OGUV4HSA remove some memory leaks from rendered fragments
  • [46] 6DJMOJKE support event handlers
  • [47] 2CEAF7YR resolve conflicts
  • [48] 2DVVKKVA flesh out Readme
  • [49] 5RUFNRJO start of the visual skeleton
  • [50] VHUNJHXB Merge lines.love
  • [51] 2CFLXLIE Merge text.love
  • [52] 4YDBYBA4 clean up memory leak experiments
  • [53] T4FRZSYL delete an ancient, unused file
  • [54] MRI3JAQI better line-wrap onboarding screens
  • [55] OL7ZCZWD Merge text.love
  • [56] 57HKHZ7Z include the tool that's mentioned in representation.md
  • [57] 66X36NZN a little more prose describing manual_tests
  • [58] D2GCFTTT clean up repl functionality
  • [59] LRDM35CE app running again
  • [60] TBTRYEBP Merge lines.love
  • [61] G42WRYFR new handler: mousemoved
  • [62] SW5GN5LP suggest a default layout for freewheeling apps
  • [63] 7JEYXICU resolve conflicts
  • [64] RSZD5A7G forgot to add json.lua
  • [65] KKMFQDR4 editing source code from within the app
  • [66] 5LN2NUSE resolve conflicts
  • [67] FM5LDKGT Merge text.love
  • [68] CZQ3NJ4N Merge text0
  • [69] 765V2EWY clarify wording on a couple of examples
  • [70] VUF2SX7B implement carousel buttons for inserting/switching current pane
  • [71] RK2ASPN7 add lots of buttons to the toolbar
  • [72] VXRYVZ74 Merge text.love
  • [73] KKQKPGCI resolve conflicts
  • [74] ZENSSO3D pass remaining love handlers through
  • [75] PCCSYQPW brief note about the 'save' button
  • [76] QLJY3CKC bugfix: use border color in scrollbars
  • [77] ROYQO45B mount old location of screens if possible
  • [78] X7MRZ5CL some copy changes
  • [79] 6RYGW5H3 bugfix: output border color
  • [80] VXORMHME delete experimental REPL
  • [81] J6O7HP7J new example: draw and update callbacks
  • [82] VEAVIL4X resize handler
  • [83] Q6RXCILQ Merge text.love
  • [84] VSGPLJFA resolve conflicts
  • [85] GWLETNMW Mike's suggested button layout
  • [86] PN6VP3LV escape hatch when print is overridden
  • [87] LGIEVJE6 activate buttons for some time
  • [88] AVTNUQYR basic test-enabled framework
  • [89] FIUQJVL2 first draft of load/save buttons
  • [90] PJ5PQAQE record support for multiple versions
  • [91] OTIBCAUJ love2d scaffold
  • [92] TFUNIT6M resolve conflicts
  • [93] EZHO4TSW new file-system format for freewheeling apps
  • [94] XIFRMKAL some larger examples using shared abbreviations
  • [95] LXR2FNDC resolve conflicts
  • [96] BJ5X5O4A let's prevent the text cursor from ever getting on a drawing
  • [97] VP5KC4XZ Merge lines.love
  • [98] HVXZLNCC send errors from event handlers to output editor
  • [99] FS2ITYYH record a known issue
  • [100] 5MEJ7XNH lay out buttons based on device dimensions
  • [101] MJ6KKFVT give example panes a name
  • [102] TLOAPLBJ add a license
  • [103] NV4WC3K4 new example: interactivity
  • [104] 4GX6NAY4 some very basic animations for switching panes
  • [105] 2Q437U4F starting to experiment with animated pane transitions
  • [106] 2L5MEZV3 experiment: new edit namespace
  • [107] 5OVKHVY6 nice way to make on.* handlers more discoverable
  • [108] GVX7YSQY initial script after splitting up text-zoom
  • [109] GFBOJWNE resolve conflicts
  • [110] TVCPXAAU rename
  • [111] OC4P6P36 greatly simplify slider implementation
  • [112] K2X6G75Z start writing some tests for drawings
  • [113] JOPVPUSA editing source code from within the app
  • [114] ESOJS6ZW extract a function
  • [115] 6VJTQKW7 start supporting LÖVE v12
  • [116] UUAIVZ4U 2 bugfixes in font rendering
  • [117] OOSUBWKX subject people to a tutorial
  • [118] SIASJPGR save the list of open files across restart
  • [119] Z5M23NTK implement second, 'output' editor
  • [120] LWPFEZBI Merge lines.love
  • [121] VAVXKWZV aggregate global state inside a 'pane' object
  • [122] VHQCNMAR several more modules
  • [123] I52S4E5F running `print` now appends to output editor
  • [124] SIJ5I4NZ extract a helper for buttons
  • [125] MZ3DMYPD start sketching out a scrollbar
  • [126] CMZDG7CJ bugfix: tapping in scrollbar area
  • [127] YT7NMQ6Z delete dead code
  • [128] ADXY3K5Z wire up new-style car.* handlers
  • [129] IP4LD33D mouse events for scrollbar
  • [130] JV27LDDK sliders for font size and color settings
  • [131] E75L5QGU ok/cancel buttons in file dialog
  • [132] RU4HIK43 Merge lines.love
  • [133] WR2WMEPE implement 'Run' button

Change contents

  • file deletion: 0078-Example_panes (----------)
    [7.2][7.1671:1713](),[7.1713][7.1:1]()
    -- 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.
    -- Be careful not to rename example panes; that will cause them to pop up again and annoy people who've already deleted them.
    -- If you delete a name, be careful not to reuse it in future.
    Example_panes = {
    {
    name='expr',
    lines={
    '-- Some examples; feel free to delete.',
    '-- First example: you can perform',
    '-- simple calculations.',
    '',
    '2+3',
    }
    },
    {
    name='print',
    lines={
    '-- print() calls show up in the area',
    "-- below. Hit 'run' and then try scrolling",
    '-- through the results.',
    'for i=1,20 do',
    ' print(i)',
    'end',
    },
    },
    {
    name='draw',
    lines={
    '-- You can draw on the screen.',
    "-- After you hit 'run', try hitting 'hide'.",
    'love.graphics.line(100,100, 200,300)',
    },
    },
    {
    name='pattern',
    lines={
    '-- A larger drawing: 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='animation',
    lines={
    '-- For animations, you can define various',
    '-- functions that will get called for you.',
    '-- LÖVE looks for functions called',
    '-- love.draw, love.update, etc.',
    "-- You can't define those directly (they",
    '-- contain Carousel code), but you can',
    '-- define 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='interactive',
    lines={
    '-- For interactivity, LÖVE provides',
    '-- functions like love.keypressed,',
    '-- love.mousepressed, etc.',
    '-- As before, define car.keypressed,',
    '-- car.mousepressed, etc.',
    '-- These 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',
    '-- typing keys.',
    '-- Then try again after hiding the editor.',
    '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='abbreviations',
    lines={
    '-- Some abbreviations to reduce typing.',
    'g = love.graphics',
    'pt, line = g.points, g.line',
    'rect, poly = g.rectangle, g.polygon',
    'circle, arc, ellipse = g.circle, g.arc, g.ellipse',
    'color = g.setColor',
    'min, max = math.min, math.max',
    'abs, rand = math.abs, math.random',
    'pi, cos, sin = math.pi, math.cos, math.sin',
    'touches = love.touch.getTouches',
    'touch = love.touch.getPosition',
    'audio = love.audio.newSource',
    "-- Hit 'run', Now they're available to other",
    '-- panes.',
    },
    },
    {
    name='circ',
    lines={
    '-- A snazzy circle',
    '-- Try hiding the editor and tapping',
    '-- around on screen.',
    'cx, cy, N = 30, 100, 100',
    'function dist2(x1,y1, x2,y2)',
    ' return (x2-x1)^2 + (y2-y1)^2',
    'end',
    '',
    'function car.draw()',
    ' for x=cx-N,cx+N do',
    ' for y=cy-N,cy+N do',
    ' if dist2(cx,cy, x,y) < N*N then',
    ' color(abs(x-cx)/N, abs(y-cy)/N, 0.5)',
    ' pt(x,y)',
    'end end end end',
    '',
    'function car.mousepressed(x,y, b)',
    ' cx,cy = x,y',
    'end',
    },
    },
    {
    name='pacman',
    lines={
    '-- Pacman',
    'function init_balls()',
    ' balls = {}',
    ' for x=50,Safe_width-1,50 do',
    ' for y=30,Safe_height-1,50 do',
    ' table.insert(balls, {x=x, y=y, show = true})',
    'end end end',
    'init_balls()',
    '',
    'function eat_ball()',
    ' for _,b in ipairs(balls) do',
    ' if b.x == x and b.y == y then',
    ' b.show = false',
    'end end end',
    '',
    'x, y = 30, 30',
    'dx = 5',
    'dang = 0 -- change in mouth angle',
    '',
    'function car.draw()',
    ' color(0.8, 0.8, 0)',
    " arc('fill', x,y, 20, dang + 0.5, dang + 2*math.pi - 0.5)",
    ' for _,b in ipairs(balls) do',
    ' if b.show then',
    " circle('fill', b.x, b.y, 10)",
    'end end end',
    '',
    'function car.update(dt)',
    ' x = x+dx',
    ' eat_ball()',
    ' if x > Safe_width then',
    ' y, dx = y+50, -5',
    ' dang = math.pi',
    ' elseif x < 0 then',
    ' y, dx = y+50, 5',
    ' dang = 0',
    ' end',
    ' if y > Safe_height then',
    ' y = 30',
    ' init_balls()',
    ' end',
    'end',
    },
    },
    {
    name='trails',
    lines={
    '-- This one is for a multitouch screen.',
    '-- Try hiding the editor and swiping',
    '-- your finger around.',
    'W,H = g.getDimensions()',
    'T = 0.1 -- seconds',
    'U = 0',
    '',
    'trails = {}',
    '',
    'function car.draw()',
    ' for _,trail in pairs(trails) do',
    ' color(trail.r, trail.g,trail.b)',
    ' for _,c in ipairs(trail) do',
    " circle('fill', c.x,c.y, c.r)",
    'end end end',
    '',
    'function car.update(dt)',
    ' U = U + dt',
    ' if U < T then return end',
    ' U = U - T',
    ' local touches = love.touch.getTouches()',
    ' for _,id in ipairs(touches) do',
    ' local x,y = love.touch.getPosition(id)',
    ' if trails[id] then',
    ' table.insert(trails[id], 1, {x=x, y=y, r=100})',
    'end end',
    ' for id,trail in pairs(trails) do',
    ' for i=#trail,1,-1 do',
    ' local c = trail[i]',
    ' c.r = c.r - 10',
    ' if c.r <= 0 then table.remove(trail, i) end',
    ' end',
    ' if #trail == 0 then trails[id] = nil end',
    ' end',
    'end',
    '',
    'function car.touchpressed(id, x,y, ...)',
    ' trails[id] = {r=rand(), g=rand(), b=rand()}',
    'end',
    },
    },
    {
    name='beginning',
    lines={
    '-- Over to you. We hope you enjoy Lua Carousel!',
    '-- Looking for more inspiration?',
    '-- Try https://akkartik.itch.io/carousel/devlog',
    '',
    },
    },
    }
    '-- P.S. As you create your programs,',
    "-- don't forget to hit the 'save' button",
    '-- above to preserve them across restarts.',
    'floor, ceil = math.floor, math.ceil',
    '-- The editor will disappear. Hit show',
    "-- to bring it back.",
    '',
    "-- Try hitting the 'run' button above.",
    "-- When you're done, tap on the",
    '-- right margin to go to the next',
    '-- example.',
  • file deletion: 0077-example_pane (----------)
    [7.2][7.1878:1919](),[7.1919][7.1715:1715]()
    example_pane = function(name, lines)
    local result = new_pane()
    result.editor_state.lines = load_array(lines)
    Text.redraw_all(result.editor_state)
    return result
    end
    result.example_name = name
  • edit in 0011-on.initialize at line 11
    [7.2084][7.4008:4030]()
    load_example_panes()