|
Size: 1199
Comment:
|
Size: 1410
Comment: edit page for format errors
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 12: | Line 12: |
| int SDL_PollEvent(SDL_Event * event) | int SDL_PollEvent(SDL_Event* event) |
| Line 16: | Line 16: |
| ||'''event'''||If not NULL, the next event is removed from the queue and stored in event.|| | ||'''event'''||If not NULL, the next event is removed from the queue and stored in '''event'''.|| |
| Line 19: | Line 19: |
| Returns 1 if there are any pending events, or 0 if there are none available. | Returns 1 if there are any pending events, or 0 if there are none available; call [[SDL_GetError]]() for more information. <<Color2(green,The previous author did not include any provision for an error RV. Can this function produce an error or only 0? Would you still call the error function?)>> |
| Line 33: | Line 33: |
| 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. | [[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 36: | Line 36: |
| .[[SDL_WaitEvent]], [[SDL_WaitEventTimeout]] | .[[SDL_GetEventFilter]] |
| Line 39: | Line 39: |
| .[[SDL_SetEventFilter]], [[SDL_GetEventFilter]] | .[[SDL_SetEventFilter]] .[[SDL_WaitEvent]] .[[SDL_WaitEventTimeout]] |
| Line 41: | Line 44: |
| [[CategoryAPI]], [[CategoryHeader]] ---- [[CategoryAPI]] |
[[CategoryAPI]], [[CategoryEvents]] |
DRAFT |
SDL_PollEvent
Use this function to poll for currently pending events.
Contents
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; 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.
