What the Program Does

What the Program Does — How to use the Blorb layer in your program

Functions

Types and Values

typedef giblorb_map_t

Includes

#include <libchimara/glk.h>
#include <libchimara/gi-blorb.h>

Description

If you wish your program to load its resources from a Blorb file, you need to find and open that file in your startup code. (See Startup Options.) Each platform will have appropriate functions available for finding startup data. Be sure to open the file in binary mode, not text mode. Once you have opened the file as a Glk stream, pass it to giblorb_set_resource_map().

If you do not call giblorb_set_resource_map() in your startup code, or if it fails, the library is left to its own devices for finding resources. Some libraries may try to load resources from individual files — PIC1, PIC2, PIC3, and so on. (See the Blorb specification for more on this approach.) Other libraries will not have any other loading mechanism at all; no resources will be available.

Functions

giblorb_set_resource_map ()

giblorb_err_t
giblorb_set_resource_map (strid_t file);

This function tells the library that the file is indeed the Blorby source of all resource goodness. Whenever your program calls an image or sound function, such as glk_image_draw(), the library will search this file for the resource you request.

Do not close the stream after calling this function. The library is responsible for closing the stream at shutdown time.

Parameters

file

The file stream to read the resource map from

 

Returns

a Blorb error code.


giblorb_get_resource_map ()

giblorb_map_t *
giblorb_get_resource_map (void);

This function returns the current resource map being used. Returns NULL if giblorb_set_resource_map() has not been called yet.

Returns

a resource map, or NULL.

Types and Values

giblorb_map_t

typedef struct giblorb_map_struct giblorb_map_t;

Holds the complete description of an open Blorb file. This type is opaque for normal interpreter use.