Questions on printf and love.thread [solved]

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Whyte Vuh'uni
Prole
Posts: 7
Joined: Sun May 06, 2012 1:52 pm

Questions on printf and love.thread [solved]

Post 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?
Last edited by Whyte Vuh'uni on Thu May 10, 2012 2:08 pm, edited 1 time in total.
User avatar
Boolsheet
Inner party member
Posts: 780
Joined: Wed Dec 29, 2010 4:57 am
Location: Switzerland

Re: Questions on printf and love.thread

Post 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.
Shallow indentations.
User avatar
Whyte Vuh'uni
Prole
Posts: 7
Joined: Sun May 06, 2012 1:52 pm

Re: Questions on printf and love.thread

Post 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!
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

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

Post by bartbes »

I'm pretty sure that used to be documented...
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot], snibo and 6 guests