Unit alFlic

DescriptionUsesClasses, Interfaces, Objects and RecordsFunctions and ProceduresTypesConstantsVariables

Description

FLIC movie routines.

There are two high level functions for playing FLI/FLC animations: al_play_fli, which reads the data directly from disk, and al_play_memory_fli, which uses data that has already been loaded into RAM. Apart from the different sources of the data, these two functions behave identically. They draw the animation onto the specified bitmap, which should normally be the screen. Frames will be aligned with the top left corner of the bitmap: if you want to position them somewhere else you will need to create a sub-bitmap for the FLI player to draw onto.

If the callback function is not Nil it will be called once for each frame, allowing you to perform background tasks of your own. This callback should normally return zero: if it returns non-zero the player will terminate (this is the only way to stop an animation that is playing in looped mode).

The FLI player returns AL_FLI_OK if it reached the end of the file, AL_FLI_ERROR if something went wrong, and the value returned by the callback function if that was what stopped it. If you need to distinguish between different return values, your callback should return positive integers, since AL_FLI_OK is zero and AL_FLI_ERROR is negative.

Note that the FLI player will only work when the timer module is installed, and that it will alter the palette according to whatever palette data is present in the animation file.

Occasionally you may need more detailed control over how an FLI is played, for example if you want to superimpose a text scroller on top of the animation, or to play it back at a different speed. You could do both of these with the lower level functions described below.

Overview

Functions and Procedures

FUNCTION al_play_fli (CONST filename: AL_STR; bmp: AL_BITMAPptr; loop: AL_BOOL; callback: AL_SIMPLE_FUNC): AL_INT; CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'play_fli';
FUNCTION al_play_memory_fli (fli_data: AL_VOIDptr; bmp: AL_BITMAPptr; loop: AL_BOOL; callback: AL_SIMPLE_FUNC): AL_INT; CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'play_memory_fli';
FUNCTION al_open_fli (CONST filename: AL_STR): AL_INT; CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'open_fli';
FUNCTION al_open_memory_fli (fli_data: AL_VOIDptr): AL_INT; CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'open_memory_fli';
PROCEDURE al_close_fli; CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'close_fli';
FUNCTION al_next_fli_frame (loop: AL_BOOL): AL_INT; CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'next_fli_frame';
PROCEDURE al_reset_fli_variables; CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'reset_fli_variables';

Variables

al_fli_bitmap: AL_BITMAPptr; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'fli_bitmap';
al_fli_palette: AL_PALETTE; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'fli_palette';
al_fli_bmp_dirty_from: AL_INT; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'fli_bmp_dirty_from';
al_fli_bmp_dirty_to: AL_INT; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'fli_bmp_dirty_to';
al_fli_pal_dirty_from: AL_INT; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'fli_pal_dirty_from';
al_fli_pal_dirty_to: AL_INT; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'fli_pal_dirty_to';
al_fli_frame: AL_INT; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'fli_frame';
al_fli_timer: AL_INT; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'fli_timer';

Description

Functions and Procedures

FUNCTION al_play_fli (CONST filename: AL_STR; bmp: AL_BITMAPptr; loop: AL_BOOL; callback: AL_SIMPLE_FUNC): AL_INT; CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'play_fli';

Plays an Autodesk Animator FLI or FLC animation file on the specified AL_BITMAP, reading the data from disk as it is required. If loop is True, the player will cycle when it reaches the end of the file, otherwise it will play through the animation once and then return. Read the introduction for alflic unit for a description of the callback parameter.

Returns

AL_FLI_OK if it reached the end of the file, AL_FLI_ERROR if something went wrong, or the value returned by the callback function if that was what stopped it.

See also
al_play_memory_fli
Plays an Autodesk Animator FLI or FLC animation on the specified AL_BITMAP, reading the data from a copy of the file which is held in memory.
al_install_timer
Installs the Allegro timer interrupt handler.
al_fli_frame
Global variable containing the current frame number in the FLI file.
FUNCTION al_play_memory_fli (fli_data: AL_VOIDptr; bmp: AL_BITMAPptr; loop: AL_BOOL; callback: AL_SIMPLE_FUNC): AL_INT; CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'play_memory_fli';

Plays an Autodesk Animator FLI or FLC animation on the specified AL_BITMAP, reading the data from a copy of the file which is held in memory. You can obtain the fli_data pointer by allocating a block of memory and reading an FLI file into it, or by importing an FLI into a grabber datafile. If loop is True, the player will cycle when it reaches the end of the file, otherwise it will play through the animation once and then return. Read the introduction for alflic unit for a description of the callback parameter.

Playing animations from memory is obviously faster than cuing them directly from disk, and is particularly useful with short, looped FLI's. Animations can easily get very large, though, so in most cases you will probably be better just using al_play_fli. You can think of this function as a wrapper on top of al_open_memory_fli, al_next_fli_frame and al_close_fli.

Returns

AL_FLI_OK if it reached the end of the file, AL_FLI_ERROR if something went wrong, or the value returned by the callback function if that was what stopped it.

See also
al_install_timer
Installs the Allegro timer interrupt handler.
al_fli_frame
Global variable containing the current frame number in the FLI file.
FUNCTION al_open_fli (CONST filename: AL_STR): AL_INT; CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'open_fli';

Open FLI files ready for playing, reading the data from disk. Information about the current FLI is held in the global variables al_fli_bitmap and al_fli_palette, which you can use if this function succeeds. However, you can only have one animation open at a time. al_open_memory_fli

Returns

AL_FLI_OK on success, AL_FLI_ERROR if something went wrong, like trying to open another FLI file without closing the previous one.

