Page 1 of 1

Questions on printf and love.thread [solved]

Posted: Thu May 10, 2012 1:12 pm
by Whyte Vuh'uni
Question 1
I have a little info box in which various things print information. The height of the box is variable... the width is not, so I use love.graphics.printf's wrapping feature.

So, question: how can I figure out the total height of the box if I already know what text is going to be shown, but not how it's going to be wrapped? Is there a way to know how many lines printf decided (or will decide) to use when wrapping?

If not, how do people usually approach this problem?

Question 2
While using threads I noticed that I cannot call any love functions at all, besides a few from love.thread. The wiki says that love.graphics should not work, but that implies that other modules (love.timer, love filesystem, etc) should... yet nothing works. Is this just a linux bug, or a new feature of Love 0.8.0?

Re: Questions on printf and love.thread

Posted: Thu May 10, 2012 2:01 pm
by Boolsheet
1. There's Font:getWrap and Font:getHeight. I hope they work as advertised. ;)

2. I added some info to the wiki that a Thread only loads love.thread automatically. You have to load the other modules with require("love.filesystem") and so on.

Re: Questions on printf and love.thread

Posted: Thu May 10, 2012 2:07 pm
by Whyte Vuh'uni
Oh, wow... that's perfect. I was apparently searching in the wrong place (i.e. love.font, which has nothing). Many thanks!

Re: Questions on printf and love.thread [solved]

Posted: Thu May 10, 2012 5:43 pm
by bartbes
I'm pretty sure that used to be documented...