Show datfli.c syntax highlighted
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Grabber plugin for managing FLIC animation objects.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#include <stdio.h>
#include "allegro.h"
#include "allegro/internal/aintern.h"
#include "../datedit.h"
/* creates a new FLIC object */
static void *makenew_fli(long *size)
{
char *v = _al_malloc(1);
*v = 0;
*size = 1;
return v;
}
/* displays a FLIC object in the grabber object view window */
static void plot_fli(AL_CONST AL_DATAFILE *dat, int x, int y)
{
al_put_text(al_screen, al_font_8x8, "Double-click in the item list to play it", x, y+32, al_gui_fg_color);
}
/* callback to quit out of the FLI player */
static int fli_stopper(void)
{
al_poll_mouse();
if ((al_key_pressed()) || (al_mouse_b))
return 1;
else
return 0;
}
/* handles double-clicking on a FLIC object in the grabber */
static int view_fli(AL_DATAFILE *dat)
{
al_show_mouse(NULL);
al_clear_to_color(al_screen, al_gui_mg_color);
al_play_memory_fli(dat->dat, al_screen, TRUE, fli_stopper);
do {
al_poll_mouse();
} while (al_mouse_b);
al_clear_keybuf();
al_set_palette(datedit_current_palette);
al_show_mouse(al_screen);
return D_REDRAW;
}
/* plugin interface header */
DATEDIT_OBJECT_INFO datfli_info =
{
DAT_FLI,
"FLI/FLC animation",
NULL,
makenew_fli,
NULL,
plot_fli,
view_fli,
NULL
};
DATEDIT_GRABBER_INFO datfli_grabber =
{
DAT_FLI,
"fli;flc",
"fli;flc",
NULL,
NULL
};
See more files for this project here