See also
al_close_fli
Closes an FLI file when you have finished reading from it.
al_next_fli_frame
Reads the next frame of the current animation file.
FUNCTION al_open_memory_fli (fli_data: AL_VOIDptr): AL_INT; CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'open_memory_fli';

Open FLI files ready for playing, reading the data from memory. Information about the current FLI is held in the global variables al_fli_bitmap and al_fli_palette, which you can use if this function succeeds. However, you can only have one animation open at a time. al_open_fli

Returns

AL_FLI_OK on success, AL_FLI_ERROR if something went wrong, like trying to open another FLI file without closing the previous one.

See also
al_close_fli
Closes an FLI file when you have finished reading from it.
al_next_fli_frame
Reads the next frame of the current animation file.
PROCEDURE al_close_fli; CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'close_fli';

Closes an FLI file when you have finished reading from it. Remember to do this to avoid having memory leaks in your program.

See also
al_open_fli
Open FLI files ready for playing, reading the data from disk.
FUNCTION al_next_fli_frame (loop: AL_BOOL): AL_INT; CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'next_fli_frame';

Reads the next frame of the current animation file. If loop is True, the player will cycle when it reaches the end of the file, otherwise it will return AL_FLI_EOF. The frame is read into the global variables al_fli_bitmap and al_fli_palette.

Returns

AL_FLI_OK on success, AL_FLI_ERROR or AL_FLI_NOT_OPEN on error, and AL_FLI_EOF on reaching the end of the file.

See also
al_open_fli
Open FLI files ready for playing, reading the data from disk.
al_fli_timer
Global variable for timing FLI playback.
al_fli_frame
Global variable containing the current frame number in the FLI file.
PROCEDURE al_reset_fli_variables; CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'reset_fli_variables';

Once you have done whatever you are going to do with the al_fli_bitmap and al_fli_palette, call this function to reset the (al_fli_bmp_dirty_* )and al_fli_pal_dirty_* variables.

See also
al_fli_bmp_dirty_from
These variables are set by al_next_fli_frame to indicate which part of the al_fli_bitmap has changed since the last call to al_reset_fli_variables.
al_fli_pal_dirty_from
These variables are set by al_next_fli_frame to indicate which part of the al_fli_palette has changed since the last call to al_reset_fli_variables.

Variables

al_fli_bitmap: AL_BITMAPptr; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'fli_bitmap';

Contains the current frame of the FLI/FLC animation. If there is no open animation, its value will be Nil.

See also
al_next_fli_frame
Reads the next frame of the current animation file.
al_fli_bmp_dirty_from
These variables are set by al_next_fli_frame to indicate which part of the al_fli_bitmap has changed since the last call to al_reset_fli_variables.
al_fli_pal_dirty_from
These variables are set by al_next_fli_frame to indicate which part of the al_fli_palette has changed since the last call to al_reset_fli_variables.
al_fli_palette: AL_PALETTE; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'fli_palette';

Contains the current FLI palette.

See also
al_next_fli_frame
Reads the next frame of the current animation file.
al_fli_pal_dirty_from
These variables are set by al_next_fli_frame to indicate which part of the al_fli_palette has changed since the last call to al_reset_fli_variables.
al_fli_bitmap
Contains the current frame of the FLI/FLC animation.
al_fli_bmp_dirty_from: AL_INT; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'fli_bmp_dirty_from';

These variables are set by al_next_fli_frame to indicate which part of the al_fli_bitmap has changed since the last call to al_reset_fli_variables. If al_fli_bmp_dirty_from is greater than al_fli_bmp_dirty_to, the bitmap has not changed, otherwise lines al_fli_bmp_dirty_from to al_fli_bmp_dirty_to (inclusive) have altered. You can use these when copying the al_fli_bitmap onto the screen, to avoid moving data unnecessarily.

al_fli_bmp_dirty_to: AL_INT; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'fli_bmp_dirty_to';
 
See also
al_fli_bmp_dirty_from
These variables are set by al_next_fli_frame to indicate which part of the al_fli_bitmap has changed since the last call to al_reset_fli_variables.
al_fli_pal_dirty_from: AL_INT; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'fli_pal_dirty_from';

These variables are set by al_next_fli_frame to indicate which part of the al_fli_palette has changed since the last call to al_reset_fli_variables. If al_fli_pal_dirty_from is greater than al_fli_pal_dirty_to, the palette has not changed, otherwise colors al_fli_pal_dirty_from to al_fli_pal_dirty_to (inclusive) have altered. You can use these when updating the hardware palette, to avoid unnecessary calls to al_set_palette.

al_fli_pal_dirty_to: AL_INT; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'fli_pal_dirty_to';
 
See also
al_fli_pal_dirty_from
These variables are set by al_next_fli_frame to indicate which part of the al_fli_palette has changed since the last call to al_reset_fli_variables.
al_fli_frame: AL_INT; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'fli_frame';

Global variable containing the current frame number in the FLI file. This is useful for synchronising other events with the animation, for instance you could check it in a al_play_fli callback function and use it to trigger a sample at a particular point.

See also
al_play_memory_fli
Plays an Autodesk Animator FLI or FLC animation on the specified AL_BITMAP, reading the data from a copy of the file which is held in memory.
al_next_fli_frame
Reads the next frame of the current animation file.
al_fli_timer: AL_INT; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'fli_timer';

Global variable for timing FLI playback. When you open an FLI file, a timer interrupt is installed which increments this variable every time a new frame should be displayed. Calling al_next_fli_frame decrements it, so you can test it and know that it is time to display a new frame if it is greater than zero.

See also
al_install_timer
Installs the Allegro timer interrupt handler.

Generated by PasDoc 0.13.0 on 2016-07-20 12:01:35