2003-01-15 05:31:51 +00:00
|
|
|
/*******************************************************************************
|
|
|
|
This file is Part of the ZEngine Library for 2D game development.
|
|
|
|
Copyright (C) 2002, 2003 James Turk
|
|
|
|
|
|
|
|
Licensed under a BSD-style license.
|
|
|
|
|
|
|
|
The maintainer of this library is James Turk (james@conceptofzero.net)
|
|
|
|
and the home of this Library is http://www.zengine.sourceforge.net
|
|
|
|
*******************************************************************************/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\file ZE_Utility.h
|
|
|
|
\brief Definition file for ZEngine Utilities.
|
|
|
|
|
|
|
|
Definition file for ZEngine Utilities which are used throughout the engine and can be used in
|
|
|
|
conjunction with ZEngine.
|
2003-10-13 21:48:12 +00:00
|
|
|
<br>$Id: ZE_Utility.h,v 1.9 2003/10/13 21:48:12 cozman Exp $<br>
|
2003-05-07 20:34:50 +00:00
|
|
|
\author James Turk
|
2003-01-15 05:31:51 +00:00
|
|
|
**/
|
|
|
|
|
2003-05-07 20:34:50 +00:00
|
|
|
|
2003-01-15 05:31:51 +00:00
|
|
|
#ifndef __ze_utility_h__
|
|
|
|
#define __ze_utility_h__
|
|
|
|
|
|
|
|
#include "ZE_Includes.h"
|
|
|
|
|
|
|
|
namespace ZE
|
|
|
|
{
|
|
|
|
|
|
|
|
/*!
|
2003-06-11 00:15:07 +00:00
|
|
|
\brief Parses a std::string and interprets variable arguments, similar to sprintf.
|
2003-01-15 05:31:51 +00:00
|
|
|
|
|
|
|
Takes % identifiers out of fmtstr and parses them, replacing them with cooresponding values
|
|
|
|
in the variable arguments list. For more detail view stdarg documentation.
|
2003-06-11 00:15:07 +00:00
|
|
|
\param fmtstr defines format of resulting std::string
|
2003-01-15 05:31:51 +00:00
|
|
|
\param ... variable number of arguments after fmtstr
|
2003-06-11 00:15:07 +00:00
|
|
|
\return std::string of parsed and combined std::string
|
2003-01-15 05:31:51 +00:00
|
|
|
**/
|
2003-06-11 00:15:07 +00:00
|
|
|
std::string FormatStr(const char *fmtstr, ...);
|
2003-01-15 05:31:51 +00:00
|
|
|
|
2003-10-05 19:42:34 +00:00
|
|
|
/*!
|
|
|
|
\brief Extracts a SDL_RWops memory structure from a zip archive.
|
|
|
|
|
|
|
|
Attempts to open a file from within a zipfile and return a SDL_RWops which can be used
|
2003-10-13 21:40:05 +00:00
|
|
|
to load a resource from memory.
|
|
|
|
Used internally, generally shouldn't be called by users.
|
2003-10-05 19:42:34 +00:00
|
|
|
\param zipname Name of zip-format archive to open.
|
|
|
|
\param filename Name of file within archive to access.
|
|
|
|
\return On success, pointer to SDL_RWops, on failure, NULL.
|
|
|
|
\since 0.8.5
|
|
|
|
**/
|
2003-09-24 01:49:52 +00:00
|
|
|
SDL_RWops* RWFromZip(std::string zipname, std::string filename);
|
2003-01-15 05:31:51 +00:00
|
|
|
|
|
|
|
/*!
|
2003-04-28 02:00:38 +00:00
|
|
|
\brief Properly free SDL_Surface.
|
|
|
|
|
2003-01-15 05:31:51 +00:00
|
|
|
Safely free an SDL_Surface* and set it to NULL.
|
2003-04-28 02:00:38 +00:00
|
|
|
\param image Image to free and set to NULL.
|
2003-01-15 05:31:51 +00:00
|
|
|
**/
|
2003-04-28 02:00:38 +00:00
|
|
|
void FreeImage(SDL_Surface *&image);
|
2003-01-15 05:31:51 +00:00
|
|
|
|
|
|
|
#ifdef USE_SDL_MIXER
|
2003-04-28 02:00:38 +00:00
|
|
|
|
2003-01-15 05:31:51 +00:00
|
|
|
/*!
|
2003-04-28 02:00:38 +00:00
|
|
|
\brief Properly free Mix_Chunk.
|
|
|
|
|
2003-01-15 05:31:51 +00:00
|
|
|
Safely free a Mix_Chunk* and set it to NULL.
|
2003-04-28 02:00:38 +00:00
|
|
|
\param chunk Chunk to free and set to NULL.
|
2003-01-15 05:31:51 +00:00
|
|
|
**/
|
2003-04-28 02:00:38 +00:00
|
|
|
void FreeSound(Mix_Chunk *&chunk);
|
|
|
|
|
2003-01-15 05:31:51 +00:00
|
|
|
/*!
|
2003-04-28 02:00:38 +00:00
|
|
|
\brief Properly free Mix_Music.
|
|
|
|
|
2003-01-15 05:31:51 +00:00
|
|
|
Safely free a Mix_Music* and set it to NULL.
|
2003-04-28 02:00:38 +00:00
|
|
|
\param music Music to free and set to NULL.
|
2003-01-15 05:31:51 +00:00
|
|
|
**/
|
2003-04-28 02:00:38 +00:00
|
|
|
void FreeMusic(Mix_Music *&music);
|
|
|
|
|
2003-01-15 05:31:51 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef USE_SDL_TTF
|
|
|
|
/*!
|
2003-04-28 02:00:38 +00:00
|
|
|
\brief Properly free TTF_Font.
|
|
|
|
|
|
|
|
Safely free a TTF_Font* and set it to NULL.
|
|
|
|
\param font Font to free and set to NULL.
|
2003-01-15 05:31:51 +00:00
|
|
|
**/
|
2003-04-28 02:00:38 +00:00
|
|
|
void FreeFont(TTF_Font *&font);
|
2003-01-15 05:31:51 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif //__ze_utility_h__
|
|
|
|
|