Don't render empty text

This commit is contained in:
Joseph Ferano 2023-11-05 10:28:39 +07:00
parent 44ffba0aa4
commit 8356ca6a25

View File

@ -104,16 +104,16 @@ proc main =
renderer.clear()
for i, line in buffer.lines:
if isEmptyOrWhitespace(line):
continue
let
textColor = color(0, 0, 0, 0)
surface = ttf.renderTextBlended(font, line, textColor)
texture = renderer.createTextureFromSurface(surface)
sdlFailIf surface.isNil: "Could not render text surface"
# 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), surface.w, surface.h)
var r = rect(0, cint(i * 20), 100, 20)
renderer.copy texture, nil, addr r
surface.freeSurface