GVovkiv wrote: ↑Sun Jul 04, 2021 8:28 pm
maybe missing fonts?
are you tried to change fonts?
I tried using a custom font and the problem persists. Does it only happen to me? lmao
Gunroar:Cannon() wrote: ↑Mon Jul 05, 2021 5:51 am
Do all the apps you make make use that text.ls thingy. I wish I could see more code related to the text causee now I'm curious too
The "text" object is the message box where dialog is displayed. It looks like this:
Code: Select all
text= {
ls={}, buffer={}, bufferi=1, show=true, wait=false,
x=SCR_X+5, y=SCR_Y+SCR_H*0.6, w=SCR_W-10, h=SCR_H*0.4-10,
rowsep=12
}
New strings are added to text.buffer, and then added character by character into text.ls.
But I don't use this in all my games, only in those who has dialog boxes.
With "
This happens in any app I make, not just this one!" I meant the love.graphics.print() bug.
--------------------------------------------------------------------
Hold up, I found how to replicate the bug.
Look at what happens if I try to print multiple strings in the same love.draw call.
CODE:
Code: Select all
lg= love.graphics
function love.load()
font= lg.setNewFont("cour.ttf")
end
function love.draw()
lg.print("Hello World! This is a test.",0,30+12*1)
lg.print("abcdefghijklmnopqrstuvwxyz",0,30+12*2)
lg.print("ABCDEFGHIJKLMNOPQRSTUVWXYZ",0,30+12*3)
lg.print("1234567890.,:;-_+*=/|\\?!#",0,30+12*4)
end
OUTPUT:
- out1.png (6.46 KiB) Viewed 6071 times
It only prints the last character I requested: #. The exact same happens if I put all those strings in a table and iterate over them.
Code: Select all
function love.draw()
for i=1,#toadd do
lg.print(toadd[i],0,30+12*i)
end
end
However, if I use this code to add a new line each time the user taps the screen:
Code: Select all
lg= love.graphics
function love.load()
font= lg.setNewFont("cour.ttf")
toadd= {
"Hello World! This is a test.",
"abcdefghijklmnopqrstuvwxyz",
"ABCDEFGHIJKLMNOPQRSTUVWXYZ",
"1234567890.,:;-_+*=/|\\?!#"
}
str= {}
toaddi= 0
keydown= true
end
function love.update()
if love.mouse.isDown(1) then keydown= true
elseif keydown then
keydown= false
toaddi= toaddi+1
table.insert(str,toadd[toaddi])
if toaddi > 3 then toaddi= 0 end
end
end
function love.draw()
for i=1,#str do
lg.print(str[i],0,30+12*i)
end
end
It works just fine? OUTPUT:
- out2.png (23.27 KiB) Viewed 6071 times
Hell, it also works if I replace the empty table with the full one!
Code: Select all
function love.update()
if love.mouse.isDown(1) then keydown= true
elseif keydown then
keydown= false
str= toadd
end
end
This is so weird. It's like strings that are "compiled" into the program are erased/corrupted, while those generated dynamically are displayed fine? But my app uses generated strings, so that's not it? I have no clue.