SDL_events.h
Estructura SDL_DisplayEvent
Una estructura que contiene datos de eventos de cambio de estado de visualización.
typedef struct SDL_DisplayEvent
{
Uint32 type; /**< ::SDL_DISPLAYEVENT */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Uint32 display; /**< The associated display index */
Uint8 event; /**< ::SDL_DisplayEventID */
Uint8 padding1;
Uint8 padding2;
Uint8 padding3;
Sint32 data1; /**< event dependent data */
} SDL_DisplayEvent;
Miembros
- type
- SDL_DISPLAYEVENT
- timestamp
- Marca de tiempo en milisegundos.
- display
- El índice de display asociado.
- event
- SDL_DisplayEventID.
- data1
- Datos asociados con el evento.
Observaciones
SDL_DisplayEvent es un miembro de la unión SDL_Event y se utiliza cuando se notifica un evento de tipo SDL_DISPLAYEVENT. Se accede a él a través del campo de visualización del evento.
Ejemplo
SDL_Event ev;
while (SDL_PollEvent(&ev) != 0) {
if (ev.type == SDL_DISPLAYEVENT) {
switch (ev.display.event) {
case SDL_DISPLAYEVENT_CONNECTED:
SDL_Log("A new display with id %d was connected", ev.display.display);
break;
case SDL_DISPLAYEVENT_DISCONNECTED:
SDL_Log("The display with id %d was disconnected", ev.display.display);
break;
case SDL_DISPLAYEVENT_ORIENTATION:
SDL_Log("The orientation of display with id %d was changed", ev.display.display);
break;
}
}
}