From Bennu Wiki
Jump to: navigation, search
This is about the filetype. Did you mean the local variable file or the function file()?

Up to Filetypes


A file is a container for graphics, identified by a non-negative integer (0 or higher). It holds all information about the contained graphics (pixels, width, height, depth, name, etc). Each of these graphics have a unique identifier inside the file (positive int).

A file can be created for example by loading an FPG (Fichero Para Gráficos, meaning "file for graphics") into it, by using fpg_load(), which creates a new file with the graphics from the loaded FPG and returns a unique identifier. Another option is to create a new, empty one by using fpg_new(). Don't let the name fpg_new() fool you: fpg_new() has nothing to do with the filetype FPG. This is because the FPG format is only for files and not for internal use. There are more ways to load graphics into a file.

A file can be used by using the local variable file or by using the identifier in the various functions with a file parameter.

Don't forget to unload it with fpg_unload() after use.


import "mod_map"
import "mod_grproc"
import "mod_key"
import "mod_wm"

    int file_id;
    int file_id2;

Process Main()

    // Load FPG
    file_id = load_fpg("example.fpg");
    file_id2 = load_fpg("example2.fpg");

    // Set locals for display of graph
    file = file_id;
    graph = 1;
    x = y = 50;
    // assign Ship to use example2.fpg
    Ship(300,100,5,file_id2,1); // undefined in this sample


Used in example: load_fpg(), key(), x, y, file, graph. process

Media in example: example.fpg

Note: nothing will be seen unless you have an FPG "example.fpg" with a graphic with ID 1.