[ Maverik Level 1 functions ]


mav_eventsCheck

Summary

Check for input device events.


Syntax

int mav_eventsCheck(void);


Description

This function calls the check event function for each registered input device, in the order in which they were registered. If any of the devices' check event functions detects an event has occurred on that device, and an appropriate callback has been registered for that event type, the callback is executed and mav_eventsCheck returns immediately.

The return value of the callback forms the return value of this function. If no events are detected the return value is zero. If, and how, this return value is interpreted is an application-specific issue. For example, it could be used to control the drawing of frames. Consider the following three rendering loops:

    while ( 1 ) {
       if ( mav_eventsCheck() ) {
         /* draw frame */
       }
    }

while ( 1 ) { mav_eventsCheck(); /* draw frame */ }

while ( 1 ) { while ( mav_eventsCheck() ) {} /* draw frame */ }

The first loop would only draw a new frame in response to an event occurring for which the callback function returns a true value. The second loop ignores the return value and draws frames in a continuous loop. The third example processes all outstanding events before drawing a frame.


See also

mav_deviceNew.html>mav_deviceNew


Back to the index page.