al_init_user_event_source man page on DragonFly

Man page or keyword search:  
man Server   44335 pages
apropos Keyword Search (all sections)
Output format
DragonFly logo
[printable version]

al_init_user_event_source(3)			  al_init_user_event_source(3)

NAME
       al_init_user_event_source - Allegro 5 API

SYNOPSIS
	      #include <allegro5/allegro.h>

	      void al_init_user_event_source(ALLEGRO_EVENT_SOURCE *src)

DESCRIPTION
       Initialise an event source for emitting user events.  The space for the
       event source must already have been allocated.

       One possible way of creating custom event sources is  to	 derive	 other
       structures with ALLEGRO_EVENT_SOURCE at the head, e.g.

	      typedef struct THING THING;

	      struct THING {
		  ALLEGRO_EVENT_SOURCE event_source;
		  int field1;
		  int field2;
		  /* etc. */
	      };

	      THING *create_thing(void)
	      {
		  THING *thing = malloc(sizeof(THING));

		  if (thing) {
		      al_init_user_event_source(&thing->event_source);
		      thing->field1 = 0;
		      thing->field2 = 0;
		  }

		  return thing;
	      }

       The  advantage  here  is that the THING pointer will be the same as the
       ALLEGRO_EVENT_SOURCE pointer.  Events emitted by the event source  will
       have  the  event source pointer as the source field, from which you can
       get a pointer to a THING by a simple cast (after ensuring checking  the
       event is of the correct type).

       However, it is only one technique and you are not obliged to use it.

       The  user event source will never be destroyed automatically.  You must
       destroy it manually with al_destroy_user_event_source(3).

SEE ALSO
       ALLEGRO_EVENT_SOURCE(3),		      al_destroy_user_event_source(3),
       al_emit_user_event(3), ALLEGRO_USER_EVENT(3)

Allegro reference manual			  al_init_user_event_source(3)
[top]

List of man pages available for DragonFly

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net