A structure that contains display state change event data
Uint32 | type | SDL_DISPLAYEVENT |
Uint32 | timestamp | Timestamp in milliseconds |
Uint32 | display | The associated display index |
Uint8 | event | SDL_DisplayEventID |
Sint32 | data1 | Event associated data |
SDL_Event ev;
while (SDL_PollEvent(&ev) != 0) {
if (ev.type == SDL_DISPLAYEVENT) {
switch (ev.display.event) {
case SDL_EVENT_DISPLAY_CONNECTED:
"A new display with id %d was connected", ev.display.display);
SDL_Log(break;
case SDL_EVENT_DISPLAY_DISCONNECTED:
"The display with id %d was disconnected", ev.display.display);
SDL_Log(break;
case SDL_EVENT_DISPLAY_ORIENTATION:
"The orientation of display with id %d was changed", ev.display.display);
SDL_Log(break;
}
} }
SDL_DisplayEvent is a member of the SDL_Event union and is used when an event of type SDL_DISPLAYEVENT is reported. You would access it through the event's display
field.