waitevent() is crap

BlitzMax Forums/BlitzMax Programming/waitevent() is crap

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

What is the BEST method to flip a canvas using the current bmax events?


I'd assume what you want is something like this:
Local YourTimer:TTimer = CreateTimer( 60 )
Local YourCanvas:TGadget = You know what it is.

While Running
    WaitEvent( )
    
    Select CurrentEvent.Id
        Case EVENT_TIMERTICK
            If CurrentEvent.Source <> YourTimer Then Continue
            RedrawGadget( YourCanvas )
            
        Case EVENT_GADGETPAINT
            Local src:TGadget = TGadget(CurrentEvent.Source)
            Assert src,"Event source is not a gadget"
            
            SetGraphics( src.CanvasGraphics( ) )
            
            Cls( )
            
            ' Draw stuff
            
            Flip( )
            
        Default
    End Select
Wend