Budman: more info: I tried changing ProcessInput to this:
and I stuck CreateTimer(200) before the main loop.
This works too, it scrolls etc. However in full-screen mode, if I bring up task manager, CPU use drops to 0! This must mean the timer isn't being activated. In windowed mode though, the CPU use fluctuates a lot more but I wouldn't say it was really any less than your code using PeekEvent, hmm...
I wonder what BMax does internally with WaitEvent ... is it looping or does Windows handle the waiting? In theory the WaitEvent with a fast timer for the scrolling etc should be the best option as it leaves max time for the CPU. Although I'm still not clear what happens if the timer missed a few ticks due to lots going on, I guess it would queue several events, which is why using a delta time is important.
Function ProcessInput:Int() Select WaitEvent() Case EVENT_KEYDOWN If EventData()=KEY_F1 F1= Not F1 If EventData()=KEY_F2 F2= Not F2 If EventData()=KEY_ESCAPE Return False Case EVENT_APPTERMINATE Return False End Select Return True End Function
and I stuck CreateTimer(200) before the main loop.
This works too, it scrolls etc. However in full-screen mode, if I bring up task manager, CPU use drops to 0! This must mean the timer isn't being activated. In windowed mode though, the CPU use fluctuates a lot more but I wouldn't say it was really any less than your code using PeekEvent, hmm...
I wonder what BMax does internally with WaitEvent ... is it looping or does Windows handle the waiting? In theory the WaitEvent with a fast timer for the scrolling etc should be the best option as it leaves max time for the CPU. Although I'm still not clear what happens if the timer missed a few ticks due to lots going on, I guess it would queue several events, which is why using a delta time is important.