waitevent() is crap
BlitzMax Forums/BlitzMax Programming/waitevent() is crap
| ||
Ok, The waitevent() system seems to be causing more trouble than good. What happened to the good ole days of b+ waitevent()?? Right now I'm having to do this: Global flipTimer:TTimer = CreateTimer(1000) Waitevent() If EventID()=EVENT_TIMERTICK and EventSource()= flipTimer then Flip What are other viable solutions to the waitevent() varmin??? (p.s. adding a hook system didnt seem to do much good, the above way was better, but there has to be even better!!!!) AddHook EmitEventHook, flipitHook Function flipitHook:Object(iId:Int,TData:Object,tContext:Object) Local event:TEvent=TEvent(TData) If event.source=flipTimer and event.id=EVENT_TIMERTICK Flip Return Null EndIf Return TData End Function |
| ||
You're not making a lot of sense... What's the problem exactly? What do you want it to do? |
| ||
Flip properly. I've gotten a few different reports of a 'slowed down' flipping process on some machines (don't have specifics besides that they are pc's) I've also decided to go with Indiepath's igLoader for delivering bmax content via web browsers and the game is crawling due to the way the waitevent() system works. (Indiepath verified) What I am getting at is that since Waitevent() waits indefinately... it seems to be causing some flip issues. What is the BEST method to flip a canvas using the current bmax events? |
| ||
What I am getting at is that since Waitevent() waits indefinately If it helps, PollEvent doesn't wait. |
| ||
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 |
| ||
Well triggering a Flip event 1000 times a second, and only actually fliping 60 (or whatever the refreshrate is), is going to cause serious slowdown, as the Event queue is going to be filling up with the other 940 events every second, completely drowning any other events. |
| ||
Pollevent() That seems to be what I was looking for. I will check it against the igLoader and see what happens! Thanks guys |