We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
Text in draw (Read 838 times)
Text in draw
Aug 15th, 2009, 6:15am
 
Hello!

I realise there must be some old topic about this but I can't find anything so I'll start a new one.

I want to draw text that is updated every time the program draws. I am writing out data about all the players in the game, this means 7 strings and about 12 * 7 numbers. This drops my framerate to the half. Is there any solution or alternative method to draw text?
h

Re: Text in draw
Reply #1 - Aug 15th, 2009, 6:40am
 
updating text shouldnt drop your framerate. Do you load the Font in the draw too? that could be one reason for low framerates
Re: Text in draw
Reply #2 - Aug 15th, 2009, 6:49am
 
I do not load the font (I at least I don't think so) in the draw() but I have different font sizes so I do this: textFont(font, integer);

I noticed that some of the text didn't slow the game down that much but another one did. That one collects alot of data from different arrays and objects and looks like this:

Code:

text(
stringArray[i] + " - " +
object.float1 + " / " + object.float2 +
" Score:" + 2dIntegerArray[i][a] +
" Points: " + numberArray[i],20,50
);


thanks
h
Re: Text in draw
Reply #3 - Aug 15th, 2009, 9:19am
 
Are you just updating the text, or are you drawing all of this to the screen? Because if you are drawing a ton of text to the screen, that's a ton of images, which will kill your frameRate.
Re: Text in draw
Reply #4 - Aug 15th, 2009, 4:44pm
 
Have you tried the textMode(SCREEN)? I found in the reference that claims this way speeds up texts. The drawback is you can't do textSize(). You might have to make and load a few different font sizes in setup() and switch textFont(). Just trading memory space for speed. I think old FPS games like the wolf 3D probably did the same for their sprites. Maybe turn off smooth() and see if it helps FPS.
Page Index Toggle Pages: 1