1. Update only when necessary, the human eye operates at 120Hz. A frequency value above 120 is unnecessary. And if this is information in the status bar or in the console, then the data should be updated no more than 3 times per second, for example, when displaying file search data, otherwise the text is smeared into a gray background.
2. Reduce the area of the image being updated. For example, if there is text in the center and a number on the left, then create a background with an image of the text and an image of the number on it. If only the number changes, then the area of the changed part will decrease by 100 times and, accordingly, the update engine will redraw it faster. Redraw only when the number has changed. Delay(50) - no flickering, frequency 20 times per second
Code: Select all
size = 220
time = 50
OpenWindow(0, 0, 0, size+40, size+40, "test", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
CreateImage(0, size, size, 32) ; only with 32-bits depth
ImageGadget(0, 20, 20, size, size, 0)
; DisableDebugger
Repeat
Repeat
e = WindowEvent()
If e = #PB_Event_CloseWindow
End
EndIf
Until Not e
SetGadgetState(0, ImageID(0))
Delay(time)
ForEver