---
name: "ALLEGRO_USER_EVENT"
section: "3"
platform: "linux"
package: "allegro"
version: "5.2.11.3-2"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/ALLEGRO_USER_EVENT"
---

# ALLEGRO\_USER\_EVENT(3)

Allegro 5 API

## NAME

ALLEGRO\_USER\_EVENT - Allegro 5 API

## SYNOPSIS

-

  ```
  #include <allegro5/allegro.h>
  typedef struct ALLEGRO_USER_EVENT ALLEGRO_USER_EVENT;
  ```

## DESCRIPTION

An event structure that can be emitted by user event sources. These are the public fields:

- •

  ALLEGRO\_EVENT\_SOURCE \*source;

- •

  intptr\_t data1;

- •

  intptr\_t data2;

- •

  intptr\_t data3;

- •

  intptr\_t data4;

Like all other event types this structure is a part of the ALLEGRO\_EVENT union. To access the fields in an ALLEGRO\_EVENT variable `ev`, you would use:

- •

  ev.user.source

- •

  ev.user.data1

- •

  ev.user.data2

- •

  ev.user.data3

- •

  ev.user.data4

To create a new user event you would do this:

-

  ```
  ALLEGRO_EVENT_SOURCE my_event_source;
  ALLEGRO_EVENT my_event;
  float some_var;
  al_init_user_event_source(&my_event_source);
  my_event.user.type = ALLEGRO_GET_EVENT_TYPE('M','I','N','E');
  my_event.user.data1 = 1;
  my_event.user.data2 = &some_var;
  al_emit_user_event(&my_event_source, &my_event, NULL);
  ```

Event type identifiers for user events are assigned by the user. Please see the documentation for [ALLEGRO\_GET\_EVENT\_TYPE(3)](/ALLEGRO_GET_EVENT_TYPE/3.md) for the rules you should follow when assigning identifiers.

## SEE ALSO

[al\_emit\_user\_event(3)](/al_emit_user_event/3.md), [ALLEGRO\_GET\_EVENT\_TYPE(3)](/ALLEGRO_GET_EVENT_TYPE/3.md), [al\_init\_user\_event\_source(3)](/al_init_user_event_source/3.md)
