FryGUI CPU usage

BlitzMax Forums/BlitzMax Programming/FryGUI CPU usage

matty47(Posted 2008) [#1]
I am requesting some advice regarding CPU usage and FryGUI. I made a minimal app - just creates a screen in FryGUI and loops. I note that cpu usage during execution is 100%. Here is code
SuperStrict

'import FryGui
Import fry.frygui

'Set graphics and blendmode before loading the gui
AppTitle="FryGui Canvas Test"
Graphics 1024,768,0,0
fry_SetResolution (1024,768)
fry_SystemCursor(False)
SetBlend ALPHABLEND

'load in a skin for the GUI
fry_LoadSkin("Skin1")

'add the fonts to the GUI. Fonts will be referenced by their names.
fry_AddFont("Default", "trebucbd.ttf", 13)
fry_AddFont("Large", "trebucbd.ttf", 24)

'create a screen
Local scr1:fry_TScreen=fry_CreateScreen("Screen1")


'set the initial screen - need to do this or the gui will crash
fry_SetScreen("Screen1")
SetClsColor 40,40,70



'main loop
While Not KeyHit(KEY_ESCAPE)

PollSystem
Cls

'refresh the gui
fry_Refresh()


Flip(0)
GCCollect()

Wend

Do I need to add a timer ? or just let it run flat out?
Thanks
Matty


Mark Tiffany(Posted 2008) [#2]
Replace PollSystem with WaitEvent


matty47(Posted 2008) [#3]
Thanks. I did change the Flip(0) to just Flip and this dropped the CPU usage from 100% to about 5% when no events were being generated.