Code archives/User Input/Efficient multitasking

This code has been declared by its author to be Public Domain code.

Download source code

Efficient multitasking by AdamStrange2014
This is the event core I use in my control system.
Note the delay - this gives the system back some time.
I've found that this takes my standard message queue down to 0.1 usage, which may be of help to someone
Method ProgMain()
	local AppX:int
	local AppY:int
	local AppMouseDown:int
	While Not AppQuit
		WaitEvent()
		Select EventID()
			Case EVENT_APPTERMINATE, EVENT_WINDOWCLOSE 
				AppQuit = True
			Case EVENT_MOUSEMOVE
				AppX = EventX()
				AppY = EventY()
				AppMouseDown = MouseDown(1)
		end select
		delay(2)
	wend
end method

Comments

None.

Code Archives Forum