PRINT LEN(string)

Previous topic - Next topic

Poetronic

Hello, brief question - at some points in my game I am positioning text elements at the center of the screen according to the length of the string. Something like PRINT string$, screenwidth/2-LEN(string$, TRUE)/2, screenheight/2. The Problem is: it seems as if the string is printed before the relative position is determined, which sometimes leads to a very brief "flickering" of the text into position. Is this supposed to happen, or am I doing something wrong?
ILI-Blocks, my first game ever - please check it out! http://www.glbasic.com/forum/index.php?topic=8654.0

matchy

Some sample code would help and my test seems fine. I'm guessing maybe use variables to debug, perhaps clear the screen or try another font.
Code (glbasic) Select

GLOBAL string$ = "This is a test", screenwidth, screenheight; GETSCREENSIZE screenwidth, screenheight
WHILE TRUE; CLEARSCREEN
PRINT string$, screenwidth/2-LEN(string$, TRUE)/2, screenheight/2
SHOWSCREEN ;WEND