char              ext[MAX_EXTENSION_LENGTH];
   ALLEGRO_SAMPLE *  (*loader)(const char *filename);
   bool              (*saver)(const char *filename, ALLEGRO_SAMPLE *spl);
   ALLEGRO_AUDIO_STREAM *(*stream_loader)(const char *filename,
                        size_t buffer_count, unsigned int samples);
                        
   ALLEGRO_SAMPLE *  (*fs_loader)(ALLEGRO_FILE *fp);
   bool              (*fs_saver)(ALLEGRO_FILE *fp, ALLEGRO_SAMPLE *spl);
   ALLEGRO_AUDIO_STREAM *(*fs_stream_loader)(ALLEGRO_FILE *fp,
                        size_t buffer_count, unsigned int samples);
};


/* globals */
static bool acodec_inited = false;
static _AL_VECTOR acodec_table = _AL_VECTOR_INITIALIZER(ACODEC_TABLE);


static void acodec_shutdown(void)
{
   if (acodec_inited) {
      _al_vector_free(&acodec_table);
      acodec_inited = false;
   }
}


static ACODEC_TABLE *find_acodec_table_entry(const char *ext)
{
   ACODEC_TABLE *ent;
   unsigned i;
Beispiel #2
0
#include "allegro5/allegro_native_dialog.h"
#include "allegro5/internal/aintern_native_dialog.h"
#include "allegro5/internal/aintern_dtor.h"
#include "allegro5/internal/aintern_system.h"
#include "allegro5/internal/aintern_vector.h"

/* DISPLAY_MENU keeps track of which menu is associated with a display */
typedef struct DISPLAY_MENU DISPLAY_MENU;

struct DISPLAY_MENU
{
   ALLEGRO_DISPLAY *display;
   ALLEGRO_MENU *menu;
};

static _AL_VECTOR display_menus = _AL_VECTOR_INITIALIZER(DISPLAY_MENU);

/* The unique id. This is used to reverse lookup menus.
 * The primarily need for this arises from Windows, which cannot store
 * ALLEGRO_MENU_ID's wholesale.*/
static uint16_t unique_id;
static _AL_VECTOR menu_ids  = _AL_VECTOR_INITIALIZER(_AL_MENU_ID);

/* The default event source is used with any menu that does not have
   its own event source enabled. */
static ALLEGRO_EVENT_SOURCE default_menu_es;

/* Private functions */
static ALLEGRO_MENU *clone_menu(ALLEGRO_MENU *menu, bool popup);
static ALLEGRO_MENU_ITEM *create_menu_item(char const *title, uint16_t id, int flags, ALLEGRO_MENU *popup);
static void destroy_menu_item(ALLEGRO_MENU_ITEM *item);