Wiki Page Content

Revision 5 as of 2010-05-12 04:23:16

Clear message

DRAFT

SDL_PollEvent

Use this function to poll for currently pending events.

Syntax

int SDL_PollEvent(SDL_Event* event)

Function Parameters

event

If not NULL, the next event is removed from the queue and stored in that area '''event'''.

green

Return Value

Returns 1 if there are any pending events, or 0 if there are none available; call SDL_GetError() for more information. green

Code Examples

while(1){
    SDL_Event event;
    if(SDL_PollEvent(&event)){
         // handle your event here
    }
    // do some other stuff here -- draw your app, play your music, perform other operations...
}

Remarks

SDL_PollEvent is the favored way of receiving system events since it can be done from the main loop and does not suspend the main loop while waiting on an event to be posted.


CategoryAPI, CategoryEvents

(Page Info.)
Feedback
Please include your contact information if you'd like to receive a reply.
Submit