GLBasic forum

Main forum => GLBasic - en => Topic started by: Poetronic on 2012-Aug-16

Title: PRINT LEN(string)
Post by: Poetronic on 2012-Aug-16
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?
Title: Re: PRINT LEN(string)
Post by: matchy on 2012-Aug-16
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