Profile

ALLEGRO_GET_EVENT_TYPE(3alleg5)

ALLEGRO_GET_EVENT_TYPE(3alleg5)

NAME

ALLEGRO_GET_EVENT_TYPE - Allegro 5 API

SYNOPSIS

C]
#include <allegro5/allegro.h>
#define ALLEGRO_GET_EVENT_TYPE(a, b, c, d)   AL_ID(a, b, c, d)
]

DESCRIPTION

Make an event type identifier, which is a 32-bit integer. Usually, but not necessarily, this will be made from four 8-bit character codes, for example:

C]
#define MY_EVENT_TYPE   ALLEGRO_GET_EVENT_TYPE([aq]M[aq],[aq]I[aq],[aq]N[aq],[aq]E[aq])
]

IDs less than 1024 are reserved for Allegro or its addons. Don[aq]t use anything lower than C]ALLEGRO_GET_EVENT_TYPE(0, 0, 4, 0)].

You should try to make your IDs unique so they don[aq]t clash with any 3rd party code you may be using. Be creative. Numbering from 1024 is not creative.

If you need multiple identifiers, you could define them like this:

C]
#define BASE_EVENT   ALLEGRO_GET_EVENT_TYPE([aq]M[aq],[aq]I[aq],[aq]N[aq],[aq]E[aq])
#define BARK_EVENT   (BASE_EVENT + 0)
#define MEOW_EVENT   (BASE_EVENT + 1)
#define SQUAWK_EVENT (BASE_EVENT + 2)
/* Alternatively */
enum {
   BARK_EVENT = ALLEGRO_GET_EVENT_TYPE([aq]M[aq],[aq]I[aq],[aq]N[aq],[aq]E[aq]),
   MEOW_EVENT,
   SQUAWK_EVENT
};
]

SEE ALSO

ALLEGRO_EVENT(3alleg5), ALLEGRO_USER_EVENT(3alleg5), ALLEGRO_EVENT_TYPE_IS_USER(3alleg5)

Latest Tech News
Your Notes

Sign in/Sign up

Signing in to our system allows you to post your contributions and vote on the contributions of others. It will also allow you to get extra perts like having your favorites in the cloud and having your persistent personal notes wherever you go. More will be added as we scale up our services.

By signing in to our system, you agree our Member Terms and Conditions


Sign-in with one of the following services

Almost finished!

Please select a screen name for NET SOUP.



 Please send me news and special offers from NET SOUP.

 I have read and accept the Terms of Use.

COMPLIMENTARY EXAMPLES

We have no example yet for this entry


Your Name
Now

Community Contributions and Discussions

Modify your search

View Documentation

Jobs from Indeed