infrastructure for caching LÖVE text objects

[?]
Aug 24, 2022, 8:27 PM
2Y7YH7UPQWDNYDJN4BYY2MOHA36B2BIRX6DMIAKHJPQC7UP2R6NQC

Dependencies

  • [2] H6QZ7GRR more precise name
  • [3] VHQCNMAR several more modules
  • [4] P4376EXK add state arg to few functions
  • [5] LF7BWEG4 group all editor globals
  • [*] OTIBCAUJ love2d scaffold
  • [*] UHB4GARJ left/right margin -> left/right coordinates
  • [*] 3QQZ7W4E bring couple more globals back to the app level
  • [*] JRLBUB6L more intuitive point delete from polygons
  • [*] 2L5MEZV3 experiment: new edit namespace

Change contents

  • edit in main.lua at line 18
    [8.17313]
    [9.36]
    -- a few text objects we can avoid recomputing unless the font changes
    Text_cache = {}
  • edit in main.lua at line 210
    [10.331]
    -- use this sparingly
    function to_text(s)
    if Text_cache[s] == nil then
    Text_cache[s] = App.newText(love.graphics.getFont(), s)
    end
    return Text_cache[s]
    end
  • edit in help.lua at line 149
    [3.11325][3.11325:11346]()
    _bullet_indent = nil
  • replacement in help.lua at line 150
    [3.11371][3.11371:11540]()
    if _bullet_indent == nil then
    local text = love.graphics.newText(love.graphics.getFont(), '* ')
    _bullet_indent = text:getWidth()
    end
    return _bullet_indent
    [3.11371]
    [3.11540]
    return App.width(to_text('* '))
  • edit in edit.lua at line 470
    [2.442]
    [2.442]
    Text_cache = {}