Don't render empty text
This commit is contained in:
parent
44ffba0aa4
commit
8356ca6a25
@ -104,16 +104,16 @@ proc main =
|
|||||||
renderer.clear()
|
renderer.clear()
|
||||||
|
|
||||||
for i, line in buffer.lines:
|
for i, line in buffer.lines:
|
||||||
|
if isEmptyOrWhitespace(line):
|
||||||
|
continue
|
||||||
let
|
let
|
||||||
textColor = color(0, 0, 0, 0)
|
textColor = color(0, 0, 0, 0)
|
||||||
surface = ttf.renderTextBlended(font, line, textColor)
|
surface = ttf.renderTextBlended(font, line, textColor)
|
||||||
texture = renderer.createTextureFromSurface(surface)
|
texture = renderer.createTextureFromSurface(surface)
|
||||||
|
|
||||||
sdlFailIf surface.isNil: "Could not render text surface"
|
sdlFailIf surface.isNil: "Could not render text surface"
|
||||||
# var r = rect(0, cint(i * 20), surface.w, surface.h)
|
var r = rect(0, cint(i * 20), surface.w, surface.h)
|
||||||
# echo "W ", *surface.w "H ", *surface.h
|
|
||||||
|
|
||||||
var r = rect(0, cint(i * 20), 100, 20)
|
|
||||||
renderer.copy texture, nil, addr r
|
renderer.copy texture, nil, addr r
|
||||||
|
|
||||||
surface.freeSurface
|
surface.freeSurface
|
||||||
|
Loading…
x
Reference in New Issue
Block a user