/* * res * * Access to resources * * © 1991-1998 Straylight */ /*----- Licensing note ----------------------------------------------------* * * This file is part of Straylight's Steel library. * * Steel is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * Steel is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Steel. If not, write to the Free Software Foundation, * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __res_h #define __res_h #ifndef __stdio_h #include #endif #ifndef BOOL #define BOOL int #define TRUE 1 #define FALSE 0 #endif /* * * void res_init(char *progname) * * Use * Sets up res to use a certain path for resources. Mainly for * compatibility with older applications. * * Parameters * char *progname == the program name (sets up path as ) */ void res_init(char *progname); /* * void res_setPrefix(char *prefix) * * Use * Sets up a full prefix for resources. This means you can keep resources * in separate directories. * * Parameters * char *prefix == the prefix */ void res_setPrefix(char *prefix); /* * BOOL res_fileExists(char *name) * * Use * Informs the caller if a given file exists * * Parameters * char *name == the name of the file * * Returns * TRUE if the file really does exist */ BOOL res_fileExists(char *name); /* * int res_findname(const char *resname,char *buf) * * Use * Returns a full pathname for the resource file as given in the buffer. * This is for compatibility reasons. If I was writing this fresh, I * would return a pointer to an internal static object, but Acorn know * best... * * Some new functionality has been added. It will look for files first in * the directory set up using res_init or res_setPrefix, and then in the * 'Resources' subdirectory. If neither is present, then the name returned * is in the main application directory. * * Also, under RISC OS 3, it will search for files with mode prefixes, so * you can use multiple sprite files for different resolutions. Isn't this * fun! * * Parameters * const char *resname == the leafname of the resource file. * char *buf == where to put the result. * * Returns * TRUE for compatibility with the Acorn version. What good it does, I * don't know. This is in all a very odd routine indeed. */ int res_findname(const char *resname,char *buf); /* * char *res_name(const char *resname) * * Use * Translates the name given as for res_findname and returns a pointer to * the translated string */ char *res_name(const char *resname); /* * FILE *res_openfile(const char *resname,const char *mode) * * Use * Opens a resource file in a given ANSI mode. It does this without the * odd adding on of numbers to the end that the Acorn one does (I hope!) * * Parameters * const char *resname == leafname of file to open * const char *mode == pointer to ANSI mode string * * Returns * A standard ANSI-type FILE pointer. */ FILE *res_openfile(const char *resname,const char *mode); #endif