WaitEvent() in Blitz3D with userlibs

Blitz3D Forums/Blitz3D Userlibs/WaitEvent() in Blitz3D with userlibs

if it's really only the blitz app that you want to watch for events, you could do it with some kind of screensaver mode.

example:


...
old_mx=mx
old_my=my
mx=mousex()
my=mousey()
k=0
for i=1 to 255
 if keydown(i) then 
 k=1
 exit
next
if (k<>0) or (mx<>old_mx) or (my<>old_my)
 lastuseraction=millisecs()
endif

if millisecs()>(lastuseraction-1000) then
 delay 100
endif
...


It will not be completely idle, but it will kind of slumber as soon as the user doesn't interact for a second. I guess the CPU usage will drop to about 5%.

If you want to use real WaitEvent System Calls, take a look at the BlitzWin3D Include Files.