This wiki is out of date, use the continuation of this wiki instead

Load fpg

From FenixWiki

Revision as of 15:16, 17 May 2007 by G105b (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search


Contents

Definition

INT load_fpg ( <STRING file> )

Loads a graphics library into your program.

This function loads the whole contents of a FPG graphics library into your project, enabling the contained graphics to be used in your program as process' graphs, screen backgrounds (put_screen) or other graphics.

Parameters

STRING file - The file name of the FPG that you wish to load (including extension).

Returns

INT : A numerical identifier for the FPG file.

Notes

Using a FPG file to contain all or some of the graphics used in a Fenix program is convenient, but isn't always the best way to load graphics. Other methods of loading graphics into your program include load_map and load_png which load individual graphic files. Graphics loaded individually will be given an ID starting at 1000, this is because Fenix pre-allocates room for the first FPG loaded (FPG files can contain 999 different graphics max.), sometimes referred to as the environment FPG.

The first FPG file loaded into a Fenix program returns and uses the FileID 0, which is pre-allocated by Fenix for use as the environment FPG. All extra FPG files loaded will have a different FileID, progressing from 1 upwards.

A FPG file holds all its contained graphs in memory simultaneously. Having a lot of large graphs being read from a single FPG file at once has been known to slow down Fenix programs.

Once a FPG file is no longer necessary to be held in the memory, its memory space can be released by using the function unload_fpg. It is not necessary to unload files loaded within Fenix, even at the termination of a program. Fenix always releases all used memory at the end of program execution.

Example

Program example;
Global
    my_fpg;
Begin
    my_fpg=load_fpg("test.fpg");   //Loads the FPG file into memory
    put_screen(my_fpg,1);          //Puts graphic with code 1 onto screen
    Loop
        frame;
    End
End
Personal tools