Wiki Page Content

Differences between revisions 1 and 2
Revision 1 as of 2010-02-12 23:38:05
Size: 776
Editor: adsl-71-147-59-141
Comment: added SDL_PollEvent
Revision 2 as of 2010-03-03 02:32:20
Size: 1199
Editor: 208
Comment:
Deletions are marked like this. Additions are marked like this.
Line 23: Line 23:
You can add your code example here 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...
}
Line 27: Line 33:
''You can add useful comments here''  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.
Line 30: Line 36:
 .[[SDL_OtherFunction]]
 .[[SDL_WaitEvent]], [[SDL_WaitEventTimeout]]
 .[[SDL_PeepEvents]]
 .[[SDL_PushEvent]]
 .[[SDL_SetEventFilter]], [[SDL_GetEventFilter]]

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 event.

Return Value

Returns 1 if there are any pending events, or 0 if there are none available.

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, CategoryHeader


CategoryAPI

None: SDL_PollEvent (last edited 2018-10-30 06:19:43 by LionKimbro)

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