|
Author |
Topic: centered dynamic text (Read 314 times) |
|
pollux
|
centered dynamic text
« on: Apr 2nd, 2003, 1:00am » |
|
well, i need to display some changing text (sort of a countdown) always centered on the screen. any ideas?
|
« Last Edit: Apr 2nd, 2003, 1:11am by pollux » |
|
pollux | www.frwrd.net
|
|
|
fry
|
Re: centered dynamic text
« Reply #1 on: Apr 2nd, 2003, 3:16am » |
|
i don't particularly like this part of the api, but this is it for now: Code:BFont font = loadFont("blah.vlw.gz"); setFont(font, 12); String thetext = "center me"; //font.charWidth('1') also works int wide = font.stringWidth(thetext); text(thetext, width/2 - wide/2, height/2); |
| i'd like to add a textMode(CENTERED) or something like that. it shouldn't require this much thought.
|
|
|
|
pollux
|
Re: centered dynamic text
« Reply #2 on: Apr 3rd, 2003, 8:15am » |
|
thanxs fry, saved my life just in time. btw, nice work this P5 (and most of the stuff i've seen on your website).
|
pollux | www.frwrd.net
|
|
|
|