Author Topic: PRINT LEN(string)  (Read 1371 times)

Offline Poetronic

  • Mr. Drawsprite
  • **
  • Posts: 98
    • View Profile
PRINT LEN(string)
« 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?
« Last Edit: 2012-Aug-16 by Poetronic »
ILI-Blocks, my first game ever - please check it out!

Offline matchy

  • Prof. Inline
  • *****
  • Posts: 1545
    • View Profile
Re: PRINT LEN(string)
« Reply #1 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
PRINT string$, screenwidth/2-LEN(string$, TRUE)/2, screenheight/2