I'm trying to make a refreshing counter... Take for example - Let's use the position of the mouse (within the window).
I've tried just clearing and redrawing everything but it always bugs out when there are many elements to draw.
a = 1
While(a = 1)
Program.Delay(10)
GraphicsWindow.Clear()
GraphicsWindow.DrawText(10,10,Mouse.MouseX)
GraphicsWindow.DrawText(10,20,Mouse.MouseY)
EndWhile
Which works... Except that it flashes because it is refreshing too fast... If I was to increase the delay, it would not work correctly, especially when doing something like a stopwatch. The thing is that it also cannot support something with a large amount of commands... Like:
a = 1
While(a = 1)
Program.Delay(10)
GraphicsWindow.Clear()
GraphicsWindow.DrawText(10,10,Mouse.MouseX)
GraphicsWindow.DrawText(10,20,Mouse.MouseY)
GraphicsWindow.DrawText(100,100,"Text")
GraphicsWindow.BrushColor = "#FF0000"
GraphicsWindow.DrawText(100,200,"Text")
GraphicsWindow.BrushColor = "#00FF00"
GraphicsWindow.DrawText(100,300,"Text")
GraphicsWindow.BrushColor = "#0000FF"
GraphicsWindow.DrawText(100,400,"Text")
GraphicsWindow.BrushColor = "#000FF0"
GraphicsWindow.DrawText(200,100,"Text")
GraphicsWindow.BrushColor = "#FF0000"
GraphicsWindow.DrawText(200,200,"Text")
GraphicsWindow.BrushColor = "#0FF000"
GraphicsWindow.DrawText(200,300,"Text")
GraphicsWindow.BrushColor = "Black"
EndWhile
Which just makes a big flashing mess... And scrapping the GraphicsWindow.clear() isn't an option either because it makes a overwritten mess...
a = 1
While(a = 1)
Program.Delay(10)
GraphicsWindow.DrawText(10,10,Mouse.MouseX)
GraphicsWindow.DrawText(10,20,Mouse.MouseY)
EndWhile
Or something like this:
https://i.stack.imgur.com/4sfSS.png
So, my question:
Is there any way to make a counter that can refresh smoothly without flashing that can have lots of extra things drawn in the background; elsewhere in the window? Something like the below, but also moves.
https://i.stack.imgur.com/aZQ5T.png
Sorry for the mess of links: Not enough reputation to post pictures...
You can reduce the flashing effect by rewriting elements that you have just cleared. For example, "delete" the text by drawing a rectangle (which is faster than GraphicsWindow.Clear()) and then DrawText immediately after it.
But this way of refreshing will always produce flashes. Better alternative is to use Fremy's FC extension, which feature a way to add "changable" text element (called a Label) to the GW. Fremy's extension has a load of extra functions to SB and it makes the language usable to create actual programs. It is something like JQuery to JavaScript. I highly recommend to use it, all you have to, is to download a *.dll library. More on this SB Wiki thread.
Syntax:
Example:
This allows you to refresh text without any flashing.
Extra hint: you can use
While "true"
to create infinite loops.