Merge lines.love
This commit is contained in:
commit
89081a8a78
1
edit.lua
1
edit.lua
|
@ -325,6 +325,7 @@ function edit.update_font_settings(State, font_height)
|
|||
love.graphics.setFont(love.graphics.newFont(Editor_state.font_height))
|
||||
State.line_height = math.floor(font_height*1.3)
|
||||
State.em = App.newText(love.graphics.getFont(), 'm')
|
||||
Text_cache = {}
|
||||
end
|
||||
|
||||
--== some methods for tests
|
||||
|
|
11
main.lua
11
main.lua
|
@ -17,6 +17,9 @@ Editor_state = {}
|
|||
function App.initialize_globals()
|
||||
-- tests currently mostly clear their own state
|
||||
|
||||
-- a few text objects we can avoid recomputing unless the font changes
|
||||
Text_cache = {}
|
||||
|
||||
-- blinking cursor
|
||||
Cursor_time = 0
|
||||
|
||||
|
@ -200,3 +203,11 @@ function App.keyreleased(key, scancode)
|
|||
Cursor_time = 0 -- ensure cursor is visible immediately after it moves
|
||||
return edit.key_released(Editor_state, key, scancode)
|
||||
end
|
||||
|
||||
-- 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
|
||||
|
|
Loading…
Reference in New Issue
Block a user