diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2022-05-20 06:58:17 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2022-05-20 06:58:17 -0700 |
commit | 3ec8019cc0c1b212cc84ad69c0d8024f1b4c9eb5 (patch) | |
tree | 0a20e4a172e716c785da86330fe9237ecf00f16a /text.lua | |
parent | 1573dd842590973252ffa82767e3ac1b5d23bf89 (diff) | |
download | text.love-3ec8019cc0c1b212cc84ad69c0d8024f1b4c9eb5.tar.gz |
new globals: draw partial screen line up top
I'm not setting these yet. Rendering seems to be working after manually setting them.
Diffstat (limited to 'text.lua')
-rw-r--r-- | text.lua | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/text.lua b/text.lua index b6423b8..12f1b5d 100644 --- a/text.lua +++ b/text.lua @@ -19,7 +19,9 @@ function Text.draw(line, line_width, line_index) local frag_width = math.floor(frag_text:getWidth()*Zoom) if x + frag_width > line_width then assert(x > 25) -- no overfull lines - y = y + math.floor(15*Zoom) + if line_index > Screen_top_line or pos >= Top_screen_line_starting_pos then + y = y + math.floor(15*Zoom) + end x = 25 if line.screen_line_starting_pos == nil then line.screen_line_starting_pos = {1, pos} @@ -27,7 +29,9 @@ function Text.draw(line, line_width, line_index) table.insert(line.screen_line_starting_pos, pos) end end - love.graphics.draw(frag_text, x,y, 0, Zoom) + if line_index > Screen_top_line or pos >= Top_screen_line_starting_pos then + love.graphics.draw(frag_text, x,y, 0, Zoom) + end -- render cursor if necessary local frag_len = utf8.len(frag) if line_index == Cursor_line then |