gvx / richtext

A text and image layout library for LÖVE

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ghost image

reenenlaurie opened this issue · comments

I am writing text two times (to drop a shadow), but somehow a very faint ghost drawing is created in the top left of the screen.

Just to be sure, what version of LÖVE are you using?

I am on 0.9.0 but when you asked I had to double check that. it also shows on the android version.

Oh, and could you supply a (minimal) example that shows this problem?

local rich = require 'richtext'

function love.draw()
    key = "hello world!"
    x = love.window.getHeight( )/2
    y = love.window.getWidth( )/2
    local toptext = rich.new{"{white}".. key,textwidth,white={255,255,255}}
    local bottext = rich.new{"{black}".. key,textwidth,black={0,0,0}}
    bottext:draw(x+2,y+2)
    toptext:draw(x,y)
end

Obviously you need richtext.lua...

For me, the issue disappears if you move the creation of the rich text objects to love.load. Since calling rich.new creates a canvas and does some relatively complicated rendering, it is not meant to be done every frame. My computer can barely handle your minimal example, but has no problems if the rich text objects are created only once.

Ideally, a rich text library would be able to handle even dynamic text with grace, but richtext is not that library. I'm closing the issue as "wontfix" (unless the minimal example below does result in the ghost image for you).

local rich = require 'richtext'

function love.load()
    key = "hello world!"
    toptext = rich.new{"{white}".. key,textwidth,white={255,255,255}}
    bottext = rich.new{"{black}".. key,textwidth,black={0,0,0}}
end

function love.draw()
    x = love.window.getHeight( )/2
    y = love.window.getWidth( )/2
    bottext:draw(x+2,y+2)
    toptext:draw(x,y)
end

Ah, thx! I did want to dynamically change the text, but not at a per frame basis, so I could move it to load/focus code.