stripped doxygen comments, fixed up "verbage" in method naming, updated license for 2004
This commit is contained in:
		
							parent
							
								
									06581fbec5
								
							
						
					
					
						commit
						aeb7e39cf2
					
				
					 29 changed files with 236 additions and 2886 deletions
				
			
		| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
/*******************************************************************************
 | 
					/*******************************************************************************
 | 
				
			||||||
        This file is Part of the ZEngine Library for 2D game development.
 | 
					        This file is Part of the ZEngine Library for 2D game development.
 | 
				
			||||||
                   Copyright (C) 2002, 2003 James Turk
 | 
					                  Copyright (C) 2002-2004 James Turk
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                     Licensed under a BSD-style license.
 | 
					                     Licensed under a BSD-style license.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,83 +8,24 @@
 | 
				
			||||||
     and the home of this Library is http://www.zengine.sourceforge.net
 | 
					     and the home of this Library is http://www.zengine.sourceforge.net
 | 
				
			||||||
*******************************************************************************/
 | 
					*******************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*!
 | 
					 | 
				
			||||||
    \file VersionInfo.h
 | 
					 | 
				
			||||||
    \brief Definition file for VersionInfo class.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Definition file for VersinInfo class, simple class for containing and comparing 
 | 
					 | 
				
			||||||
    version numbers.
 | 
					 | 
				
			||||||
    <br>$Id: VersionInfo.h,v 1.4 2003/07/12 01:25:42 cozman Exp $<br>
 | 
					 | 
				
			||||||
    \author James Turk
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#ifndef __versioninfo_h__
 | 
					#ifndef __versioninfo_h__
 | 
				
			||||||
#define __versioninfo_h__
 | 
					#define __versioninfo_h__
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "ZE_Utility.h"
 | 
					#include "ZE_Utility.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*!
 | 
					 | 
				
			||||||
    \brief Class for holding version information.
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Class for holding version information on a library.  (Members capitalized because
 | 
					 | 
				
			||||||
    g++ has issues with members named major and minor.)
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
class VersionInfo
 | 
					class VersionInfo
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    public:
 | 
					    public:
 | 
				
			||||||
        //! Major version number.
 | 
					 | 
				
			||||||
        unsigned int Major;
 | 
					        unsigned int Major;
 | 
				
			||||||
        //! Minor version number, changes upon signifigant releases. (Often upon compatibility breaks.)
 | 
					 | 
				
			||||||
        unsigned int Minor;
 | 
					        unsigned int Minor;
 | 
				
			||||||
        //! Version release number, changes on every release.
 | 
					 | 
				
			||||||
        unsigned int Release;
 | 
					        unsigned int Release;
 | 
				
			||||||
        //! String Description of release. (Often blank.)
 | 
					 | 
				
			||||||
        std::string Extra;
 | 
					        std::string Extra;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Constructor for VersionInfo.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Simple constructor for version info, with a parameter for each member.
 | 
					 | 
				
			||||||
            \param maj Major version number.
 | 
					 | 
				
			||||||
            \param min Minor version number.
 | 
					 | 
				
			||||||
            \param rel Version release number.
 | 
					 | 
				
			||||||
            \param ext Extra info std::string, optional (defaults to empty std::string).
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        VersionInfo(unsigned int maj, unsigned int min, unsigned int rel, std::string ext="");
 | 
					        VersionInfo(unsigned int maj, unsigned int min, unsigned int rel, std::string ext="");
 | 
				
			||||||
 | 
					        char* GetString() const;
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Get std::string representing version number.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Get dotted version number major.minor.release [extra].
 | 
					 | 
				
			||||||
            \return Formatted version std::string.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        std::string GetString() const;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Less than operator overload for comparing VersionInfo.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Overload of the less than (<) operator for two VersionInfos.
 | 
					 | 
				
			||||||
            \param rhs Right hand side of comparison.
 | 
					 | 
				
			||||||
            \return true if less than, false if greater than or equal to.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        bool operator<(const VersionInfo &rhs) const;
 | 
					        bool operator<(const VersionInfo &rhs) const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Equals to operator overload for comparing VersionInfo.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Overload of the equals to (==) operator for two VersionInfos.
 | 
					 | 
				
			||||||
            \param rhs Right hand side of comparison.
 | 
					 | 
				
			||||||
            \return true if equal to, false if not equals to.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        bool operator==(const VersionInfo &rhs) const;
 | 
					        bool operator==(const VersionInfo &rhs) const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Greater than operator overload for comparing VersionInfo.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Overload of the greater than (>) operator for two VersionInfos.
 | 
					 | 
				
			||||||
            \param rhs Right hand side of comparison.
 | 
					 | 
				
			||||||
            \return true if greater than, false if less than or equal to.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        bool operator>(const VersionInfo &rhs) const;
 | 
					        bool operator>(const VersionInfo &rhs) const;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
/*******************************************************************************
 | 
					/*******************************************************************************
 | 
				
			||||||
        This file is Part of the ZEngine Library for 2D game development.
 | 
					        This file is Part of the ZEngine Library for 2D game development.
 | 
				
			||||||
                   Copyright (C) 2002, 2003 James Turk
 | 
					                  Copyright (C) 2002-2004 James Turk
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                     Licensed under a BSD-style license.
 | 
					                     Licensed under a BSD-style license.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,34 +8,17 @@
 | 
				
			||||||
     and the home of this Library is http://www.zengine.sourceforge.net
 | 
					     and the home of this Library is http://www.zengine.sourceforge.net
 | 
				
			||||||
*******************************************************************************/
 | 
					*******************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*!
 | 
					 | 
				
			||||||
    \file ZE_Defines.h
 | 
					 | 
				
			||||||
    \brief Define file for ZEngine where all #define statements to control compilation options are placed.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Definition file, holds #define statements describing optional features of ZEngine.
 | 
					 | 
				
			||||||
    <br>$Id: ZE_Defines.h,v 1.25 2003/11/23 19:31:24 cozman Exp $<br>
 | 
					 | 
				
			||||||
    \author James Turk
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#ifndef __ze_defines_h__
 | 
					#ifndef __ze_defines_h__
 | 
				
			||||||
#define __ze_defines_h__
 | 
					#define __ze_defines_h__
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//Defines- undefine any of these if you dont have the indicated SDL extension//
 | 
					//Defines- undefine any of these if you dont have the indicated SDL extension//
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//! OpenGL 2D Rendering Target.
 | 
					 | 
				
			||||||
#define ZE_OGL (1)
 | 
					#define ZE_OGL (1)
 | 
				
			||||||
//! SDL Rendering Target.
 | 
					 | 
				
			||||||
#define ZE_SDL (2)
 | 
					#define ZE_SDL (2)
 | 
				
			||||||
//! Define the graphics backend for ZEngine to use. (Options are ZE_OGL,ZE_SDL,ZE_D3D)
 | 
					 | 
				
			||||||
#define GFX_BACKEND (ZE_OGL)
 | 
					#define GFX_BACKEND (ZE_OGL)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//! Define to include font support.
 | 
					 | 
				
			||||||
#define USE_SDL_TTF
 | 
					#define USE_SDL_TTF
 | 
				
			||||||
//! Define to include non-bmp image file support.
 | 
					 | 
				
			||||||
#define USE_SDL_IMAGE
 | 
					#define USE_SDL_IMAGE
 | 
				
			||||||
//! Define to include sound support.
 | 
					 | 
				
			||||||
#define USE_SDL_MIXER
 | 
					#define USE_SDL_MIXER
 | 
				
			||||||
//! Define to use depreciated code that has not been entirely removed.
 | 
					 | 
				
			||||||
//#define DEPRECIATED
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif //__ze_defines_h__
 | 
					#endif //__ze_defines_h__
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
/*******************************************************************************
 | 
					/*******************************************************************************
 | 
				
			||||||
        This file is Part of the ZEngine Library for 2D game development.
 | 
					        This file is Part of the ZEngine Library for 2D game development.
 | 
				
			||||||
                   Copyright (C) 2002, 2003 James Turk
 | 
					                  Copyright (C) 2002-2004 James Turk
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                     Licensed under a BSD-style license.
 | 
					                     Licensed under a BSD-style license.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,16 +8,6 @@
 | 
				
			||||||
     and the home of this Library is http://www.zengine.sourceforge.net
 | 
					     and the home of this Library is http://www.zengine.sourceforge.net
 | 
				
			||||||
*******************************************************************************/
 | 
					*******************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*!
 | 
					 | 
				
			||||||
    \file ZE_Includes.h
 | 
					 | 
				
			||||||
    \brief Include file for SDL and C++ Includes that many ZEngine files need.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ZE_*.h files should only include this file and any other ZE_*.h files that they need, External Library or C/C++ Standard Library
 | 
					 | 
				
			||||||
    files should be included from within this file.
 | 
					 | 
				
			||||||
    $Id: ZE_Includes.h,v 1.21 2003/12/24 04:46:48 cozman Exp $<br>
 | 
					 | 
				
			||||||
    \author James Turk
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#ifndef __ze_includes_h__
 | 
					#ifndef __ze_includes_h__
 | 
				
			||||||
#define __ze_includes_h__
 | 
					#define __ze_includes_h__
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -45,6 +35,7 @@
 | 
				
			||||||
#include <list>     //used by ZConfigFile
 | 
					#include <list>     //used by ZConfigFile
 | 
				
			||||||
#include <fstream>  //used by ZConfigFile
 | 
					#include <fstream>  //used by ZConfigFile
 | 
				
			||||||
#include <cctype>   //used in parsing
 | 
					#include <cctype>   //used in parsing
 | 
				
			||||||
 | 
					#include <ctime>    //used in Randgen
 | 
				
			||||||
#include <cstdarg>  //used in FormatStr
 | 
					#include <cstdarg>  //used in FormatStr
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif //__ze_includes_h__
 | 
					#endif //__ze_includes_h__
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
/*******************************************************************************
 | 
					/*******************************************************************************
 | 
				
			||||||
        This file is Part of the ZEngine Library for 2D game development.
 | 
					        This file is Part of the ZEngine Library for 2D game development.
 | 
				
			||||||
                   Copyright (C) 2002, 2003 James Turk
 | 
					                  Copyright (C) 2002-2004 James Turk
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                     Licensed under a BSD-style license.
 | 
					                     Licensed under a BSD-style license.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,17 +8,6 @@
 | 
				
			||||||
     and the home of this Library is http://www.zengine.sourceforge.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.
 | 
					 | 
				
			||||||
    <br>$Id: ZE_Utility.h,v 1.10 2003/11/24 02:02:25 cozman Exp $<br>
 | 
					 | 
				
			||||||
    \author James Turk
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#ifndef __ze_utility_h__
 | 
					#ifndef __ze_utility_h__
 | 
				
			||||||
#define __ze_utility_h__
 | 
					#define __ze_utility_h__
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -27,65 +16,23 @@
 | 
				
			||||||
namespace ZE
 | 
					namespace ZE
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*! 
 | 
					std::string FormatStr(std::string fmtStr, ...);
 | 
				
			||||||
    \brief Parses a std::string and interprets variable arguments, similar to sprintf.
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Takes % identifiers out of fmtstr and parses them, replacing them with cooresponding values 
 | 
					 | 
				
			||||||
    in the variable arguments list.  For more detail view stdarg documentation.
 | 
					 | 
				
			||||||
    \param fmtstr defines format of resulting std::string
 | 
					 | 
				
			||||||
    \param ... variable number of arguments after fmtstr
 | 
					 | 
				
			||||||
    \return std::string of parsed and combined std::string
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
std::string FormatStr(const std::string fmtstr, ...);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*!
 | 
					 | 
				
			||||||
    \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
 | 
					 | 
				
			||||||
    to load a resource from memory.
 | 
					 | 
				
			||||||
    Used internally, generally shouldn't be called by users.
 | 
					 | 
				
			||||||
    \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
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
SDL_RWops* RWFromZip(std::string zipname, std::string filename);
 | 
					SDL_RWops* RWFromZip(std::string zipname, std::string filename);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*!
 | 
					#if (GFX_BACKEND == ZE_OGL)
 | 
				
			||||||
    \brief Properly free SDL_Surface. 
 | 
					int PowerOfTwo(int num);
 | 
				
			||||||
 | 
					GLuint SurfaceToTexture(SDL_Surface *surface, GLfloat *texcoord);
 | 
				
			||||||
 | 
					#endif //GFX_BACKEND
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Safely free an SDL_Surface* and set it to NULL.
 | 
					 | 
				
			||||||
    \param image Image to free and set to NULL.
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
void FreeImage(SDL_Surface *&image);
 | 
					void FreeImage(SDL_Surface *&image);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef USE_SDL_MIXER
 | 
					#ifdef USE_SDL_MIXER
 | 
				
			||||||
 | 
					 | 
				
			||||||
/*!
 | 
					 | 
				
			||||||
    \brief Properly free Mix_Chunk. 
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    Safely free a Mix_Chunk* and set it to NULL.
 | 
					 | 
				
			||||||
    \param chunk Chunk to free and set to NULL.
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
void FreeSound(Mix_Chunk *&chunk);
 | 
					void FreeSound(Mix_Chunk *&chunk);
 | 
				
			||||||
 | 
					 | 
				
			||||||
/*!
 | 
					 | 
				
			||||||
    \brief Properly free Mix_Music.
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    Safely free a Mix_Music* and set it to NULL.
 | 
					 | 
				
			||||||
    \param music Music to free and set to NULL.
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
void FreeMusic(Mix_Music *&music);
 | 
					void FreeMusic(Mix_Music *&music);
 | 
				
			||||||
 | 
					 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef USE_SDL_TTF
 | 
					#ifdef USE_SDL_TTF
 | 
				
			||||||
/*!
 | 
					 | 
				
			||||||
    \brief Properly free TTF_Font. 
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    Safely free a TTF_Font* and set it to NULL.
 | 
					 | 
				
			||||||
    \param font Font to free and set to NULL.
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
void FreeFont(TTF_Font *&font);
 | 
					void FreeFont(TTF_Font *&font);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
/*******************************************************************************
 | 
					/*******************************************************************************
 | 
				
			||||||
        This file is Part of the ZEngine Library for 2D game development.
 | 
					        This file is Part of the ZEngine Library for 2D game development.
 | 
				
			||||||
                   Copyright (C) 2002, 2003 James Turk
 | 
					                  Copyright (C) 2002-2004 James Turk
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                     Licensed under a BSD-style license.
 | 
					                     Licensed under a BSD-style license.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,15 +8,6 @@
 | 
				
			||||||
     and the home of this Library is http://www.zengine.sourceforge.net
 | 
					     and the home of this Library is http://www.zengine.sourceforge.net
 | 
				
			||||||
*******************************************************************************/
 | 
					*******************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*!
 | 
					 | 
				
			||||||
    \file ZE_ZAnimation.h
 | 
					 | 
				
			||||||
    \brief Definition file for ZAnimation.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Definition file for ZAnimation, a class for animations using ZImage.
 | 
					 | 
				
			||||||
    <br>$Id: ZE_ZAnimation.h,v 1.2 2003/12/24 04:46:48 cozman Exp $<br>
 | 
					 | 
				
			||||||
    \author James Turk
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#ifndef __ze_zanimation_h__
 | 
					#ifndef __ze_zanimation_h__
 | 
				
			||||||
#define __ze_zanimation_h__
 | 
					#define __ze_zanimation_h__
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -38,138 +29,35 @@ enum ZAnimType
 | 
				
			||||||
class ZAnimation
 | 
					class ZAnimation
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    protected:
 | 
					    protected:
 | 
				
			||||||
        //! Pointer to ZEngine object.
 | 
					 | 
				
			||||||
        ZEngine *rEngine;
 | 
					        ZEngine *rEngine;
 | 
				
			||||||
        //! Pointer to dynamic array of images.
 | 
					 | 
				
			||||||
        ZImage *rAnimImages;
 | 
					        ZImage *rAnimImages;
 | 
				
			||||||
        //! Current frame.
 | 
					 | 
				
			||||||
        int rCurFrame;
 | 
					        int rCurFrame;
 | 
				
			||||||
        //! Number of frames in animation.
 | 
					 | 
				
			||||||
        int rNumFrames;
 | 
					        int rNumFrames;
 | 
				
			||||||
        //! Frame increment, will always be -1,0, or 1. 
 | 
					 | 
				
			||||||
        int rFrameStep;
 | 
					        int rFrameStep;
 | 
				
			||||||
        //! Delay between frames in ms.
 | 
					 | 
				
			||||||
        Uint32 rFrameDelay;
 | 
					        Uint32 rFrameDelay;
 | 
				
			||||||
        //! Time of next step.
 | 
					 | 
				
			||||||
        Uint32 rNextFrameTime;
 | 
					        Uint32 rNextFrameTime;
 | 
				
			||||||
        //! Behavior of animation.
 | 
					 | 
				
			||||||
        ZAnimType rAnimType;
 | 
					        ZAnimType rAnimType;
 | 
				
			||||||
        //! Boolean, true if image is to be run backwards, false otherwise.
 | 
					 | 
				
			||||||
        bool rBackwards;
 | 
					        bool rBackwards;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public:
 | 
					    public:
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Default constructor for ZAnimation.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Sets all members to default values.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        ZAnimation();
 | 
					        ZAnimation();
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Complete constructor for ZAnimation.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Assigns values of members to given arguments via call to Create.
 | 
					 | 
				
			||||||
            \param images Array of images for animation.  (Note: array is not copied)
 | 
					 | 
				
			||||||
            \param numFrames Number of images in array pointed to by 'images'
 | 
					 | 
				
			||||||
            \param frameDelay Delay (in milliseconds) between frames.
 | 
					 | 
				
			||||||
            \param type One of the ZAnimType enums that control what animation does after last frame is reached.
 | 
					 | 
				
			||||||
            \param backwards Boolean, true if image is to be run backwards, false otherwise (defaults to false).
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        ZAnimation(ZImage *images, int numFrames, Uint32 frameDelay, ZAnimType type, bool backwards=false);
 | 
					        ZAnimation(ZImage *images, int numFrames, Uint32 frameDelay, ZAnimType type, bool backwards=false);
 | 
				
			||||||
 | 
					        virtual ~ZAnimation();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief All-at-once function for setting up ZAnimation.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Calls SetAnimImages,SetFrameDelay,SetAnimType and SetAnimSize with passed parameters.
 | 
					 | 
				
			||||||
            \param images Array of images for animation.  (Note: array is not copied)
 | 
					 | 
				
			||||||
            \param numFrames Number of images in array pointed to by 'images'
 | 
					 | 
				
			||||||
            \param frameDelay Delay (in milliseconds) between frames.
 | 
					 | 
				
			||||||
            \param type One of the ZAnimType enums that control what animation does after last frame is reached.
 | 
					 | 
				
			||||||
            \param backwards Boolean, true if image is to be run backwards, false otherwise (defaults to false).
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Create(ZImage *images, int numFrames, Uint32 frameDelay, ZAnimType type, bool backwards=false);
 | 
					        void Create(ZImage *images, int numFrames, Uint32 frameDelay, ZAnimType type, bool backwards=false);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Sets images for animation.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Sets images for animation to use, should be array of images
 | 
					 | 
				
			||||||
            \param images Array of images for animation.  (Note: array is not copied)
 | 
					 | 
				
			||||||
            \param numFrames Number of images in array pointed to by 'images'
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void SetAnimImages(ZImage *images, int numFrames);
 | 
					        void SetAnimImages(ZImage *images, int numFrames);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Sets frame delay between images.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Set delay between images in milliseconds.
 | 
					 | 
				
			||||||
            \param frameDelay Delay (in milliseconds) between frames.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void SetFrameDelay(Uint32 frameDelay);
 | 
					        void SetFrameDelay(Uint32 frameDelay);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Sets behavior of animation after last frame is reached and direction of animation.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Sets behavior of animation after last frame as well as the initial direction of the animation.
 | 
					 | 
				
			||||||
            \param type One of the ZAnimType enums that control what animation does after last frame is reached.
 | 
					 | 
				
			||||||
            \param backwards Boolean, true if image is to be run backwards, false otherwise (defaults to false).
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void SetAnimType(ZAnimType type, bool backwards=false);
 | 
					        void SetAnimType(ZAnimType type, bool backwards=false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Resets animation.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Sets frame to first frame and pauses animation.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Reset();
 | 
					        void Reset();
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Starts animation.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Starts animation, this must once be called to begin animation.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Start();
 | 
					        void Start();
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Pauses animation.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Halts animation at current frame.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Pause();
 | 
					        void Pause();
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Sets displayed frame manually.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Sets displayed frame, uses bounds checking, also accepts negative indices.
 | 
					 | 
				
			||||||
            \param frame Frame to display.  In an animation with N frames, valid frames are 0 to N-1, and also -1 to -N
 | 
					 | 
				
			||||||
                    where negative indices work so that -1 is the last frame, -2 is the second to last, and so on.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void SetFrame(int frame);
 | 
					        void SetFrame(int frame);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Updates animation.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Updates the animation, changing the frame if needed.  This function should be called every frame
 | 
					 | 
				
			||||||
            so that the frame may be changed.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Update();
 | 
					        void Update();
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Draws current frame to screen.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Draws current frame to screen at given position, should be called every frame that animation is to be drawn.
 | 
					 | 
				
			||||||
            If stopped, draws first frame, if paused draws frame paused on.
 | 
					 | 
				
			||||||
            \param x X position for animation to be drawn at.
 | 
					 | 
				
			||||||
            \param y Y position for animation to be drawn at.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Draw(float x, float y) const;
 | 
					        void Draw(float x, float y) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /*!
 | 
					        bool IsRunning() const;
 | 
				
			||||||
            \brief Gets running status of animation.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Returns status of animation, running or halted.
 | 
					 | 
				
			||||||
            \return True if animation is running, false if it is paused or stopped.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        bool Running() const;
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
/*******************************************************************************
 | 
					/*******************************************************************************
 | 
				
			||||||
        This file is Part of the ZEngine Library for 2D game development.
 | 
					        This file is Part of the ZEngine Library for 2D game development.
 | 
				
			||||||
                   Copyright (C) 2002, 2003 James Turk
 | 
					                  Copyright (C) 2002-2004 James Turk
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                     Licensed under a BSD-style license.
 | 
					                     Licensed under a BSD-style license.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,16 +8,6 @@
 | 
				
			||||||
     and the home of this Library is http://www.zengine.sourceforge.net
 | 
					     and the home of this Library is http://www.zengine.sourceforge.net
 | 
				
			||||||
*******************************************************************************/
 | 
					*******************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*!
 | 
					 | 
				
			||||||
    \file ZE_ZBaseParticleSystem.h
 | 
					 | 
				
			||||||
    \brief Definition and implementation file for the base of the ZEngine Particle System.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Definition and implementation file for ZEngine particle system class ZBaseParticleSystem.
 | 
					 | 
				
			||||||
    Due to problems with template classes the template implementation needs to be in the same file as the declaration.
 | 
					 | 
				
			||||||
    <br>$Id: ZE_ZBaseParticleSystem.h,v 1.5 2003/07/12 01:25:42 cozman Exp $<br>
 | 
					 | 
				
			||||||
    \author James Turk
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#ifndef __ze_zbaseparticlesystem_h__
 | 
					#ifndef __ze_zbaseparticlesystem_h__
 | 
				
			||||||
#define __ze_zbaseparticlesystem_h__
 | 
					#define __ze_zbaseparticlesystem_h__
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -26,172 +16,50 @@
 | 
				
			||||||
namespace ZE
 | 
					namespace ZE
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*!
 | 
					 | 
				
			||||||
    \brief Basic particle class for ZEngine particle systems.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Basic particle class, all particles used should derive from this class so that needed members are available.
 | 
					 | 
				
			||||||
    (No default constructor is needed because NewParticle should initialize members.)
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
class ZBaseParticle
 | 
					class ZBaseParticle
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    public:      
 | 
					    public:      
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Virtual destructor.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Empty virtual destructor to make inheritance safe.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        virtual ~ZBaseParticle() 
 | 
					        virtual ~ZBaseParticle() 
 | 
				
			||||||
        {}  // empty definition here, since ZBaseParticleSystem has no cpp file and this would be all that would be in it
 | 
					        {}  // empty definition here, since ZBaseParticleSystem has no cpp file and this would be all that would be in it
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //! X Position of particle.
 | 
					 | 
				
			||||||
        float xPos;
 | 
					        float xPos;
 | 
				
			||||||
        //! Y Position of particle.
 | 
					 | 
				
			||||||
        float yPos;
 | 
					        float yPos;
 | 
				
			||||||
        //! Energy of particle (particles die if energy is 0).
 | 
					 | 
				
			||||||
        float energy;
 | 
					        float energy;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*!
 | 
					 | 
				
			||||||
    \brief Base particle system, a virtual class defining an outline for a fully functional particle system.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Virtual class providing outline of basic particle system, designed so that a working particle system can be
 | 
					 | 
				
			||||||
    derived with minimal waste.  Uses templated system to allow particle systems to work with their own types of 
 | 
					 | 
				
			||||||
    particles, the particleType template parameter must be a type that has the members of ZBaseParticle.
 | 
					 | 
				
			||||||
    (Note: If you need a very specific particle system it's probably best to write your own fit to your needs.)
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
template <class particleType>
 | 
					template <class particleType>
 | 
				
			||||||
class ZBaseParticleSystem
 | 
					class ZBaseParticleSystem
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    protected:
 | 
					    protected:
 | 
				
			||||||
        //! Pointer to ZEngine singleton.
 | 
					 | 
				
			||||||
        ZEngine *rEngine;
 | 
					        ZEngine *rEngine;
 | 
				
			||||||
        //! Pointer to array of particles.
 | 
					 | 
				
			||||||
        particleType *rParticles;
 | 
					        particleType *rParticles;
 | 
				
			||||||
        //! Maximum number of particles, and size of rParticles array.
 | 
					 | 
				
			||||||
        unsigned int rMaxParticles;
 | 
					        unsigned int rMaxParticles;
 | 
				
			||||||
        //! Current number of particles.
 | 
					 | 
				
			||||||
        unsigned int rCurParticles;
 | 
					        unsigned int rCurParticles;
 | 
				
			||||||
        //! Number of particles to release per second.
 | 
					 | 
				
			||||||
        unsigned int rNumParticlesPerSec;
 | 
					        unsigned int rNumParticlesPerSec;
 | 
				
			||||||
        //! Millisecond format time of last update.
 | 
					 | 
				
			||||||
        Uint32 rLastUpdate;
 | 
					        Uint32 rLastUpdate;
 | 
				
			||||||
        //! Boolean value indicating if system is paused.
 | 
					 | 
				
			||||||
        bool rPaused;
 | 
					        bool rPaused;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Adds a new particle.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Finds room in array with dead particle, and adds new particle using NewParticle, called by Emit.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void AddParticle();
 | 
					        void AddParticle();
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Pure virtual function to initialize and return a new particle.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Pure virtual function, overload should set up a new particle with desired traits, called by AddParticle.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        virtual particleType NewParticle()=0;
 | 
					        virtual particleType NewParticle()=0;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Pure virtual function to update a particle.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Pure virtual function, overload should update the particle `rParticles[index]`, called by Update.
 | 
					 | 
				
			||||||
            \param index Index of particle in rParticles array to update.
 | 
					 | 
				
			||||||
            \param elapsedTime Decimal portion of a second since last call.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        virtual void UpdateParticle(int index, float elapsedTime)=0;
 | 
					        virtual void UpdateParticle(int index, float elapsedTime)=0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public:
 | 
					    public:
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Basic constructor for ZBaseParticleSystem.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Basic constructor for ZBaseParticle system, initializes all values to 0.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        ZBaseParticleSystem();
 | 
					        ZBaseParticleSystem();
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Virtual destructor for ZBaseParticleSystem.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Virtual destructor for ZBaseParticleSystem, destroys all particles, virtual to make class inheritance-safe.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        virtual ~ZBaseParticleSystem();
 | 
					        virtual ~ZBaseParticleSystem();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Pure virtual function, renders the particles.
 | 
					 | 
				
			||||||
            
 | 
					 | 
				
			||||||
            Pure virtual so that each particle system can render it's member particles in it's own way.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        virtual void Render()=0;
 | 
					        virtual void Render()=0;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Emit a given number of particles.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Emits a given number of particles, will not emit particles if system is full.
 | 
					 | 
				
			||||||
            \param numParticles Number of particles to emit.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Emit(int numParticles);       
 | 
					        void Emit(int numParticles);       
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Updates status of particle system.
 | 
					 | 
				
			||||||
            
 | 
					 | 
				
			||||||
            Updates entire particle system, calling update on every particle, emitting necessary new
 | 
					 | 
				
			||||||
            particles, removing particles which have an energy <= 0 or are off the screen. Virtual for
 | 
					 | 
				
			||||||
            special cases, but generally should not be overridden.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        virtual void Update();
 | 
					        virtual void Update();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Empties particle system of all particles.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Empties particle system of all particles, does not alter paused state.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Clear();
 | 
					        void Clear();
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Pauses particle system.
 | 
					 | 
				
			||||||
            
 | 
					 | 
				
			||||||
            Pauses particle system, particles may still be drawn but particles are not updated.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Pause();
 | 
					        void Pause();
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Unpauses particle system.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Returns particle system to active state, system starts unpaused.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Unpause();
 | 
					        void Unpause();
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Clears system and pauses it.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Same as calling Clear() and then Pause(), use unpause to restart system.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Stop();
 | 
					        void Stop();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Detect if particle system is currently paused.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Returns bool indicating if the particle system is currently paused.
 | 
					 | 
				
			||||||
            \return true if paused, false if active
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        bool Paused();
 | 
					 | 
				
			||||||
                
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Sets max particles allowed in system.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Set maximum number of particles allowed in system, particles are not emitted when system is full.
 | 
					 | 
				
			||||||
            When this resizes the array contents are moved to the new array, if it shrinks the array particles may be lost.
 | 
					 | 
				
			||||||
            \param max Maximum number of particles for system.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void SetMaxParticles(unsigned int max);     
 | 
					        void SetMaxParticles(unsigned int max);     
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Sets release rate of particles.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Set number of particles to release per second.
 | 
					 | 
				
			||||||
            \param rate Number of particles to release over the duration of one second.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void SetRate(unsigned int rate);
 | 
					        void SetRate(unsigned int rate);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        bool IsPaused();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//implementation//
 | 
					//implementation//
 | 
				
			||||||
| 
						 | 
					@ -292,7 +160,7 @@ void ZBaseParticleSystem<particleType>::Stop()
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
template <class particleType>
 | 
					template <class particleType>
 | 
				
			||||||
bool ZBaseParticleSystem<particleType>::Paused()
 | 
					bool ZBaseParticleSystem<particleType>::IsPaused()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return rPaused;
 | 
					    return rPaused;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
/*******************************************************************************
 | 
					/*******************************************************************************
 | 
				
			||||||
        This file is Part of the ZEngine Library for 2D game development.
 | 
					        This file is Part of the ZEngine Library for 2D game development.
 | 
				
			||||||
                   Copyright (C) 2002, 2003 James Turk
 | 
					                  Copyright (C) 2002-2004 James Turk
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                     Licensed under a BSD-style license.
 | 
					                     Licensed under a BSD-style license.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,16 +8,6 @@
 | 
				
			||||||
     and the home of this Library is http://www.zengine.sourceforge.net
 | 
					     and the home of this Library is http://www.zengine.sourceforge.net
 | 
				
			||||||
*******************************************************************************/
 | 
					*******************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*!
 | 
					 | 
				
			||||||
    \file ZE_ZConfigFile.h
 | 
					 | 
				
			||||||
    \brief Definition file for ZConfigFile.
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    Definition file for ZConfigFile, an INI-style config file format.<br>
 | 
					 | 
				
			||||||
    $ id: ZE_ZConfigFile.h,v 1.9 2003/02/10 04:40:16 cozman Exp $
 | 
					 | 
				
			||||||
    \author James Turk
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#ifndef __ze_zconfigfile_h__
 | 
					#ifndef __ze_zconfigfile_h__
 | 
				
			||||||
#define __ze_zconfigfile_h__
 | 
					#define __ze_zconfigfile_h__
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -26,239 +16,52 @@
 | 
				
			||||||
namespace ZE
 | 
					namespace ZE
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*!
 | 
					 | 
				
			||||||
    \brief ZConfigFile Class for use in ZEngine.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ZConfigFile class for INI-style configuration files for games or applications.
 | 
					 | 
				
			||||||
    ZConfigFile can have comments using the semicolon (;) or octothorpe (#) characters.
 | 
					 | 
				
			||||||
    Sections are delimited by [section-name], and variables must start with a letter
 | 
					 | 
				
			||||||
    and should be in the format <var>variable = data</var>.
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
class ZConfigFile
 | 
					class ZConfigFile
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    private:
 | 
					    private:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //Private Types//
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief ZConfigFile Variable class.
 | 
					 | 
				
			||||||
            
 | 
					 | 
				
			||||||
            ZConfigFile class for mapping a variable name to it's value, stored in std::string form (later converted to 
 | 
					 | 
				
			||||||
            bool or int if needed).
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        class ZCF_Variable
 | 
					        class ZCF_Variable
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            public:
 | 
					            public:
 | 
				
			||||||
                //! Variable name.
 | 
					 | 
				
			||||||
                std::string var;
 | 
					                std::string var;
 | 
				
			||||||
                //! Value associated with variable.
 | 
					 | 
				
			||||||
                std::string val;
 | 
					                std::string val;
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief ZConfigFile Section class.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            ZConfigFile class for mapping a section name to a list of variables in that section.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        class ZCF_Section
 | 
					        class ZCF_Section
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            public:
 | 
					            public:
 | 
				
			||||||
                //! Section name.
 | 
					 | 
				
			||||||
                std::string section;
 | 
					                std::string section;
 | 
				
			||||||
                //! STL list of variables.
 | 
					 | 
				
			||||||
                std::list<ZCF_Variable> varList;
 | 
					                std::list<ZCF_Variable> varList;
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    protected:
 | 
					    protected:
 | 
				
			||||||
        //! List of sections of internal type.
 | 
					 | 
				
			||||||
        std::list<ZCF_Section> rFileLayout;
 | 
					        std::list<ZCF_Section> rFileLayout;
 | 
				
			||||||
        //! Filename of file currently open.
 | 
					 | 
				
			||||||
        std::string rFilename;
 | 
					        std::string rFilename;
 | 
				
			||||||
     
 | 
					     
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Reformat a std::string in a form more suitable to parsing.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Removes whitespace from a std::string and makes all characters lowercase.
 | 
					 | 
				
			||||||
            \param str The std::string to get a clean version of.
 | 
					 | 
				
			||||||
            \return Cleaned std::string.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        std::string CleanString(std::string str)  const;      
 | 
					        std::string CleanString(std::string str)  const;      
 | 
				
			||||||
        
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Check if a section exists.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Find out if a section currently exists.
 | 
					 | 
				
			||||||
            \param sec Section to check for.
 | 
					 | 
				
			||||||
            \return bool, true if section exists in file.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        bool Exists(std::string sec) const;
 | 
					        bool Exists(std::string sec) const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Check if a variable exists.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Find out if a variable currently exists.
 | 
					 | 
				
			||||||
            \param sec Section to check in.
 | 
					 | 
				
			||||||
            \param var Variable to check for.
 | 
					 | 
				
			||||||
            \return bool, true if section exists in file.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        bool Exists(std::string sec, std::string var) const;
 | 
					        bool Exists(std::string sec, std::string var) const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Internal function to set variables.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Set variable to value, called internally only.
 | 
					 | 
				
			||||||
            \param sec Section for variable.
 | 
					 | 
				
			||||||
            \param var Variable to set.
 | 
					 | 
				
			||||||
            \param val Value to set variable to.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void SetVariable(std::string sec, std::string var, std::string val);
 | 
					        void SetVariable(std::string sec, std::string var, std::string val);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Internal function to get value of a variable.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Get value of variable, called internally only.
 | 
					 | 
				
			||||||
            \param sec Section for variable.
 | 
					 | 
				
			||||||
            \param var Variable to get.
 | 
					 | 
				
			||||||
            \param defVal Value to return if variable doesnt exist.
 | 
					 | 
				
			||||||
            \return Value of variable.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        std::string GetVariable(std::string sec, std::string var, std::string defVal) const;
 | 
					        std::string GetVariable(std::string sec, std::string var, std::string defVal) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public:     
 | 
					    public:     
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Default constructor.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            A no-op default constructor.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        ZConfigFile();
 | 
					        ZConfigFile();
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Constructor which takes filename.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Constructor takes filename, and calls process on it.
 | 
					 | 
				
			||||||
            \param filename File to load as ZConfigFile.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        ZConfigFile(std::string filename);
 | 
					        ZConfigFile(std::string filename);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Destructor, flushes file.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Flushes the file, ensures a flush if the file is left open.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        virtual ~ZConfigFile();
 | 
					        virtual ~ZConfigFile();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Parse a file.
 | 
					 | 
				
			||||||
            
 | 
					 | 
				
			||||||
            Parses the file, reading the contents into the fileLayout map.
 | 
					 | 
				
			||||||
            \param filename File to parse and attach this ZDataFile to.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Process(std::string filename);
 | 
					        void Process(std::string filename);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Get value in floating point format from file.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Get the current value of a variable in the file, or defVal if not found in file.
 | 
					 | 
				
			||||||
            \since 0.8.3
 | 
					 | 
				
			||||||
            \param section Name of section to seek variable under.
 | 
					 | 
				
			||||||
            \param var Name of variable to seek value for.
 | 
					 | 
				
			||||||
            \param defVal Value to return if var does not exist within section.
 | 
					 | 
				
			||||||
            \return Contents of the variable in floating point format.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        float GetFloat(std::string section, std::string var, float defVal) const;
 | 
					        float GetFloat(std::string section, std::string var, float defVal) const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Get value in integer format from file.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Get the current value of a variable in the file, or defVal if not found in file.
 | 
					 | 
				
			||||||
            \param section Name of section to seek variable under.
 | 
					 | 
				
			||||||
            \param var Name of variable to seek value for.
 | 
					 | 
				
			||||||
            \param defVal Value to return if var does not exist within section.
 | 
					 | 
				
			||||||
            \return Contents of the variable in integer format.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        int GetInt(std::string section, std::string var, int defVal) const;
 | 
					        int GetInt(std::string section, std::string var, int defVal) const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Get value in boolean format from file.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Get the current value of a variable in the file, or defVal if not found in file. 
 | 
					 | 
				
			||||||
            (Valid values are "0","1","true" and "false")
 | 
					 | 
				
			||||||
            \param section Name of section to seek variable under.
 | 
					 | 
				
			||||||
            \param var Name of variable to seek value for.
 | 
					 | 
				
			||||||
            \param defVal Value to return if var does not exist within section.
 | 
					 | 
				
			||||||
            \return Contents of the variable in boolean format.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        bool GetBool(std::string section, std::string var, bool defVal) const;
 | 
					        bool GetBool(std::string section, std::string var, bool defVal) const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Get value in std::string format from file.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Get the current value of a variable in the file, or defVal if not found in file. 
 | 
					 | 
				
			||||||
            \param section Name of section to seek variable under.
 | 
					 | 
				
			||||||
            \param var Name of variable to seek value for.
 | 
					 | 
				
			||||||
            \param defVal Value to return if var does not exist within section.
 | 
					 | 
				
			||||||
            \return Contents of the variable in std::string format.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        std::string GetString(std::string section, std::string var, std::string defVal) const;
 | 
					        std::string GetString(std::string section, std::string var, std::string defVal) const;
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Set value in floating point format in file.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Set the new value of a variable in the file to val, creating the section and variable 
 | 
					 | 
				
			||||||
            if not already found in file. 
 | 
					 | 
				
			||||||
            \since 0.8.3
 | 
					 | 
				
			||||||
            \param section Name of section to edit variable under.
 | 
					 | 
				
			||||||
            \param var Name of variable to set value for.
 | 
					 | 
				
			||||||
            \param val Floating point value to set variable to in file.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void SetFloat(std::string section, std::string var, float val);
 | 
					        void SetFloat(std::string section, std::string var, float val);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Set value in integer format in file.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Set the new value of a variable in the file to val, creating the section and variable 
 | 
					 | 
				
			||||||
            if not already found in file. 
 | 
					 | 
				
			||||||
            \param section Name of section to edit variable under.
 | 
					 | 
				
			||||||
            \param var Name of variable to set value for.
 | 
					 | 
				
			||||||
            \param val Integer value to set variable to in file.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void SetInt(std::string section, std::string var, int val);
 | 
					        void SetInt(std::string section, std::string var, int val);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Set value in boolean format in file.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Set the new value of a variable in the file to val, creating the section and variable 
 | 
					 | 
				
			||||||
            if not already found in file.
 | 
					 | 
				
			||||||
            \param section Name of section to edit variable under.
 | 
					 | 
				
			||||||
            \param var Name of variable to set value for.
 | 
					 | 
				
			||||||
            \param val Boolean value to set variable to in file.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void SetBool(std::string section, std::string var, bool val);
 | 
					        void SetBool(std::string section, std::string var, bool val);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Set value in std::string format in file.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Set the new value of a variable in the file to val, creating the section and variable 
 | 
					 | 
				
			||||||
            if not already found in file.
 | 
					 | 
				
			||||||
            \param section Name of section to edit variable under.
 | 
					 | 
				
			||||||
            \param var Name of variable to set value for.
 | 
					 | 
				
			||||||
            \param val String value to set variable to in file.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void SetString(std::string section, std::string var, std::string val);
 | 
					        void SetString(std::string section, std::string var, std::string val);
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Write all values to file
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Writes all values and sections to file.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Flush();
 | 
					        void Flush();
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Close the file.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Flush the file and clear the filename.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Close();
 | 
					        void Close();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
/*******************************************************************************
 | 
					/*******************************************************************************
 | 
				
			||||||
        This file is Part of the ZEngine Library for 2D game development.
 | 
					        This file is Part of the ZEngine Library for 2D game development.
 | 
				
			||||||
                   Copyright (C) 2002, 2003 James Turk
 | 
					                  Copyright (C) 2002-2004 James Turk
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                     Licensed under a BSD-style license.
 | 
					                     Licensed under a BSD-style license.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,15 +8,6 @@
 | 
				
			||||||
     and the home of this Library is http://www.zengine.sourceforge.net
 | 
					     and the home of this Library is http://www.zengine.sourceforge.net
 | 
				
			||||||
*******************************************************************************/
 | 
					*******************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*!
 | 
					 | 
				
			||||||
    \file ZE_ZEngine.h
 | 
					 | 
				
			||||||
    \brief Definition file for core ZEngine class.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ZEngine Game Engine core Engine definition.
 | 
					 | 
				
			||||||
    <br>$Id: ZE_ZEngine.h,v 1.57 2003/12/24 04:46:48 cozman Exp $<br>
 | 
					 | 
				
			||||||
    \author James Turk
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#ifndef __ze_zengine_h__
 | 
					#ifndef __ze_zengine_h__
 | 
				
			||||||
#define __ze_zengine_h__
 | 
					#define __ze_zengine_h__
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -26,11 +17,6 @@
 | 
				
			||||||
#include "ZE_ZRandGen.h"
 | 
					#include "ZE_ZRandGen.h"
 | 
				
			||||||
#include "VersionInfo.h"
 | 
					#include "VersionInfo.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*!
 | 
					 | 
				
			||||||
    \brief ZEngine Namespace.
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    Namespace for ZEngine classes and utility functions.
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
namespace ZE
 | 
					namespace ZE
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -53,630 +39,118 @@ enum ZErrorLogStyle
 | 
				
			||||||
    ZLOG_HTML
 | 
					    ZLOG_HTML
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
/*!
 | 
					 | 
				
			||||||
    \brief Main ZEngine Singleton Class
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ZEngine Singleton Class, accessible from anywhere in a ZEngine-based program by nature.  Controls core elements of program and does 
 | 
					 | 
				
			||||||
    majority of SDL and OpenGL wrapping.
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
class ZEngine
 | 
					class ZEngine
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    public:
 | 
					    public:
 | 
				
			||||||
        //! Static version information.
 | 
					 | 
				
			||||||
        static VersionInfo Version;
 | 
					        static VersionInfo Version;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private:        
 | 
					    private:        
 | 
				
			||||||
        //! Static Pointer to Instance of ZEngine for Singleton.
 | 
					 | 
				
			||||||
        static ZEngine *sInstance;
 | 
					        static ZEngine *sInstance;
 | 
				
			||||||
        //! Pointer to Display
 | 
					 | 
				
			||||||
        SDL_Surface *mScreen;
 | 
					        SDL_Surface *mScreen;
 | 
				
			||||||
        //! Fullscreen setting of Display
 | 
					 | 
				
			||||||
        bool mFullscreen;
 | 
					        bool mFullscreen;
 | 
				
			||||||
        //! If ZEngine display has been setup.
 | 
					 | 
				
			||||||
        bool mInitialized;
 | 
					        bool mInitialized;
 | 
				
			||||||
        //! Keep track of paused state of game.
 | 
					 | 
				
			||||||
        bool mPaused;
 | 
					        bool mPaused;
 | 
				
			||||||
        //! Keep track of if ZEngine should unpause on active event.
 | 
					 | 
				
			||||||
        bool mUnpauseOnActive;
 | 
					        bool mUnpauseOnActive;
 | 
				
			||||||
 | 
					 | 
				
			||||||
#ifdef DEPRECIATED
 | 
					 | 
				
			||||||
        Uint8 mDesiredFramerate;
 | 
					 | 
				
			||||||
#endif //DEPRECIATED
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        //! Time scheduled for next update (used for framerate locked movement).
 | 
					 | 
				
			||||||
        Uint32 mNextUpdate;
 | 
					        Uint32 mNextUpdate;
 | 
				
			||||||
        //! Keep track of time game was last paused.
 | 
					 | 
				
			||||||
        Uint32 mLastPause;
 | 
					        Uint32 mLastPause;
 | 
				
			||||||
        //! Keep track of total globally paused time.
 | 
					 | 
				
			||||||
        Uint32 mPausedTime;
 | 
					        Uint32 mPausedTime;
 | 
				
			||||||
        //! Keep track of last screen update time.
 | 
					 | 
				
			||||||
        Uint32 mLastTime;
 | 
					        Uint32 mLastTime;
 | 
				
			||||||
        //! Seconds per frame. (1/FPS)
 | 
					 | 
				
			||||||
        double mSecPerFrame;
 | 
					        double mSecPerFrame;
 | 
				
			||||||
        //! Keeps track of when engine thinks the images need to be reloaded (loss of focus in fullscreen).
 | 
					 | 
				
			||||||
        bool mNeedReload;
 | 
					        bool mNeedReload;
 | 
				
			||||||
        //! bool describing Active or Inactive State of Game
 | 
					 | 
				
			||||||
        bool mActive;
 | 
					        bool mActive;
 | 
				
			||||||
        //! bool for checking if a Quit event has been detected
 | 
					 | 
				
			||||||
        bool mQuit;
 | 
					        bool mQuit;
 | 
				
			||||||
        //! Pointer to array of Keys
 | 
					 | 
				
			||||||
        Uint8 *mKeyIsPressed;
 | 
					        Uint8 *mKeyIsPressed;
 | 
				
			||||||
        //! Array of keys, used by KeyPress
 | 
					 | 
				
			||||||
        bool mKeyPress[SDLK_LAST];
 | 
					        bool mKeyPress[SDLK_LAST];
 | 
				
			||||||
        //! X Position of Mouse
 | 
					 | 
				
			||||||
        int mMouseX;
 | 
					        int mMouseX;
 | 
				
			||||||
        //! Y Position of Mouse
 | 
					 | 
				
			||||||
        int mMouseY;
 | 
					        int mMouseY;
 | 
				
			||||||
        //! Mouse Button Information
 | 
					 | 
				
			||||||
        Uint8 mMouseB;
 | 
					        Uint8 mMouseB;
 | 
				
			||||||
        //! Error log style.
 | 
					 | 
				
			||||||
        ZErrorLogStyle mLogStyle;
 | 
					        ZErrorLogStyle mLogStyle;
 | 
				
			||||||
        //! C-style FILE* for error logging.
 | 
					 | 
				
			||||||
        std::FILE *mErrlog;
 | 
					        std::FILE *mErrlog;
 | 
				
			||||||
        //! Event filter, for users who need to process their own events.
 | 
					 | 
				
			||||||
        SDL_EventFilter mEventFilter;
 | 
					        SDL_EventFilter mEventFilter;
 | 
				
			||||||
        //! Random Generator for general use.
 | 
					 | 
				
			||||||
        ZRandGen mRandGen;
 | 
					        ZRandGen mRandGen;
 | 
				
			||||||
        //! TinyXML XML Document for ZRF (ZEngine Resource File).
 | 
					 | 
				
			||||||
        TiXmlDocument rZRF;
 | 
					        TiXmlDocument rZRF;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef USE_SDL_MIXER 
 | 
					#ifdef USE_SDL_MIXER 
 | 
				
			||||||
        //! Sound Initialized
 | 
					 | 
				
			||||||
        bool mSoundInitialized;
 | 
					        bool mSoundInitialized;
 | 
				
			||||||
        //! Sound Bitrate
 | 
					 | 
				
			||||||
        int mSoundRate;
 | 
					        int mSoundRate;
 | 
				
			||||||
        //! Stereo setting of Sound Subsystem
 | 
					 | 
				
			||||||
        bool mStereo;
 | 
					        bool mStereo;
 | 
				
			||||||
#endif 
 | 
					#endif 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /////////////////////////////////
 | 
					 | 
				
			||||||
    //Singleton + Memory Management//
 | 
					 | 
				
			||||||
    /////////////////////////////////
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Constructor for ZEngine.
 | 
					 | 
				
			||||||
            
 | 
					 | 
				
			||||||
            Initialize ZEngine values to defaults. (Private so that only one instance may be created.)
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        ZEngine();
 | 
					        ZEngine();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    //////////////////////
 | 
					 | 
				
			||||||
    //Resource Internals//
 | 
					 | 
				
			||||||
    //////////////////////
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        TiXmlElement* FindElement(std::string type, std::string id);
 | 
					        TiXmlElement* FindElement(std::string type, std::string id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public:
 | 
					    public:
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Get Instance.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Static function, returns pointer to instance of ZEngine, creating an instance if none exist.
 | 
					 | 
				
			||||||
            \return Instance to the ZEngine.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        static ZEngine* GetInstance();
 | 
					        static ZEngine* GetInstance();
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Release Instance.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Release memory held by instance of engine and closes window.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        static void ReleaseInstance();
 | 
					        static void ReleaseInstance();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    //////////////////
 | 
					 | 
				
			||||||
    //Initialization//
 | 
					 | 
				
			||||||
    //////////////////
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Create Display (window or fullscreen).
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Create a window or fullscreen display given the screen options, a title, icon, 
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            \param width Desired width of screen or window.
 | 
					 | 
				
			||||||
            \param height Desired height of screen or window.
 | 
					 | 
				
			||||||
            \param bpp Desired BPP for screen, generally use 8,16 or 32, pass -1 if you want ZEngine to guess the best choice.
 | 
					 | 
				
			||||||
            \param fullscreen A bool for fullscreen setting.
 | 
					 | 
				
			||||||
            \param soundRate Desired sound bitrate.
 | 
					 | 
				
			||||||
            \param stereo A bool for stereo setting.
 | 
					 | 
				
			||||||
            \param title Window Title.
 | 
					 | 
				
			||||||
            \param icon Path to Icon File.
 | 
					 | 
				
			||||||
            \return result of setting up the display, true if everything went ok, false if any setup failed (check GetLastError).
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        bool CreateDisplay(int width, int height, int bpp, bool fullscreen, std::string title="ZEngine Application", 
 | 
					        bool CreateDisplay(int width, int height, int bpp, bool fullscreen, std::string title="ZEngine Application", 
 | 
				
			||||||
            int soundRate=22050, bool stereo=false, std::string icon="");
 | 
					            int soundRate=22050, bool stereo=false, std::string icon="");
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Quit SDL and any Subsystems.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Shut down SDL (and SDL_ttf,SDL_mixer if necessary) You shouldn't ever have to call this, ReleaseInstance calls this for you.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void CloseDisplay();
 | 
					        void CloseDisplay();
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Toggle fullscreen/windowed mode.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Safely toggles fullscreen/windowed mode, generally toggling modes will bring the need to reload images so it will
 | 
					 | 
				
			||||||
            set the ImagesNeedReload state to true.
 | 
					 | 
				
			||||||
            \since 0.8.2
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void ToggleFullscreen();
 | 
					        void ToggleFullscreen();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /*!
 | 
					        SDL_Surface* Display();
 | 
				
			||||||
            \brief Check state of ZEngine.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Checks if ZEngine display has been properly setup.
 | 
					 | 
				
			||||||
            \since 0.8.2
 | 
					 | 
				
			||||||
            \return Boolean status of ZEngine, true if CreateDisplay has been successfully called, false if ZEngine has no display.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        bool Initialized();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /////////////////
 | 
					 | 
				
			||||||
    //Screen Access//
 | 
					 | 
				
			||||||
    /////////////////
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Allow access to Screen Surface.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Get pointer to screen SDL_Surface, allowing direct screen manipulation using SDL.
 | 
					 | 
				
			||||||
            \return Pointer to Display Surface.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        SDL_Surface *Display();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Update display contents.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Swap OpenGL buffers, and update screen, if a desired framerate is set it will delay to stay under that rate.
 | 
					 | 
				
			||||||
            Must be called every frame.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Update();
 | 
					        void Update();
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Clear screen to a certain color (Black by default).
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Clears a rectangle on screen to a color, defaults to solid black.
 | 
					 | 
				
			||||||
            \param red Red component (0-255) of new color.
 | 
					 | 
				
			||||||
            \param green Green component (0-255) of new color.
 | 
					 | 
				
			||||||
            \param blue Blue component (0-255) of new color.
 | 
					 | 
				
			||||||
            \param alpha Alpha component (0-255) of new color.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Clear(Uint8 red=0, Uint8 green=0, Uint8 blue=0, Uint8 alpha=255);
 | 
					        void Clear(Uint8 red=0, Uint8 green=0, Uint8 blue=0, Uint8 alpha=255);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if (GFX_BACKEND == ZE_OGL)       
 | 
					#if (GFX_BACKEND == ZE_OGL)       
 | 
				
			||||||
    /////////////////////////////
 | 
					 | 
				
			||||||
    //OpenGL Specific Functions//
 | 
					 | 
				
			||||||
    /////////////////////////////
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Setup OpenGL ortho mode.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Sets the OpenGL scaled orthographic mode, called once at beginning, no need to call
 | 
					 | 
				
			||||||
            unless you change the OpenGL mode manually.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void SetGL2D();
 | 
					        void SetGL2D();
 | 
				
			||||||
#endif //GFX_BACKEND
 | 
					#endif //GFX_BACKEND
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ////////////////////////////////////////////
 | 
					 | 
				
			||||||
    //Timer and Framerate Independent Movement//
 | 
					 | 
				
			||||||
    ////////////////////////////////////////////
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Sleep for a certain amount of time.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Freeze everything for given number of milliseconds.
 | 
					 | 
				
			||||||
            \param milliseconds Number of milliseconds to freeze.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Delay(Uint32 milliseconds);
 | 
					        void Delay(Uint32 milliseconds);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Get Global ZEngine time.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Get active time since ZEngine initialization in milliseconds, paused time doesn't count.
 | 
					 | 
				
			||||||
            \return Number of active milliseconds since initialization.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        Uint32 GetTime();
 | 
					        Uint32 GetTime();
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Pause ZEngine.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Pause ZEngine timer and all ZTimer objects that rely on ZEngine.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void PauseTimer();
 | 
					        void PauseTimer();
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Unpause ZEngine.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Unpause ZEngine timer and all ZTimer objects that rely on ZEngine.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void UnpauseTimer();
 | 
					        void UnpauseTimer();
 | 
				
			||||||
 | 
					        bool TimerIsPaused();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Get Seconds Per Frame.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Get double that describes the time passed between screen updates. (should be used for Framerate Independant Movement)
 | 
					 | 
				
			||||||
            \return Time between screen updates.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        double GetFrameTime();
 | 
					        double GetFrameTime();
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Get Frames Per Second.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Get double representing current (approximate) FPS.  This value is always the same as 1/GetFrameTime().
 | 
					 | 
				
			||||||
            \since 0.8.2
 | 
					 | 
				
			||||||
            \return Current Framerate.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        double GetFramerate();
 | 
					        double GetFramerate();
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
#ifdef DEPRECIATED
 | 
					 | 
				
			||||||
        void SetDesiredFramerate(Uint8 rate);
 | 
					 | 
				
			||||||
        Uint8 GetDesiredFramerate();
 | 
					 | 
				
			||||||
#endif //DEPRECIATED
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Check Engine Paused State.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Find out if engine timer is paused.
 | 
					 | 
				
			||||||
            \return Paused State of engine.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        bool IsPaused();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ////////////////////////////
 | 
					 | 
				
			||||||
    //Event and Input Handling//
 | 
					 | 
				
			||||||
    ////////////////////////////
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Find out if application is active.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Function to find out if application currently has focus.
 | 
					 | 
				
			||||||
            \return bool telling active/inactive state of application.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        bool IsActive();
 | 
					        bool IsActive();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Request A Quit.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Tell the engine that it should behave as if a Quit was requested, does not call 
 | 
					 | 
				
			||||||
            any shutdown functions.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void RequestQuit();
 | 
					        void RequestQuit();
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Find out if user has requested to quit.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Function to find out if user or operating system has requested program cease execution, can be 
 | 
					 | 
				
			||||||
            set by Alt-F4, SDL_Quit event or ZEngine::RequestQuit().
 | 
					 | 
				
			||||||
            \return bool telling if quit has been requested.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        bool QuitRequested();
 | 
					        bool QuitRequested();
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Set State of ImagesNeedReload.
 | 
					 | 
				
			||||||
            \param state False if images need to be reloaded, True if images have been reloaded.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void SetReloadNeed(bool state);
 | 
					        void SetReloadNeed(bool state);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Find out if images should be reloaded.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Function that is good to call every frame to check if images should be reloaded, usually only caused by loss of focus in 
 | 
					 | 
				
			||||||
            fullscreen.
 | 
					 | 
				
			||||||
            \return bool, True if images should be reloaded, false otherwise.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        bool ImagesNeedReload();
 | 
					        bool ImagesNeedReload();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Set Key repeat rate.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Calls SDL_EnableKeyRepeat(rate,rate) because usually this is the desired movement style for games. 0 to disable.
 | 
					 | 
				
			||||||
            If 2 different values are needed SDL_EnableKeyRepeat can be called separately: http://sdldoc.csn.ul.ie/sdlenablekeyrepeat.php.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            \param rate Desired key repeat rate.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void SetKeyRepeatRate(int rate);
 | 
					        void SetKeyRepeatRate(int rate);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Find the state of a key.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Function returns true/false based on if key is currently pressed or not.
 | 
					 | 
				
			||||||
            This is used when using keys as buttons, and you need to check if the button/key
 | 
					 | 
				
			||||||
            is currently pressed (ex. arrow keys).
 | 
					 | 
				
			||||||
            \param key Code of key to find status of.
 | 
					 | 
				
			||||||
            \return State of requested key.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        bool KeyIsPressed(SDLKey key);
 | 
					        bool KeyIsPressed(SDLKey key);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Find if key has been pressed since last check.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Function returns true/false based on if key has been pressed since last check.
 | 
					 | 
				
			||||||
            This is what is good to use if you are trying to get user input where a key is only 
 | 
					 | 
				
			||||||
            counted once per press. (ex. typing in a name for a high scores list)
 | 
					 | 
				
			||||||
            \param key Code of key to find status of.
 | 
					 | 
				
			||||||
            \return State of requested key.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        bool KeyPress(SDLKey key);
 | 
					        bool KeyPress(SDLKey key);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Hide mouse cursor.
 | 
					 | 
				
			||||||
            
 | 
					 | 
				
			||||||
            Hide the system mouse cursor.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void HideCursor();
 | 
					        void HideCursor();
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Show mouse cursor.
 | 
					 | 
				
			||||||
            
 | 
					 | 
				
			||||||
            Show the system mouse cursor.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void ShowCursor();
 | 
					        void ShowCursor();
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Get X Position of Mouse.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Find X Position of Mouse on screen.
 | 
					 | 
				
			||||||
            \return X Position of Mouse.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        int MouseX();
 | 
					        int MouseX();
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Get Y Position of Mouse.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Find Y Position of Mouse on screen.
 | 
					 | 
				
			||||||
            \return Y Position of Mouse.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        int MouseY();
 | 
					        int MouseY();
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Get Status of Left Button.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Get pressed status of left button of mouse.
 | 
					 | 
				
			||||||
            \return true if left button is pressed, false otherwise.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        bool LButtonPressed();
 | 
					        bool LButtonPressed();
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Get Status of Right Button.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Get pressed status of right button of mouse.
 | 
					 | 
				
			||||||
            \return true if right button is pressed, false otherwise.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        bool RButtonPressed();
 | 
					        bool RButtonPressed();
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Get status of Middle Button.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Get pressed status of middle button if available.
 | 
					 | 
				
			||||||
            \return true if middle button is pressed, false if it is not or if it does not exist.
 | 
					 | 
				
			||||||
            \since 0.8.5
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        bool MButtonPressed();
 | 
					        bool MButtonPressed();
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Check if mouse is in given rectangle.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Return status of mouse in current rectangle (eg. GUI buttons).
 | 
					 | 
				
			||||||
            \param rect Rectangle to check if mouse is in.
 | 
					 | 
				
			||||||
            \return true if mouse is in rectangle, false otherwise
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        bool MouseInRect(const SDL_Rect &rect);
 | 
					        bool MouseInRect(const SDL_Rect &rect);
 | 
				
			||||||
 | 
					        bool MouseInRect(const ZRect &rect);
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Check if mouse is in given rectangle.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Return status of mouse in current rectangle (eg. GUI buttons).
 | 
					 | 
				
			||||||
            \param rect Rectangle to check if mouse is in.
 | 
					 | 
				
			||||||
            \return true if mouse is in rectangle, false otherwise
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        bool MouseInRect(ZRect rect);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Check for Activation, Window Manager, and Quit Events.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Cycle through event queue, processing events, updating all Event Related variables, should be called once per frame.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void CheckEvents();
 | 
					        void CheckEvents();
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Add a SDL Event Filter for user processing of events.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            This is only needed when you need tight control with ZEngine.  The parameter processed as if it were passed to 
 | 
					 | 
				
			||||||
            SDL_SetEventFilter, generally only those with a good amount of SDL experience should use this function or 
 | 
					 | 
				
			||||||
            ZEngine's internal message state could be corrupted.  For more information on SDL_SetEventFilter see 
 | 
					 | 
				
			||||||
            http://sdldoc.csn.ul.ie/sdlseteventfilter.php.  (FYI: The parameter is now actually processed in check events, 
 | 
					 | 
				
			||||||
            not passed to the SDL function, this is done because of problems with singletons and event threading.)
 | 
					 | 
				
			||||||
            \since 0.8.2
 | 
					 | 
				
			||||||
            \param filter An SDL_EventFilter (A function that takes a const SDL_Event* and returns 0 if the event should be removed from 
 | 
					 | 
				
			||||||
            the event queue and 1 otherwise.)
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void SetEventFilter(SDL_EventFilter filter);
 | 
					        void SetEventFilter(SDL_EventFilter filter);
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
    /////////////////
 | 
					 | 
				
			||||||
    //Error Logging//
 | 
					 | 
				
			||||||
    /////////////////
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public:
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Modify Error Logging.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Change the way errors are logged and the file they are logged to, before calling this errors are logged to stderr.
 | 
					 | 
				
			||||||
            (SDL may define stderr.txt on some platforms.)
 | 
					 | 
				
			||||||
            \since 0.8.6
 | 
					 | 
				
			||||||
            \param logFile Name of file to use as log, passing in stderr or stdio will set the log to the respective C stream.
 | 
					 | 
				
			||||||
            Passing in nothing will not change the current error log file, which defaults to stderr.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void SetErrorLog(ZErrorLogStyle logStyle, std::string logFile);
 | 
					        void SetErrorLog(ZErrorLogStyle logStyle, std::string logFile);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        void DisableErrorLog();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Report an error.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Adds the error to the the error queue, and sets the current error to this error.
 | 
					 | 
				
			||||||
            \since 0.8.2
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void ReportError(ZErrorSeverity type, std::string desc="", ...);        
 | 
					        void ReportError(ZErrorSeverity type, std::string desc="", ...);        
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Write to the log.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Write a std::string to the log, allowing special usage of the error log.
 | 
					 | 
				
			||||||
            \since 0.8.2
 | 
					 | 
				
			||||||
            \param str String to write to log file.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void WriteLog(std::string str, ...);
 | 
					        void WriteLog(std::string str, ...);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ////////////////////////////
 | 
					 | 
				
			||||||
    //Random Number Generation//
 | 
					 | 
				
			||||||
    ////////////////////////////
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Seed random number generator. 
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Reseed Mersenne Twister random number generator.  NOTE: Generator is initialized upon creation of object using time.
 | 
					 | 
				
			||||||
            \param seed Seed for random sequence.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void SeedRandGen(unsigned long seed);
 | 
					        void SeedRandGen(unsigned long seed);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Obtain random integer [0,max).
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Obtain random int l where 0 <= l < max.
 | 
					 | 
				
			||||||
            \param max Limit for random number.
 | 
					 | 
				
			||||||
            \return Random unsigned int.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        unsigned int Rand(unsigned int max);
 | 
					        unsigned int Rand(unsigned int max);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Obtain random integer [0,max).
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Obtain random long l where 0 <= l < max.
 | 
					 | 
				
			||||||
            \param max Limit for random number.
 | 
					 | 
				
			||||||
            \return Random unsigned long.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        unsigned long Rand(unsigned long max);
 | 
					        unsigned long Rand(unsigned long max);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Obtain random integer [min,max].
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Obtain random int l where min <= l <= max.
 | 
					 | 
				
			||||||
            \param min Lower limit for random number.
 | 
					 | 
				
			||||||
            \param max Upper limit for random number.
 | 
					 | 
				
			||||||
            \return Random int.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        int Rand(int min, int max);
 | 
					        int Rand(int min, int max);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Obtain random integer [min,max].
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Obtain random long l where min <= l <= max.
 | 
					 | 
				
			||||||
            \param min Lower limit for random number.
 | 
					 | 
				
			||||||
            \param max Upper limit for random number.
 | 
					 | 
				
			||||||
            \return Random long.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        long Rand(long min, long max);
 | 
					        long Rand(long min, long max);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Obtain random integer [min,max].
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Obtain random float l where min <= l <= max.
 | 
					 | 
				
			||||||
            \param min Lower limit for random number.
 | 
					 | 
				
			||||||
            \param max Upper limit for random number.
 | 
					 | 
				
			||||||
            \return Random float.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        float Rand(float min, float max);
 | 
					        float Rand(float min, float max);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Obtain random integer [min,max].
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Obtain random double l where min <= l <= max.
 | 
					 | 
				
			||||||
            \param min Lower limit for random number.
 | 
					 | 
				
			||||||
            \param max Upper limit for random number.
 | 
					 | 
				
			||||||
            \return Random double.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        double Rand(double min, double max);        
 | 
					        double Rand(double min, double max);        
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Obtain random double [0,1).
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Obtain random double d where 0 <= d < 1.
 | 
					 | 
				
			||||||
            \return Random double [0,1).
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        double RandDouble();
 | 
					        double RandDouble();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    //////////////////
 | 
					 | 
				
			||||||
    //Resource Files//
 | 
					 | 
				
			||||||
    //////////////////
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Set resource file.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Set active XML ZEngine Resource File (ZRF).
 | 
					 | 
				
			||||||
            \param filename Filename of XML format resource file.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void SetResourceFile(std::string filename);
 | 
					        void SetResourceFile(std::string filename);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Get string data from resource file.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Get string data from active ZRF resource file set in SetResourceFile.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        std::string GetStringResource(std::string type, std::string id, std::string element);
 | 
					        std::string GetStringResource(std::string type, std::string id, std::string element);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Get numeric data from resource file.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Get numeric data from active ZRF resource file set in SetResourceFile, in integer format.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        int GetIntResource(std::string type, std::string id, std::string element);       
 | 
					        int GetIntResource(std::string type, std::string id, std::string element);       
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Get numeric data from resource file.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Get numeric data from active ZRF resource file set in SetResourceFile, in double format.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        double GetDoubleResource(std::string type, std::string id, std::string element);
 | 
					        double GetDoubleResource(std::string type, std::string id, std::string element);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        bool DisplayCreated();
 | 
				
			||||||
    /////////////
 | 
					 | 
				
			||||||
    //Accessors//
 | 
					 | 
				
			||||||
    /////////////
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Get current display width.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Get Width of Window or Fullscreen mode.
 | 
					 | 
				
			||||||
            \return Width of display.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        int DisplayWidth();
 | 
					        int DisplayWidth();
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Get current display height.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Get height of window or fullscreen mode.
 | 
					 | 
				
			||||||
            \return Height of display.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        int DisplayHeight();
 | 
					        int DisplayHeight();
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Get current display depth.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Get color depth of window or fullscreen mode.
 | 
					 | 
				
			||||||
            \return Color depth (bpp) of display.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        int DisplayDepth();
 | 
					        int DisplayDepth();
 | 
				
			||||||
 | 
					 | 
				
			||||||
#ifdef DEPRECIATED
 | 
					 | 
				
			||||||
        int Width();
 | 
					 | 
				
			||||||
        int Height();
 | 
					 | 
				
			||||||
        int BPP();
 | 
					 | 
				
			||||||
#endif //DEPRECIATED
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Get Fullscreen setting.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Get Fullscreen setting of Display.
 | 
					 | 
				
			||||||
            \return True if Fullscreen, False if Windowed
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        bool IsFullscreen();
 | 
					        bool IsFullscreen();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
/*******************************************************************************
 | 
					/*******************************************************************************
 | 
				
			||||||
        This file is Part of the ZEngine Library for 2D game development.
 | 
					        This file is Part of the ZEngine Library for 2D game development.
 | 
				
			||||||
                   Copyright (C) 2002, 2003 James Turk
 | 
					                  Copyright (C) 2002-2004 James Turk
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                     Licensed under a BSD-style license.
 | 
					                     Licensed under a BSD-style license.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,15 +8,6 @@
 | 
				
			||||||
     and the home of this Library is http://www.zengine.sourceforge.net
 | 
					     and the home of this Library is http://www.zengine.sourceforge.net
 | 
				
			||||||
*******************************************************************************/
 | 
					*******************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*!
 | 
					 | 
				
			||||||
    \file ZE_ZFont.h
 | 
					 | 
				
			||||||
    \brief Definition file for ZFont.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Definition file for ZFont, the basic Font class for ZEngine.
 | 
					 | 
				
			||||||
    <br>$Id: ZE_ZFont.h,v 1.17 2003/12/24 04:46:48 cozman Exp $<br>
 | 
					 | 
				
			||||||
    \author James Turk
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#ifndef __ze_zfont_h__
 | 
					#ifndef __ze_zfont_h__
 | 
				
			||||||
#define __ze_zfont_h__
 | 
					#define __ze_zfont_h__
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -28,219 +19,42 @@
 | 
				
			||||||
namespace ZE
 | 
					namespace ZE
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*!
 | 
					 | 
				
			||||||
    \brief ZFont class for basic Font use.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ZFont font container class, class wraps common features of SDL_TTF.
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
class ZFont
 | 
					class ZFont
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    protected:
 | 
					    protected:
 | 
				
			||||||
        //! Pointer to ZEngine Object
 | 
					 | 
				
			||||||
        ZEngine* rEngine;
 | 
					        ZEngine* rEngine;
 | 
				
			||||||
        //! Pointer to font data.
 | 
					 | 
				
			||||||
        TTF_Font *rFont;
 | 
					        TTF_Font *rFont;
 | 
				
			||||||
        //! Filename, for resizing.
 | 
					 | 
				
			||||||
        std::string rFilename;
 | 
					        std::string rFilename;
 | 
				
			||||||
        //! Zip filename, for resizing when file was from archive.
 | 
					 | 
				
			||||||
        std::string rZipname;
 | 
					        std::string rZipname;
 | 
				
			||||||
        //! SDL_Color for current text color.
 | 
					 | 
				
			||||||
        SDL_Color rColor;
 | 
					        SDL_Color rColor;
 | 
				
			||||||
        //! SDL_Color for background color to be used in shaded draws. 
 | 
					 | 
				
			||||||
        SDL_Color rBGColor;
 | 
					        SDL_Color rBGColor;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public:
 | 
					    public:
 | 
				
			||||||
 | 
					 | 
				
			||||||
        ///////////////////////
 | 
					 | 
				
			||||||
        //Opening and Closing//
 | 
					 | 
				
			||||||
        ///////////////////////
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Default Constructor.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Default Constructor, does nothing.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        ZFont();
 | 
					        ZFont();
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Constructor that opens a font with a certain size.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Constructor simply calls ZFont::Open() with same parameters.
 | 
					 | 
				
			||||||
            \param filename Font to open.
 | 
					 | 
				
			||||||
            \param size Size to use for font.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        ZFont(std::string filename, int size);
 | 
					        ZFont(std::string filename, int size);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Destructor, frees memory.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Destructor calls ZFont::Release().
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        virtual ~ZFont();
 | 
					        virtual ~ZFont();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Opens a font with a certain size.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Opens a font given a filename and a point size.
 | 
					 | 
				
			||||||
            \param filename Font to open.
 | 
					 | 
				
			||||||
            \param size Size to use for font.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Open(std::string filename, int size);
 | 
					        void Open(std::string filename, int size);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Opens a font from within a zip archive.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Open a font from within a zip archive using zlib and SDL_RWops.
 | 
					 | 
				
			||||||
            \param zipname Zip file to open image from.
 | 
					 | 
				
			||||||
            \param filename File to open as new image.
 | 
					 | 
				
			||||||
            \param size Size to use for font.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void OpenFromZip(std::string zipname, std::string filename, int size);
 | 
					        void OpenFromZip(std::string zipname, std::string filename, int size);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Opens a font file from the current ZEngine Resource File.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Open font file from the current ZEngine Resource File, the XML resource file set via ZEngine::SetResourceFile.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void OpenFromZRF(std::string resourceId);
 | 
					        void OpenFromZRF(std::string resourceId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Release font.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Release memory held by font. (Called by destructor).
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Release();
 | 
					        void Release();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ////////////////////////
 | 
					 | 
				
			||||||
        //Settings and Drawing//
 | 
					 | 
				
			||||||
        ////////////////////////
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Draws a std::string in a color to a ZImage.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Draw to a surface in specified color and associate that surface with a ZImage.
 | 
					 | 
				
			||||||
            \param text String to write.
 | 
					 | 
				
			||||||
            \param image ZImage to draw to.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void DrawText(std::string text, ZImage &image) const;
 | 
					        void DrawText(std::string text, ZImage &image) const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Draws a std::string with a colored background to a ZImage.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Draw to a surface a std::string with a background of rBGColor and lettering in the normal color and associate that surface with a ZImage.
 | 
					 | 
				
			||||||
            \param text String to write.
 | 
					 | 
				
			||||||
            \param image ZImage to draw to.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void DrawShadedText(std::string text, ZImage &image) const;
 | 
					        void DrawShadedText(std::string text, ZImage &image) const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Set Text rColor.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Set rColor of Text Output.
 | 
					 | 
				
			||||||
            \param r Red component of color (0-255).
 | 
					 | 
				
			||||||
            \param g Green component of color (0-255).
 | 
					 | 
				
			||||||
            \param b Blue component of color (0-255).
 | 
					 | 
				
			||||||
            \param a Alpha component of drawn font, including background if present. (0-255) (Optional, defaults to 255.)
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void SetColor(Uint8 r, Uint8 g, Uint8 b, Uint8 a=255);
 | 
					        void SetColor(Uint8 r, Uint8 g, Uint8 b, Uint8 a=255);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Set Background rColor.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Set rColor of Background for Shaded Draw.
 | 
					 | 
				
			||||||
            \param r Red component of color (0-255).
 | 
					 | 
				
			||||||
            \param g Green component of color (0-255).
 | 
					 | 
				
			||||||
            \param b Blue component of color (0-255).
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void SetBGColor(Uint8 r, Uint8 g, Uint8 b);
 | 
					        void SetBGColor(Uint8 r, Uint8 g, Uint8 b);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Set display format.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Set display format (bold, italic, underline).
 | 
					 | 
				
			||||||
            \param bold Decides bold setting of font.
 | 
					 | 
				
			||||||
            \param italic Decides italic setting of font.
 | 
					 | 
				
			||||||
            \param underline Decides underline setting of font.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void SetStyle(bool bold, bool italic, bool underline);      
 | 
					        void SetStyle(bool bold, bool italic, bool underline);      
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Resize Font.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Release and Reopen font in new size.
 | 
					 | 
				
			||||||
            \param size New size for font.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Resize(int size);
 | 
					        void Resize(int size);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /////////////
 | 
					 | 
				
			||||||
        //Accessors//
 | 
					 | 
				
			||||||
        /////////////
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Check if file is loaded.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Check if file is loaded and pointer to data is non-NULL.
 | 
					 | 
				
			||||||
            \return Loaded or Unloaded state of data.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        bool IsLoaded() const;
 | 
					        bool IsLoaded() const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Get Bold Setting.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Check if font output is currently bold.
 | 
					 | 
				
			||||||
            \return True or False state of bold.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        bool IsBold() const;
 | 
					        bool IsBold() const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Get Italic Setting.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Check if font output is currently italic.
 | 
					 | 
				
			||||||
            \return True or False state of italic.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        bool IsItalic() const;
 | 
					        bool IsItalic() const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Get Underlined Setting.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Check if font output is currently underline.
 | 
					 | 
				
			||||||
            \return True or False state of underline.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        bool IsUnderlined() const;
 | 
					        bool IsUnderlined() const;
 | 
				
			||||||
 | 
					        int GetHeight() const;
 | 
				
			||||||
        /*!
 | 
					        int GetLineSkip() const;
 | 
				
			||||||
            \brief Get Height of Font.
 | 
					        int CalcStringWidth(std::string text) const;
 | 
				
			||||||
 | 
					        int CalcStringHeight(std::string text) const;
 | 
				
			||||||
            Check font height as reported by SDL_ttf.
 | 
					 | 
				
			||||||
            \return Height of font.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        int Height() const;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Get Line Skip for Font.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Check font line skip as reported by SDL_ttf.
 | 
					 | 
				
			||||||
            \return Recommended Line Skip of font.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        int LineSkip() const;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Get String Width.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Get Width of String in Current Font in Pixels.
 | 
					 | 
				
			||||||
            \param text String to get width of.
 | 
					 | 
				
			||||||
            \return Width of String in Current font.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        int StringWidth(std::string text) const;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Get String Height.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Get Height of String in Current Font in Pixels.
 | 
					 | 
				
			||||||
            \param text String to get height of.
 | 
					 | 
				
			||||||
            \return Height of String in Current font.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        int StringHeight(std::string text) const;
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
/*******************************************************************************
 | 
					/*******************************************************************************
 | 
				
			||||||
        This file is Part of the ZEngine Library for 2D game development.
 | 
					        This file is Part of the ZEngine Library for 2D game development.
 | 
				
			||||||
                   Copyright (C) 2002, 2003 James Turk
 | 
					                  Copyright (C) 2002-2004 James Turk
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                     Licensed under a BSD-style license.
 | 
					                     Licensed under a BSD-style license.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,15 +8,6 @@
 | 
				
			||||||
     and the home of this Library is http://www.zengine.sourceforge.net
 | 
					     and the home of this Library is http://www.zengine.sourceforge.net
 | 
				
			||||||
*******************************************************************************/
 | 
					*******************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*!
 | 
					 | 
				
			||||||
    \file ZE_ZImage.h
 | 
					 | 
				
			||||||
    \brief Definition file for ZImage.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Definition file for ZImage, the ZImage class for ZEngine.
 | 
					 | 
				
			||||||
    <br>$Id: ZE_ZImage.h,v 1.30 2003/12/24 04:46:48 cozman Exp $<br>
 | 
					 | 
				
			||||||
    \author James Turk
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#ifndef __ze_zimage_h__
 | 
					#ifndef __ze_zimage_h__
 | 
				
			||||||
#define __ze_zimage_h__
 | 
					#define __ze_zimage_h__
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -26,435 +17,71 @@
 | 
				
			||||||
namespace ZE
 | 
					namespace ZE
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*!
 | 
					 | 
				
			||||||
    \brief ZImage class for basic Image use.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ZImage image drawing class, class wraps 2d textures under OpenGL or SDL_Surface under SDL.
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
class ZImage
 | 
					class ZImage
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    protected:
 | 
					    protected:
 | 
				
			||||||
        //! Pointer to ZEngine Object
 | 
					 | 
				
			||||||
        ZEngine* rEngine;
 | 
					        ZEngine* rEngine;
 | 
				
			||||||
        //! Stored texture.
 | 
					 | 
				
			||||||
        SDL_Surface *rImage;
 | 
					        SDL_Surface *rImage;
 | 
				
			||||||
        //! Stored alpha value for drawing texture.
 | 
					 | 
				
			||||||
        Uint8 rAlpha;
 | 
					        Uint8 rAlpha;
 | 
				
			||||||
#if (GFX_BACKEND == ZE_OGL)
 | 
					#if (GFX_BACKEND == ZE_OGL)
 | 
				
			||||||
        //! Texture lower X, used internally for flip.
 | 
					 | 
				
			||||||
        GLfloat rTexMinX;
 | 
					        GLfloat rTexMinX;
 | 
				
			||||||
        //! Texture lower Y, used internally for flip
 | 
					 | 
				
			||||||
        GLfloat rTexMinY;
 | 
					        GLfloat rTexMinY;
 | 
				
			||||||
        //! Texture X width ratio, used internally by OpenGL.
 | 
					 | 
				
			||||||
        GLfloat rTexMaxX;
 | 
					        GLfloat rTexMaxX;
 | 
				
			||||||
        //! Texture Y width ratio, used internally by OpenGL.
 | 
					 | 
				
			||||||
        GLfloat rTexMaxY;
 | 
					        GLfloat rTexMaxY;
 | 
				
			||||||
        //! Texture ID for OpenGL.
 | 
					 | 
				
			||||||
        unsigned int rTexID;
 | 
					        unsigned int rTexID;
 | 
				
			||||||
        //! Current draw width of Texture.
 | 
					 | 
				
			||||||
        GLfloat rWidth;
 | 
					        GLfloat rWidth;
 | 
				
			||||||
        //! Current draw height of Texture.
 | 
					 | 
				
			||||||
        GLfloat rHeight;
 | 
					        GLfloat rHeight;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Rounds a number up to the nearest power of two.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Rounds a number up to the next highest power of two, used for OpenGL textures. (From testgl.c)
 | 
					 | 
				
			||||||
            Used internally, generally shouldn't be called by users.
 | 
					 | 
				
			||||||
            \param in Number to round up.
 | 
					 | 
				
			||||||
            \return num rounded up to closest power of two.
 | 
					 | 
				
			||||||
            \since 0.8.6
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        int PowerOfTwo(int num) const;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Converts an SDL_Surface to an OpenGL texture ID.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Given an SDL_Surface returns a texture ID representing the OpenGL
 | 
					 | 
				
			||||||
            texture assigned to that surface.  Also returns texture coordinates
 | 
					 | 
				
			||||||
            via texcoord parameter. (From SDL_GL_LoadTexture in testgl.c)
 | 
					 | 
				
			||||||
            Used internally, generally shouldn't be called by users.
 | 
					 | 
				
			||||||
            \param surface SDL_Surface to assign an OpenGL ID, returns unmodified.
 | 
					 | 
				
			||||||
            \param texcoord Should be an array of 4 GLfloat, assigned texture coordinates for OpenGL use.
 | 
					 | 
				
			||||||
            \return OpenGL texture ID for SDL_Surface, 0 if an error occurs.
 | 
					 | 
				
			||||||
            \since 0.8.6
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        GLuint SurfaceToTexture(SDL_Surface *surface, GLfloat *texcoord) const;
 | 
					 | 
				
			||||||
#endif //GFX_BACKEND == OGL
 | 
					#endif //GFX_BACKEND == OGL
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    public:
 | 
					    public:
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Default Constructor.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Default Constructor, initializes variables.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        ZImage();
 | 
					        ZImage();
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Copy constructor for ZImage.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Creates one ZImage using another.
 | 
					 | 
				
			||||||
            \param rhs A previously created ZImage to copy.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        ZImage(const ZImage &rhs);
 | 
					        ZImage(const ZImage &rhs);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Constructor to Construct from File.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Constructor is same as calling ZImage::Open() on passed filename.
 | 
					 | 
				
			||||||
            \param filename File to open as rImage.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        ZImage(std::string filename);
 | 
					        ZImage(std::string filename);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Constructor to Construct from part of an SDL_Surface*.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Constructor is same as calling ZImage::OpenFromImage with an SDL_Surface*.
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
            \param img Image to take new image from.
 | 
					 | 
				
			||||||
            \param x X Coordinate in source of top left corner.
 | 
					 | 
				
			||||||
            \param y Y Coordinate in source of top left corner.
 | 
					 | 
				
			||||||
            \param w Width of new image.
 | 
					 | 
				
			||||||
            \param h Height of new image.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        ZImage(SDL_Surface *img, Sint16 x, Sint16 y, Sint16 w, Sint16 h);
 | 
					        ZImage(SDL_Surface *img, Sint16 x, Sint16 y, Sint16 w, Sint16 h);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Constructor to Construct from part of another ZImage.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Constructor is same as calling ZImage::OpenFromImage with a ZImage.
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
            \param img Image to take new image from.
 | 
					 | 
				
			||||||
            \param x X Coordinate in source of top left corner.
 | 
					 | 
				
			||||||
            \param y Y Coordinate in source of top left corner.
 | 
					 | 
				
			||||||
            \param w Width of new image.
 | 
					 | 
				
			||||||
            \param h Height of new image.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        ZImage(const ZImage &img, Sint16 x, Sint16 y, Sint16 w, Sint16 h);
 | 
					        ZImage(const ZImage &img, Sint16 x, Sint16 y, Sint16 w, Sint16 h);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Constructor to Construct from SDL_Surface*.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Constructor is same as calling ZImage::Attach() on passed SDL_Surface*.
 | 
					 | 
				
			||||||
            \param surface SDL_Surface* to use as rImage.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        ZImage(SDL_Surface *surface);
 | 
					        ZImage(SDL_Surface *surface);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Destructor, frees memory.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Destructor calls ZImage::Release().
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        virtual ~ZImage();
 | 
					        virtual ~ZImage();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ///////////////////////
 | 
					 | 
				
			||||||
        //Opening and Closing//
 | 
					 | 
				
			||||||
        ///////////////////////
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Opens a file.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Open an image file using ZEngine.
 | 
					 | 
				
			||||||
            \param filename File to open as new image.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Open(std::string filename);
 | 
					        void Open(std::string filename);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Opens an image file from within a zip archive.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Open an image file from within a zip archive using zlib and SDL_RWops.
 | 
					 | 
				
			||||||
            \param zipname Zip file to open image from.
 | 
					 | 
				
			||||||
            \param filename File to open as new image.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void OpenFromZip(std::string zipname, std::string filename);
 | 
					        void OpenFromZip(std::string zipname, std::string filename);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Opens an image file from the current ZEngine Resource File.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Open image file from the current ZEngine Resource File, the XML resource file set via ZEngine::SetResourceFile.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void OpenFromZRF(std::string resourceId);
 | 
					        void OpenFromZRF(std::string resourceId);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Cuts part of an existing image to create a new image.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Cut part of an SDL_Surface to create a new Image.
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
            \param img SDL_Surface* to take new image from.
 | 
					 | 
				
			||||||
            \param x X Coordinate in source of top left corner.
 | 
					 | 
				
			||||||
            \param y Y Coordinate in source of top left corner.
 | 
					 | 
				
			||||||
            \param w Width of new image.
 | 
					 | 
				
			||||||
            \param h Height of new image.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void OpenFromImage(SDL_Surface *img, Sint16 x, Sint16 y, Sint16 w, Sint16 h);
 | 
					        void OpenFromImage(SDL_Surface *img, Sint16 x, Sint16 y, Sint16 w, Sint16 h);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Cuts part of an existing ZImage to create a new image.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Cut part of another ZImage to create a new Image.
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
            \param img ZImage to take new image from.
 | 
					 | 
				
			||||||
            \param x X Coordinate in source of top left corner.
 | 
					 | 
				
			||||||
            \param y Y Coordinate in source of top left corner.
 | 
					 | 
				
			||||||
            \param w Width of new image.
 | 
					 | 
				
			||||||
            \param h Height of new image.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void OpenFromImage(const ZImage &img, Sint16 x, Sint16 y, Sint16 w, Sint16 h);
 | 
					        void OpenFromImage(const ZImage &img, Sint16 x, Sint16 y, Sint16 w, Sint16 h);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Attach an existing surface to class.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Attach a pointer to instance of ZImage. (NOTE: Should not be used on a surface that is owned elsewhere.)
 | 
					 | 
				
			||||||
            \param surface SDL_Surface* to use as rImage.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Attach(SDL_Surface *surface);
 | 
					        void Attach(SDL_Surface *surface);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Reattach a preloaded texture that has been lost.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Attach loaded textures which have been lost due to loss of focus, should be called when ZEngine::ImagesNeedReload is true.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Reload();
 | 
					        void Reload();
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Releases image.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Frees memory for the image. (Called by destructor).
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Release();
 | 
					        void Release();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ////////////
 | 
					 | 
				
			||||||
        //Graphics//
 | 
					 | 
				
			||||||
        ////////////
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Set alpha value (translucency) of image.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Set translucency value 0-255 (0 is transparent, 255 = opaque).
 | 
					 | 
				
			||||||
            \since 0.8.2
 | 
					 | 
				
			||||||
            \param alpha Number 0-255 setting translucency for image.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void SetAlpha(Uint8 alpha);
 | 
					        void SetAlpha(Uint8 alpha);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Set Color Key (transparent color) of image.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Set color which will not be drawn in image.
 | 
					 | 
				
			||||||
            \param red Red component of colorkey (0-255).
 | 
					 | 
				
			||||||
            \param green Green component of colorkey (0-255).
 | 
					 | 
				
			||||||
            \param blue Blue component of colorkey (0-255).
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void SetColorKey(Uint8 red, Uint8 green, Uint8 blue);
 | 
					        void SetColorKey(Uint8 red, Uint8 green, Uint8 blue);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Draw Image to Screen.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Draw Image to screen at specified location.
 | 
					 | 
				
			||||||
            \param x X coord to draw Image to.
 | 
					 | 
				
			||||||
            \param y Y coord to draw Image to.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Draw(int x, int y) const;
 | 
					        void Draw(int x, int y) const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Draw Image, clipped within a given rectangle to the screen.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Image is drawn such that only portions of image which fall within a certain area appear.  This clipping rectangle
 | 
					 | 
				
			||||||
            can be used for areas of the screen which are separated from others such as a splitscreen mode in a game or a 
 | 
					 | 
				
			||||||
            map on a HUD.
 | 
					 | 
				
			||||||
            \since 0.8.5
 | 
					 | 
				
			||||||
            \param x X coord to draw Image to.
 | 
					 | 
				
			||||||
            \param y Y coord to draw Image to.
 | 
					 | 
				
			||||||
            \param clipRect Rectangle to clip within.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void DrawClipped(int x, int y, ZRect clipRect) const;
 | 
					        void DrawClipped(int x, int y, ZRect clipRect) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if (GFX_BACKEND == ZE_OGL)
 | 
					#if (GFX_BACKEND == ZE_OGL)
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Draw Image to Screen.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Draw Image to screen at specified location.
 | 
					 | 
				
			||||||
            \since 0.8.3
 | 
					 | 
				
			||||||
            \param x X coord to draw Image to.
 | 
					 | 
				
			||||||
            \param y Y coord to draw Image to.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Draw(float x, float y) const;
 | 
					        void Draw(float x, float y) const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Draw Image to screen with shaded/colored vertices.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Draw Image to screen using OpenGL to shade and color vertices.
 | 
					 | 
				
			||||||
            \since 0.8.5
 | 
					 | 
				
			||||||
            \param x X coord to draw Image to.
 | 
					 | 
				
			||||||
            \param y Y coord to draw Image to.
 | 
					 | 
				
			||||||
            \param vc Uint8 vcolor[16] - Vertex colors for the four vertices.  
 | 
					 | 
				
			||||||
                Arranged so that vcolor[0],vcolor[1],vcolor[2],vcolor[3] - R,G,B,A (respectively) 
 | 
					 | 
				
			||||||
                of top left corner (after top-left corner goes around clockwise).
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Draw(float x, float y, Uint8 vc[]) const;
 | 
					        void Draw(float x, float y, Uint8 vc[]) const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Draw Image rotated to screen.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Image is rotated about it's own center by specified angle, then drawn to screen.
 | 
					 | 
				
			||||||
            \param x X coord to draw Image to.
 | 
					 | 
				
			||||||
            \param y Y coord to draw Image to.
 | 
					 | 
				
			||||||
            \param angle Angle in degrees to rotate image.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void DrawRotated(int x, int y, float angle) const;
 | 
					        void DrawRotated(int x, int y, float angle) const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Draw Image rotated to screen.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Image is rotated about it's own center by specified angle, then drawn to screen.
 | 
					 | 
				
			||||||
            \since 0.8.3
 | 
					 | 
				
			||||||
            \param x X coord to draw Image to.
 | 
					 | 
				
			||||||
            \param y Y coord to draw Image to.
 | 
					 | 
				
			||||||
            \param angle Angle in degrees to rotate image.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void DrawRotated(float x, float y, float angle) const;
 | 
					        void DrawRotated(float x, float y, float angle) const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Draw Image rotated to screen with shaded/colored vertices.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Image is rotated about it's own center by specified angle, then drawn to screen with shaded or colored vertices.
 | 
					 | 
				
			||||||
            \since 0.8.5
 | 
					 | 
				
			||||||
            \param x X coord to draw Image to.
 | 
					 | 
				
			||||||
            \param y Y coord to draw Image to.
 | 
					 | 
				
			||||||
            \param angle Angle in degrees to rotate image.
 | 
					 | 
				
			||||||
            \param vc Uint8 vcolor[16] - Vertex colors for the four vertices.  
 | 
					 | 
				
			||||||
                Arranged so that vcolor[0],vcolor[1],vcolor[2],vcolor[3] - R,G,B,A (respectively) 
 | 
					 | 
				
			||||||
                of top left corner (after top-left corner goes around clockwise).
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void DrawRotated(float x, float y, float angle, Uint8 vc[]) const;
 | 
					        void DrawRotated(float x, float y, float angle, Uint8 vc[]) const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Draw Image, clipped within a given rectangle to the screen.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Image is drawn such that only portions of image which fall within a certain area appear.  This clipping rectangle
 | 
					 | 
				
			||||||
            can be used for areas of the screen which are separated from others such as a splitscreen mode in a game or a 
 | 
					 | 
				
			||||||
            map on a HUD.
 | 
					 | 
				
			||||||
            \since 0.8.5
 | 
					 | 
				
			||||||
            \param x X coord to draw Image to.
 | 
					 | 
				
			||||||
            \param y Y coord to draw Image to.
 | 
					 | 
				
			||||||
            \param clipRect Rectangle to clip within.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void DrawClipped(float x, float y, ZRect clipRect) const;
 | 
					        void DrawClipped(float x, float y, ZRect clipRect) const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Draw Image, clipped within a given rectangle to the screen with colored/shaded vertices.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Image is drawn such that only portions of image which fall within a certain area appear.  This clipping rectangle
 | 
					 | 
				
			||||||
            can be used for areas of the screen which are separated from others such as a splitscreen mode in a game or a 
 | 
					 | 
				
			||||||
            map on a HUD.  Image is drawn with colored/shaded vertices.
 | 
					 | 
				
			||||||
            \since 0.8.5
 | 
					 | 
				
			||||||
            \param x X coord to draw Image to.
 | 
					 | 
				
			||||||
            \param y Y coord to draw Image to.
 | 
					 | 
				
			||||||
            \param clipRect Rectangle to clip within.
 | 
					 | 
				
			||||||
            \param vc Uint8 vcolor[16] - Vertex colors for the four vertices.  
 | 
					 | 
				
			||||||
                Arranged so that vcolor[0],vcolor[1],vcolor[2],vcolor[3] - R,G,B,A (respectively) 
 | 
					 | 
				
			||||||
                of top left corner (after top-left corner goes around clockwise).
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void DrawClipped(float x, float y, ZRect clipRect, Uint8 vc[]) const;
 | 
					        void DrawClipped(float x, float y, ZRect clipRect, Uint8 vc[]) const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Flip image over one or both axes.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Flip image vertical and/or horizontal.
 | 
					 | 
				
			||||||
            \param horizontal Boolean, true will flip image horizontally.
 | 
					 | 
				
			||||||
            \param vertical Boolean, true will flip image vertically.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Flip(bool horizontal, bool vertical);
 | 
					        void Flip(bool horizontal, bool vertical);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Stretch the image by a certain X and Y factor.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Stretch image using a factor to multiply width and height by.
 | 
					 | 
				
			||||||
            \param xFactor Stretch factor for width. [newWidth = oldWidth * xStretch]
 | 
					 | 
				
			||||||
            \param yFactor Stretch factor for height. [newHeight = oldHeight * yStretch]
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Stretch(float xFactor, float yFactor);
 | 
					        void Stretch(float xFactor, float yFactor);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Resizes an image, stretching to new size.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Stretch image to new width and height.
 | 
					 | 
				
			||||||
            \param width New width to stretch image to.
 | 
					 | 
				
			||||||
            \param height New height to stretch image to.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Resize(float width, float height);
 | 
					        void Resize(float width, float height);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief OpenGL related bind call.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            OpenGL related bind call, only available in case you want to bind image in 3D.
 | 
					 | 
				
			||||||
            Draw uses this but the average user should never need to call this.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Bind() const;
 | 
					        void Bind() const;
 | 
				
			||||||
#endif //GFX_BACKEND == OGL
 | 
					#endif //GFX_BACKEND == OGL
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /////////////
 | 
					 | 
				
			||||||
        //Accessors//
 | 
					 | 
				
			||||||
        /////////////
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Check if file is loaded.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Check if surface is a valid GL texture. (does not detect surface loss)
 | 
					 | 
				
			||||||
            \return Loaded or Unloaded state of data.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        bool IsLoaded() const;
 | 
					        bool IsLoaded() const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Get SDL_Surface.
 | 
					 | 
				
			||||||
            Get SDL_Surface pointer to actual image data.
 | 
					 | 
				
			||||||
            \return SDL_Surface* of rImage.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        SDL_Surface *Surface() const;
 | 
					        SDL_Surface *Surface() const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if (GFX_BACKEND == ZE_OGL)
 | 
					#if (GFX_BACKEND == ZE_OGL)
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Get Width.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Get Current Width of Image.
 | 
					 | 
				
			||||||
            \return Image Width.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        float Width() const;
 | 
					        float Width() const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Get Height.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Get Current Height of Image.
 | 
					 | 
				
			||||||
            \return Image Height.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        float Height() const;
 | 
					        float Height() const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
#elif (GFX_BACKEND == ZE_SDL)
 | 
					#elif (GFX_BACKEND == ZE_SDL)
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Get Width.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Get Current Width of Image.
 | 
					 | 
				
			||||||
            \return Image Width.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        int Width() const;
 | 
					        int Width() const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Get Height.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Get Current Height of Image.
 | 
					 | 
				
			||||||
            \return Image Height.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        int Height() const;
 | 
					        int Height() const;
 | 
				
			||||||
#endif //GFX_BACKEND
 | 
					#endif //GFX_BACKEND
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Get Alpha component.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Get current alpha value of image.
 | 
					 | 
				
			||||||
            \since 0.8.2
 | 
					 | 
				
			||||||
            \return Image Alpha.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        Uint8 Alpha() const;
 | 
					        Uint8 Alpha() const;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
/*******************************************************************************
 | 
					/*******************************************************************************
 | 
				
			||||||
        This file is Part of the ZEngine Library for 2D game development.
 | 
					        This file is Part of the ZEngine Library for 2D game development.
 | 
				
			||||||
                   Copyright (C) 2002, 2003 James Turk
 | 
					                  Copyright (C) 2002-2004 James Turk
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                     Licensed under a BSD-style license.
 | 
					                     Licensed under a BSD-style license.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,15 +8,6 @@
 | 
				
			||||||
     and the home of this Library is http://www.zengine.sourceforge.net
 | 
					     and the home of this Library is http://www.zengine.sourceforge.net
 | 
				
			||||||
*******************************************************************************/
 | 
					*******************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*!
 | 
					 | 
				
			||||||
    \file ZE_ZMusic.h
 | 
					 | 
				
			||||||
    \brief Definition file for ZMusic.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Definition file for ZMusic, the Music file wrapper for ZEngine.
 | 
					 | 
				
			||||||
    <br>$Id: ZE_ZMusic.h,v 1.11 2003/12/24 04:46:48 cozman Exp $<br>
 | 
					 | 
				
			||||||
    \author James Turk
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#ifndef __ze_zmusic_h__
 | 
					#ifndef __ze_zmusic_h__
 | 
				
			||||||
#define __ze_zmusic_h__
 | 
					#define __ze_zmusic_h__
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -26,161 +17,35 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace ZE
 | 
					namespace ZE
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					 | 
				
			||||||
/*!
 | 
					 | 
				
			||||||
    \brief ZMusic class for playing full length music (eg. ogg or wav).
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ZMusic music class, class wraps common features for SDL_Mixer's Mix_Music.  Inherited from ZObject.
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
class ZMusic
 | 
					class ZMusic
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    protected:
 | 
					    protected:
 | 
				
			||||||
        //! Pointer to ZEngine Object
 | 
					 | 
				
			||||||
        ZEngine* rEngine;
 | 
					        ZEngine* rEngine;
 | 
				
			||||||
        //! Pointer to music data.
 | 
					 | 
				
			||||||
        Mix_Music *rMusic;
 | 
					        Mix_Music *rMusic;
 | 
				
			||||||
 | 
					 | 
				
			||||||
    public:
 | 
					    public:
 | 
				
			||||||
        //! Static Variable For Infinite loop of sound. (Defined as -1)
 | 
					 | 
				
			||||||
        static const int LoopInfinite;
 | 
					        static const int LoopInfinite;
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        ///////////////////////
 | 
					 | 
				
			||||||
        //Opening and Closing//
 | 
					 | 
				
			||||||
        ///////////////////////
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Default Constructor.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Default Constructor, does nothing.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        ZMusic();
 | 
					        ZMusic();
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Constructor that opens a music file.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Constructor simply calls ZMusic::Open() with same filename. (WAV,MOD,MID,OGG)
 | 
					 | 
				
			||||||
            \param filename Music to open.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        ZMusic(std::string filename);
 | 
					        ZMusic(std::string filename);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Destructor, frees memory.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Destructor calls ZMusic::Release().
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        virtual ~ZMusic();
 | 
					        virtual ~ZMusic();
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Opens a music file.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Open a music file to be used.
 | 
					 | 
				
			||||||
            \param filename Music to open.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Open(std::string filename);
 | 
					        void Open(std::string filename);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Opens a music file from the current ZEngine Resource File.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Open music file from the current ZEngine Resource File, the XML resource file set via ZEngine::SetResourceFile.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void OpenFromZRF(std::string resourceId);
 | 
					        void OpenFromZRF(std::string resourceId);
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Release music.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Release memory held by music data.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Release();
 | 
					        void Release();
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /////////////////
 | 
					 | 
				
			||||||
        //Play Controls//
 | 
					 | 
				
			||||||
        /////////////////
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Play currently loaded music.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Play music currently loaded in ZMusic, looping loopNum times. (use ZMusic::LoopInfinite to loop forever.)  
 | 
					 | 
				
			||||||
            If fade is not zero (which it defaults to) music will fade in over specified number of milliseconds.
 | 
					 | 
				
			||||||
            \param loopNum Number of times to loop song, defaults to zero.
 | 
					 | 
				
			||||||
            \param fadeTime Milliseconds to fade to full volume, defaults to zero for no fade.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Play(int loopNum=0, int fadeTime=0) const;
 | 
					        void Play(int loopNum=0, int fadeTime=0) const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Pause music.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Pause currently playing music.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Pause() const;
 | 
					        void Pause() const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Unpause music.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Unpause currently paused music.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Unpause() const;
 | 
					        void Unpause() const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Rewind music.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Rewind music to beginning.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Rewind() const;
 | 
					        void Rewind() const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Stop music.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Stop currently playing music, if fadeTime is not zero, fade out over specified time.
 | 
					 | 
				
			||||||
            \param fadeTime Milliseconds to fade out over, defaults to zero for immediate stop.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Stop(int fadeTime=0) const;
 | 
					        void Stop(int fadeTime=0) const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Change Volume.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Change volume of currently playing music. 
 | 
					 | 
				
			||||||
            \param volume Volume to change to, can be in a range from 0 to 128
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void SetVolume(int volume);
 | 
					        void SetVolume(int volume);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /////////////
 | 
					 | 
				
			||||||
        //Accessors//
 | 
					 | 
				
			||||||
        /////////////
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Check if file is loaded.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Check if file is loaded and pointer to data is non-NULL.
 | 
					 | 
				
			||||||
            \return Loaded or Unloaded state of data.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        bool IsLoaded() const;
 | 
					        bool IsLoaded() const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Check if music is Playing.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Check if music is playing, specifically if it is not stopped. (Paused state should be checked for by IsPaused)
 | 
					 | 
				
			||||||
            \return Playing / Not Playing State of Music.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        bool IsPlaying() const;
 | 
					        bool IsPlaying() const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Check if music is Paused.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Check if music is "playing" but currently paused.
 | 
					 | 
				
			||||||
            \return Paused / Not Paused State of Music.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        bool IsPaused() const;
 | 
					        bool IsPaused() const;
 | 
				
			||||||
 | 
					        int GetVolume() const;
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Find Current Volume of Music.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Get current volume of music represented as a value from 0-128.
 | 
					 | 
				
			||||||
            \return Volume of music, 0-128.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        int Volume() const;
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif //USE_SDL_MIXER
 | 
					#endif //USE_SDL_MIXER
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
/*******************************************************************************
 | 
					/*******************************************************************************
 | 
				
			||||||
        This file is Part of the ZEngine Library for 2D game development.
 | 
					        This file is Part of the ZEngine Library for 2D game development.
 | 
				
			||||||
                   Copyright (C) 2002, 2003 James Turk
 | 
					                  Copyright (C) 2002-2004 James Turk
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                     Licensed under a BSD-style license.
 | 
					                     Licensed under a BSD-style license.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,152 +8,40 @@
 | 
				
			||||||
     and the home of this Library is http://www.zengine.sourceforge.net
 | 
					     and the home of this Library is http://www.zengine.sourceforge.net
 | 
				
			||||||
*******************************************************************************/
 | 
					*******************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*!
 | 
					 | 
				
			||||||
    \file ZE_ZRandGen.h
 | 
					 | 
				
			||||||
    \brief Definition file for ZRandGen.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Definition file for ZRandGen, an OO encapsulated version of the Mersenne Twister.
 | 
					 | 
				
			||||||
    This class usually isn't needed by the average user, ZEngine contains an instance which 
 | 
					 | 
				
			||||||
    should suffice unless you want objects to have their ownrandom streams.  This 
 | 
					 | 
				
			||||||
    implementation is derived from the original mt19937ar.c source from
 | 
					 | 
				
			||||||
    http://www.math.keio.ac.jp/matumoto/emt.html. See source of ZE_ZRandGen.cpp for license.
 | 
					 | 
				
			||||||
    <br>$Id: ZE_ZRandGen.h,v 1.2 2003/07/12 01:25:42 cozman Exp $<br>
 | 
					 | 
				
			||||||
    \author James Turk
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#ifndef __ze_zrandgen_h__
 | 
					#ifndef __ze_zrandgen_h__
 | 
				
			||||||
#define __ze_zrandgen_h__
 | 
					#define __ze_zrandgen_h__
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "ZE_Utility.h"
 | 
					#include "ZE_Utility.h"
 | 
				
			||||||
#include <ctime>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace ZE
 | 
					namespace ZE
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*!
 | 
					 | 
				
			||||||
    \brief ZRandGen class for OO encapsulation of superb random generator "Mersenne Twister."
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    This class usually isn't needed by the average user, ZEngine contains an instance which 
 | 
					 | 
				
			||||||
    should suffice unless you want objects to have their ownrandom streams.  This 
 | 
					 | 
				
			||||||
    implementation is derived from the original mt19937ar.c source from
 | 
					 | 
				
			||||||
    http://www.math.keio.ac.jp/matumoto/emt.html. See source of ZE_ZRandGen.cpp for license.
 | 
					 | 
				
			||||||
    \since 0.8.4
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
class ZRandGen
 | 
					class ZRandGen
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    protected:
 | 
					    protected:
 | 
				
			||||||
        //! Number of random numbers to generate at once.
 | 
					 | 
				
			||||||
        static const unsigned long N = 624;
 | 
					        static const unsigned long N = 624;
 | 
				
			||||||
        //! A constant used internally by Mersenne Twister.
 | 
					 | 
				
			||||||
        static const unsigned long M = 397;
 | 
					        static const unsigned long M = 397;
 | 
				
			||||||
        //! Constant vector A, used internally by Mersenne Twister.
 | 
					 | 
				
			||||||
        static const unsigned long MATRIX_A = 0x9908b0dfUL;
 | 
					        static const unsigned long MATRIX_A = 0x9908b0dfUL;
 | 
				
			||||||
        //! Most signifigan w-r bits, used internally by Mersenne Twister.
 | 
					 | 
				
			||||||
        static const unsigned long UPPER_MASK = 0x80000000UL;
 | 
					        static const unsigned long UPPER_MASK = 0x80000000UL;
 | 
				
			||||||
        //! Least signifigant r bits, used internally by Mersenne Twister.
 | 
					 | 
				
			||||||
        static const unsigned long LOWER_MASK = 0x7fffffffUL;
 | 
					        static const unsigned long LOWER_MASK = 0x7fffffffUL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //! Each instance of the algorithm requires a state vector.
 | 
					 | 
				
			||||||
        unsigned long rStateVector[N];
 | 
					        unsigned long rStateVector[N];
 | 
				
			||||||
        //! Used internally to traversing the rStateVector.
 | 
					 | 
				
			||||||
        unsigned long rStateVectorIndex;
 | 
					        unsigned long rStateVectorIndex;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Workhorse of random generator, only used internally.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Generates N random numbers and then serves them up, all Rand functions rely
 | 
					 | 
				
			||||||
            on this.
 | 
					 | 
				
			||||||
            \return A random unsigned long.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        unsigned long genrand_int32();
 | 
					        unsigned long genrand_int32();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public:
 | 
					    public:
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Constructor which does an initial seeding using time.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Creates internal vector and calls Seed(time(NULL)) to initialize the MT state.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        ZRandGen();
 | 
					        ZRandGen();
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Constructor which does an initial seeding.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Creates internal vector and calls seed to initialize the MT state.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        ZRandGen(unsigned long seed);
 | 
					        ZRandGen(unsigned long seed);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Seed random number generator. 
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Reseed Mersenne Twister random number generator.  NOTE: Generator is initialized upon creation of object using time.
 | 
					 | 
				
			||||||
            \param seed Seed for random sequence.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Seed(unsigned long seed);
 | 
					        void Seed(unsigned long seed);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Obtain random integer [0,max).
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Obtain random int l where 0 <= l < max.
 | 
					 | 
				
			||||||
            \param max Limit for random number.
 | 
					 | 
				
			||||||
            \return Random unsigned int.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        unsigned int Rand(unsigned int max);
 | 
					        unsigned int Rand(unsigned int max);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Obtain random integer [0,max).
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Obtain random long l where 0 <= l < max.
 | 
					 | 
				
			||||||
            \param max Limit for random number.
 | 
					 | 
				
			||||||
            \return Random unsigned long.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        unsigned long Rand(unsigned long max);
 | 
					        unsigned long Rand(unsigned long max);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Obtain random integer [min,max].
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Obtain random int l where min <= l <= max.
 | 
					 | 
				
			||||||
            \param min Lower limit for random number.
 | 
					 | 
				
			||||||
            \param max Upper limit for random number.
 | 
					 | 
				
			||||||
            \return Random int.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        int Rand(int min, int max);
 | 
					        int Rand(int min, int max);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Obtain random integer [min,max].
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Obtain random long l where min <= l <= max.
 | 
					 | 
				
			||||||
            \param min Lower limit for random number.
 | 
					 | 
				
			||||||
            \param max Upper limit for random number.
 | 
					 | 
				
			||||||
            \return Random long.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        long Rand(long min, long max);
 | 
					        long Rand(long min, long max);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Obtain random integer [min,max].
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Obtain random float l where min <= l <= max.
 | 
					 | 
				
			||||||
            \param min Lower limit for random number.
 | 
					 | 
				
			||||||
            \param max Upper limit for random number.
 | 
					 | 
				
			||||||
            \return Random float.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        float Rand(float min, float max);
 | 
					        float Rand(float min, float max);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Obtain random integer [min,max].
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Obtain random double l where min <= l <= max.
 | 
					 | 
				
			||||||
            \param min Lower limit for random number.
 | 
					 | 
				
			||||||
            \param max Upper limit for random number.
 | 
					 | 
				
			||||||
            \return Random double.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        double Rand(double min, double max);
 | 
					        double Rand(double min, double max);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Obtain random double [0,1).
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Obtain random double d where 0 <= d < 1.
 | 
					 | 
				
			||||||
            \return Random double [0,1).
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        double RandDouble();
 | 
					        double RandDouble();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
/*******************************************************************************
 | 
					/*******************************************************************************
 | 
				
			||||||
        This file is Part of the ZEngine Library for 2D game development.
 | 
					        This file is Part of the ZEngine Library for 2D game development.
 | 
				
			||||||
                   Copyright (C) 2002, 2003 James Turk
 | 
					                  Copyright (C) 2002-2004 James Turk
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                     Licensed under a BSD-style license.
 | 
					                     Licensed under a BSD-style license.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,15 +8,6 @@
 | 
				
			||||||
     and the home of this Library is http://www.zengine.sourceforge.net
 | 
					     and the home of this Library is http://www.zengine.sourceforge.net
 | 
				
			||||||
*******************************************************************************/
 | 
					*******************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*!
 | 
					 | 
				
			||||||
    \file ZE_ZRect.h
 | 
					 | 
				
			||||||
    \brief Definition file for ZRect.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Definition file for ZRect, the Rectangle class for ZEngine.
 | 
					 | 
				
			||||||
    <br>$Id: ZE_ZRect.h,v 1.14 2003/11/24 22:22:07 cozman Exp $<br>
 | 
					 | 
				
			||||||
    \author James Turk
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#ifndef __ze_zrect_h__
 | 
					#ifndef __ze_zrect_h__
 | 
				
			||||||
#define __ze_zrect_h__
 | 
					#define __ze_zrect_h__
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -25,241 +16,44 @@
 | 
				
			||||||
namespace ZE
 | 
					namespace ZE
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*!
 | 
					 | 
				
			||||||
    \brief ZEngine class for simplified rectangle use.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ZRect Rectangle class, used to define a rectangular area or perform operations on the defined area.
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
class ZRect
 | 
					class ZRect
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    protected:
 | 
					    protected:
 | 
				
			||||||
        //! Pointer to ZEngine Object
 | 
					 | 
				
			||||||
        ZEngine* rEngine;
 | 
					        ZEngine* rEngine;
 | 
				
			||||||
        //! X Position of top left corner of rectangle.
 | 
					 | 
				
			||||||
        float rX;
 | 
					        float rX;
 | 
				
			||||||
        //! Y Position of top left corner of rectangle.
 | 
					 | 
				
			||||||
        float rY;
 | 
					        float rY;
 | 
				
			||||||
        //! Width of Rectangle.
 | 
					 | 
				
			||||||
        float rWidth;
 | 
					        float rWidth;
 | 
				
			||||||
        //! Height of Rectangle.
 | 
					 | 
				
			||||||
        float rHeight;
 | 
					        float rHeight;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public:
 | 
					    public:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Default constructor for ZRect.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Default constructor, initializes all values to zero.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        ZRect();
 | 
					        ZRect();
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Constructor for ZRect that takes inital values.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Constructor for ZRect that takes inital values for all four members.
 | 
					 | 
				
			||||||
            \param x Value for x position.
 | 
					 | 
				
			||||||
            \param y Value for y position.
 | 
					 | 
				
			||||||
            \param width Value for width.
 | 
					 | 
				
			||||||
            \param height Value for height.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        ZRect(float x, float y, float width, float height);
 | 
					        ZRect(float x, float y, float width, float height);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Constructor for ZRect that uses an SDL_Rect.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Constructor for ZRect that initializes from an SDL_Rect.
 | 
					 | 
				
			||||||
            \param rect SDL_Rect to intialize from.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        ZRect(const SDL_Rect &rect);
 | 
					        ZRect(const SDL_Rect &rect);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Copy constructor for ZRect.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Takes a ZRect and constructs a new identical rectangle.
 | 
					 | 
				
			||||||
            \param rhs Rectangle to construct from.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        ZRect(const ZRect &rhs);
 | 
					        ZRect(const ZRect &rhs);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Virtual Destructor.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Virtual destructor making future inheritance safe.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        virtual ~ZRect();
 | 
					        virtual ~ZRect();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Overload for = operator with ZRect.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Copies all values from one ZRect into another.
 | 
					 | 
				
			||||||
            \param rhs Rectangle to copy values from.
 | 
					 | 
				
			||||||
            \return New value of the ZRect.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        const ZRect& operator=(const ZRect &rhs);
 | 
					        const ZRect& operator=(const ZRect &rhs);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Overload for < operator with ZRect, based upon location then size.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Rectangles are sorted by y value, followed by x value, if they start at the same place, 
 | 
					 | 
				
			||||||
            the smaller of the two is deemed less than the other.
 | 
					 | 
				
			||||||
            \param rhs Rectangle to compare.
 | 
					 | 
				
			||||||
            \return True if this rectangle is smaller than the rhs rectangle, false otherwise.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        bool operator<(const ZRect &rhs) const;
 | 
					        bool operator<(const ZRect &rhs) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Draw rectangle. (filled)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Draw the ZRect, this function is mainly provided for testing purposes.
 | 
					 | 
				
			||||||
            \param red Red component of color (0-255).
 | 
					 | 
				
			||||||
            \param green Green component of color (0-255).
 | 
					 | 
				
			||||||
            \param blue Blue component of color (0-255).
 | 
					 | 
				
			||||||
            \param alpha Alpha component of color (0-255).
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Draw(Uint8 red, Uint8 green, Uint8 blue, Uint8 alpha=255) const;
 | 
					        void Draw(Uint8 red, Uint8 green, Uint8 blue, Uint8 alpha=255) const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Changes the location of the rectangle.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Changes the current x,y position of the rectangle.
 | 
					 | 
				
			||||||
            \param x New x position for rectangle.
 | 
					 | 
				
			||||||
            \param y New y position for rectangle.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Move(float x, float y);
 | 
					        void Move(float x, float y);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Changes the location of the rectangle based upon the current location.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Changes the current x,y position of the rectangle relative to the current location.
 | 
					 | 
				
			||||||
            \param xMove Offset for new x position from current.
 | 
					 | 
				
			||||||
            \param yMove Offset for new y position from current.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void MoveRel(float xMove, float yMove);
 | 
					        void MoveRel(float xMove, float yMove);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Resize rectangle.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Changes the current width and height of the rectangle.
 | 
					 | 
				
			||||||
            \param width New width for rectangle.
 | 
					 | 
				
			||||||
            \param height New height for rectangle.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Resize(float width, float height);
 | 
					        void Resize(float width, float height);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Grows or shrinks current rectangle.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Changes the current width and height of the rectangle based upon current values.
 | 
					 | 
				
			||||||
            \param widthChange Amount to add or subtract from width.
 | 
					 | 
				
			||||||
            \param heightChange Amount to add or subtract from height.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void ResizeRel(float widthChange, float heightChange);
 | 
					        void ResizeRel(float widthChange, float heightChange);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Check if one ZRect intersects another.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Checks for overlap and returns boolean value based on if overlap exists.
 | 
					 | 
				
			||||||
            \param rect Rectangle to check for intersection with.
 | 
					 | 
				
			||||||
            \return True if intersection occured, false otherwise.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        bool Intersects(const ZRect &rect) const;
 | 
					        bool Intersects(const ZRect &rect) const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Check if a rectangle contains a given point.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Checks point against boundaries of rectangle and returns result.
 | 
					 | 
				
			||||||
            \param x X value of point to check.
 | 
					 | 
				
			||||||
            \param y Y value of poitn to check.
 | 
					 | 
				
			||||||
            \return Boolean variable, true if point is inside rectangle, false otherwise.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        bool Contains(float x, float y) const;
 | 
					        bool Contains(float x, float y) const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Check if a rectangle contains a given point.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Checks point against boundaries of rectangle and returns result.
 | 
					 | 
				
			||||||
            \param rect Rectangle to check for point.
 | 
					 | 
				
			||||||
            \return Boolean variable, true if point is inside rectangle, false otherwise.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        bool Contains(const ZRect &rect) const;
 | 
					        bool Contains(const ZRect &rect) const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Finds intersection of two rectangles.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Checks for intersection, and returns rectangle where the two rectangles intersect.
 | 
					 | 
				
			||||||
            \param rect Rectangle to check intersection with.
 | 
					 | 
				
			||||||
            \return ZRect describing intersection area.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        ZRect Intersection(const ZRect &rect) const;
 | 
					        ZRect Intersection(const ZRect &rect) const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Returns an SDL_Rect representing the rectangle.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Makes a SDL_Rect representing the rectangle, for use where functions require an SDL_Rect.
 | 
					 | 
				
			||||||
            \return SDL_Rect representing the ZRect.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        SDL_Rect SDLrect() const;
 | 
					        SDL_Rect SDLrect() const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Returns X Location.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Access private X location member.
 | 
					 | 
				
			||||||
            \return Value of mX.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        float X() const;
 | 
					        float X() const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Returns Y Location.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Access private Y location member.
 | 
					 | 
				
			||||||
            \return Value of mY.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        float Y() const;
 | 
					        float Y() const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Return position of left side.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Find X position of left side of rectangle.
 | 
					 | 
				
			||||||
            \return X position of left side.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        float Left() const;
 | 
					        float Left() const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Return position of right side.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Find X position of right side of rectangle.
 | 
					 | 
				
			||||||
            \return X position of right side.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        float Right() const;
 | 
					        float Right() const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Return position of top side.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Find Y position of top side of rectangle.
 | 
					 | 
				
			||||||
            \return Y position of top side.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        float Top() const;
 | 
					        float Top() const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Return position of bottom side.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Find Y position of left side of rectangle.
 | 
					 | 
				
			||||||
            \return Y position of bottom side.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        float Bottom() const;
 | 
					        float Bottom() const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Returns Width.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Access private width member.
 | 
					 | 
				
			||||||
            \return Value of mWidth.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        float Width() const;
 | 
					        float Width() const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Returns Height.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Access private height member.
 | 
					 | 
				
			||||||
            \return Value of mHeight.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        float Height() const;
 | 
					        float Height() const;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
/*******************************************************************************
 | 
					/*******************************************************************************
 | 
				
			||||||
        This file is Part of the ZEngine Library for 2D game development.
 | 
					        This file is Part of the ZEngine Library for 2D game development.
 | 
				
			||||||
                   Copyright (C) 2002, 2003 James Turk
 | 
					                  Copyright (C) 2002-2004 James Turk
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                     Licensed under a BSD-style license.
 | 
					                     Licensed under a BSD-style license.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,16 +8,6 @@
 | 
				
			||||||
     and the home of this Library is http://www.zengine.sourceforge.net
 | 
					     and the home of this Library is http://www.zengine.sourceforge.net
 | 
				
			||||||
*******************************************************************************/
 | 
					*******************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*!
 | 
					 | 
				
			||||||
    \file ZE_ZSimpleParticleSystem.h
 | 
					 | 
				
			||||||
    \brief Definition and implementation file for a simple particle system for ZEngine.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Definition and implementation file for ZEngine simple particle system, ZSimpleParticleSystem based on ZBaseParticleSystem.
 | 
					 | 
				
			||||||
    Due to problems with template classes the template implementation needs to be in the same file as the declaration.
 | 
					 | 
				
			||||||
    <br>$Id: ZE_ZSimpleParticleSystem.h,v 1.5 2003/11/24 22:22:07 cozman Exp $<br>
 | 
					 | 
				
			||||||
    \author James Turk
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#ifndef __ze_zsimpleparticlesystem_h__
 | 
					#ifndef __ze_zsimpleparticlesystem_h__
 | 
				
			||||||
#define __ze_zsimpleparticlesystem_h__
 | 
					#define __ze_zsimpleparticlesystem_h__
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -26,222 +16,74 @@
 | 
				
			||||||
namespace ZE
 | 
					namespace ZE
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*!
 | 
					 | 
				
			||||||
    \brief Simple particle class for ZSimpleParticleSystem.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    General purpose particle, contains needed variables for a functional particle system.
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
class ZSimpleParticle : public ZBaseParticle
 | 
					class ZSimpleParticle : public ZBaseParticle
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    public:
 | 
					    public:
 | 
				
			||||||
        //! Previous X position of particle.
 | 
					 | 
				
			||||||
        float xPrev;
 | 
					        float xPrev;
 | 
				
			||||||
        //! Previous Y position of particle.
 | 
					 | 
				
			||||||
        float yPrev;
 | 
					        float yPrev;
 | 
				
			||||||
        //! X Velocity of particle per second.
 | 
					 | 
				
			||||||
        float xVel;
 | 
					        float xVel;
 | 
				
			||||||
        //! Y Velocity of particle per second.
 | 
					 | 
				
			||||||
        float yVel;
 | 
					        float yVel;
 | 
				
			||||||
        //! Energy change per second.
 | 
					 | 
				
			||||||
        float energyDelta;
 | 
					        float energyDelta;
 | 
				
			||||||
        //! Size of particle.
 | 
					 | 
				
			||||||
        float size;
 | 
					        float size;
 | 
				
			||||||
        //! Size change per second.
 | 
					 | 
				
			||||||
        float sizeDelta;
 | 
					        float sizeDelta;
 | 
				
			||||||
        //! Red component of particle color.
 | 
					 | 
				
			||||||
        Uint8 r;
 | 
					        Uint8 r;
 | 
				
			||||||
        //! Green component of particle color.
 | 
					 | 
				
			||||||
        Uint8 g;
 | 
					        Uint8 g;
 | 
				
			||||||
        //! Blue component of particle color.
 | 
					 | 
				
			||||||
        Uint8 b;
 | 
					        Uint8 b;
 | 
				
			||||||
        //! Alpha component of particle color.
 | 
					 | 
				
			||||||
        Uint8 a;
 | 
					        Uint8 a;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*!
 | 
					 | 
				
			||||||
    \brief Possible draw styles for ZSimpleParticleSystem.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Possible draw styles for ZSimpleParticleSystem, each specifies different code with which the particles will be drawn.
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
enum ParticleDrawStyle 
 | 
					enum ParticleDrawStyle 
 | 
				
			||||||
{ 
 | 
					{ 
 | 
				
			||||||
    DS_POINT,   /*!< Draw particles as simple points.  */
 | 
					    DS_POINT,
 | 
				
			||||||
    DS_LINE,    /*!< Draw particles as lines between the current position and the last.  */
 | 
					    DS_LINE,
 | 
				
			||||||
    DS_IMAGE    /*!< Draw particles as an image.  */
 | 
					    DS_IMAGE
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*!
 | 
					 | 
				
			||||||
    \brief ZSimpleParticleSystem class, a simple particle system provided originally as an example.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ZSimpleParticleSystem class, example of implementation of a particle system on top of ZBaseParticleSystem base, 
 | 
					 | 
				
			||||||
    designed for flexibility and ease of use over speed.  More specific, therefore even less optimized for specific 
 | 
					 | 
				
			||||||
    circumstances.  Should be concidered usable but not optimal. (Although it is a great source of code for your 
 | 
					 | 
				
			||||||
    own implementations.)
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
template <class particleType>
 | 
					template <class particleType>
 | 
				
			||||||
class ZSimpleParticleSystem : public ZBaseParticleSystem<particleType>
 | 
					class ZSimpleParticleSystem : public ZBaseParticleSystem<particleType>
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    protected:
 | 
					    protected:
 | 
				
			||||||
        //! Draw style, one of the three enumerated values specifying how particles will be drawn.
 | 
					 | 
				
			||||||
        ParticleDrawStyle rStyle;
 | 
					        ParticleDrawStyle rStyle;
 | 
				
			||||||
        //! Image to draw (only used if rStyle is DS_IMAGE).
 | 
					 | 
				
			||||||
        ZImage rImage;
 | 
					        ZImage rImage;
 | 
				
			||||||
        //! Minimum X value for starting position.
 | 
					 | 
				
			||||||
        float rMinX;
 | 
					        float rMinX;
 | 
				
			||||||
        //! Maximum X value for starting position.
 | 
					 | 
				
			||||||
        float rMaxX;
 | 
					        float rMaxX;
 | 
				
			||||||
        //! Minimum Y value for starting position.
 | 
					 | 
				
			||||||
        float rMinY;
 | 
					        float rMinY;
 | 
				
			||||||
        //! Maximum Y value for starting position.
 | 
					 | 
				
			||||||
        float rMaxY;
 | 
					        float rMaxY;
 | 
				
			||||||
        //! Minimum X velocity, particle moves it's velocity every second.
 | 
					 | 
				
			||||||
        float rMinXVel;
 | 
					        float rMinXVel;
 | 
				
			||||||
        //! Maximum X velocity, particle moves it's velocity every second.
 | 
					 | 
				
			||||||
        float rMaxXVel;
 | 
					        float rMaxXVel;
 | 
				
			||||||
        //! Minimum Y velocity, particle moves it's velocity every second.
 | 
					 | 
				
			||||||
        float rMinYVel;
 | 
					        float rMinYVel;
 | 
				
			||||||
        //! Maximum Y velocity, particle moves it's velocity every second.
 | 
					 | 
				
			||||||
        float rMaxYVel;
 | 
					        float rMaxYVel;
 | 
				
			||||||
        //! Minimum starting energy. (Remember particles with energy values <= 0 are removed.)
 | 
					 | 
				
			||||||
        float rMinEnergy;
 | 
					        float rMinEnergy;
 | 
				
			||||||
        //! Maximum starting energy.
 | 
					 | 
				
			||||||
        float rMaxEnergy;
 | 
					        float rMaxEnergy;
 | 
				
			||||||
        //! Minimum energy change per second.
 | 
					 | 
				
			||||||
        float rMinEnergyDelta;
 | 
					        float rMinEnergyDelta;
 | 
				
			||||||
        //! Maximum energy change per second.
 | 
					 | 
				
			||||||
        float rMaxEnergyDelta;
 | 
					        float rMaxEnergyDelta;
 | 
				
			||||||
        //! Minimum starting size.
 | 
					 | 
				
			||||||
        float rMinSize;
 | 
					        float rMinSize;
 | 
				
			||||||
        //! Maximum starting size.
 | 
					 | 
				
			||||||
        float rMaxSize;
 | 
					        float rMaxSize;
 | 
				
			||||||
        //! Minimum size change per second.
 | 
					 | 
				
			||||||
        float rMinSizeDelta;
 | 
					        float rMinSizeDelta;
 | 
				
			||||||
        //! Maximum size change per second.
 | 
					 | 
				
			||||||
        float rMaxSizeDelta;
 | 
					        float rMaxSizeDelta;
 | 
				
			||||||
        //! Minimum red component of color, 0-255.
 | 
					 | 
				
			||||||
        Uint8 rMinRed;
 | 
					        Uint8 rMinRed;
 | 
				
			||||||
        //! Maximum red component of color, 0-255.
 | 
					 | 
				
			||||||
        Uint8 rMaxRed;
 | 
					        Uint8 rMaxRed;
 | 
				
			||||||
        //! Minimum green component of color, 0-255.
 | 
					 | 
				
			||||||
        Uint8 rMinGreen;
 | 
					        Uint8 rMinGreen;
 | 
				
			||||||
        //! Maximum green component of color, 0-255.
 | 
					 | 
				
			||||||
        Uint8 rMaxGreen;
 | 
					        Uint8 rMaxGreen;
 | 
				
			||||||
        //! Minimum blue component of color, 0-255.
 | 
					 | 
				
			||||||
        Uint8 rMinBlue;
 | 
					        Uint8 rMinBlue;
 | 
				
			||||||
        //! Maximum blue component of color, 0-255.
 | 
					 | 
				
			||||||
        Uint8 rMaxBlue;
 | 
					        Uint8 rMaxBlue;
 | 
				
			||||||
        //! Minimum alpha of particle, 0-255.
 | 
					 | 
				
			||||||
        Uint8 rMinAlpha;
 | 
					        Uint8 rMinAlpha;
 | 
				
			||||||
        //! Maximum alpha of particle, 0-255.
 | 
					 | 
				
			||||||
        Uint8 rMaxAlpha;
 | 
					        Uint8 rMaxAlpha;
 | 
				
			||||||
      
 | 
					      
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Function which creates a new particle.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Implementation of pure virtual NewParticle from ZBaseParticleSystem, creates a new particle with 
 | 
					 | 
				
			||||||
            it's members set to values between their min and max value as set by the system.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        virtual particleType NewParticle();
 | 
					        virtual particleType NewParticle();
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Updates a given particle given it's index and the elapsedTime.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Implementation of pure virtual UpdateParticle from ZBaseParticleSystem, updates a given particle
 | 
					 | 
				
			||||||
            relative to the elapsed time.
 | 
					 | 
				
			||||||
            \param index Index of particle in rParticles array to update.
 | 
					 | 
				
			||||||
            \param elapsedTime Decimal portion of a second since last call.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        virtual void UpdateParticle(int index, float elapsedTime);
 | 
					        virtual void UpdateParticle(int index, float elapsedTime);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public:
 | 
					    public:
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Draws all particles.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Implementation of pure virtual Render from ZBaseParticleSystem, draws all particles in specified
 | 
					 | 
				
			||||||
            ParticleDrawStyle.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        virtual void Render();
 | 
					        virtual void Render();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Reload image.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Reload image if mode is DS_IMAGE, usage is same as ZImage::Reload.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void ReloadImage();
 | 
					        void ReloadImage();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Sets ParticleDrawStyle for this system.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Sets the method of drawing particles, point, line, or image particles.
 | 
					 | 
				
			||||||
            \param style ParticleDrawStyle for this particle system to use.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void SetDrawStyle(ParticleDrawStyle style);
 | 
					        void SetDrawStyle(ParticleDrawStyle style);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Sets image for particle system.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Sets image for particle system to use, assuming the drawing style is DS_IMAGE.
 | 
					 | 
				
			||||||
            \brief filename Filename of image to load for the system.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void SetImage(std::string filename);
 | 
					        void SetImage(std::string filename);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Sets the range of initial positions.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Sets the range of initial positions for a new particle.
 | 
					 | 
				
			||||||
            \param minX Minimum X coordinate for new particles.
 | 
					 | 
				
			||||||
            \param minY Minimum Y coordinate for new particles.
 | 
					 | 
				
			||||||
            \param maxX Maximum X coordinate for new particles.
 | 
					 | 
				
			||||||
            \param maxY Maximum Y coordinate for new particles.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void SetPosRange(float minX, float minY, float maxX, float maxY);
 | 
					        void SetPosRange(float minX, float minY, float maxX, float maxY);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Sets range of velocities for particles.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Sets range from which a new particle obtains it's random velocity,
 | 
					 | 
				
			||||||
            \param minXVel Minimum X velocity of a particle.
 | 
					 | 
				
			||||||
            \param minYVel Minimum Y velocity of a particle.
 | 
					 | 
				
			||||||
            \param maxXVel Maximum X velocity of a particle.
 | 
					 | 
				
			||||||
            \param maxYVel Maximum Y velocity of a particle.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void SetVelocityRange(float minXVel, float minYVel, float maxXVel, float maxYVel);
 | 
					        void SetVelocityRange(float minXVel, float minYVel, float maxXVel, float maxYVel);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Sets range of initial energy and energyDelta. 
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Sets the possible ranges for a particles starting energy and it's energyDelta.  Particles with
 | 
					 | 
				
			||||||
            energy less than or equal to 0 are deleted by ZBaseParticleSystem::Update.
 | 
					 | 
				
			||||||
            \param minEnergy Minimum initial energy.
 | 
					 | 
				
			||||||
            \param maxEnergy Maximum initial energy.
 | 
					 | 
				
			||||||
            \param minEnergyDelta Minimum energy delta.
 | 
					 | 
				
			||||||
            \param maxEnergyDelta Maximum energy delta.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void SetEnergyRange(float minEnergy, float maxEnergy, float minEnergyDelta=0, float maxEnergyDelta=0);
 | 
					        void SetEnergyRange(float minEnergy, float maxEnergy, float minEnergyDelta=0, float maxEnergyDelta=0);
 | 
				
			||||||
        
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Sets range of initial size and sizeDelta. 
 | 
					 | 
				
			||||||
            Sets the possible ranges for a particles starting size and it's sizeDelta.
 | 
					 | 
				
			||||||
            \param minSize Minimum initial size.
 | 
					 | 
				
			||||||
            \param maxSize Maximum initial size.
 | 
					 | 
				
			||||||
            \param minSizeDelta Minimum size delta.
 | 
					 | 
				
			||||||
            \param maxSizeDelta Maximum size delta.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void SetSizeRange(float minSize, float maxSize, float minSizeDelta=0, float maxSizeDelta=0);
 | 
					        void SetSizeRange(float minSize, float maxSize, float minSizeDelta=0, float maxSizeDelta=0);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Set range of color for a new particle.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Sets range of possible colors, by component, for a new particle.
 | 
					 | 
				
			||||||
            \param minRed Minimum value of red component (0-255).
 | 
					 | 
				
			||||||
            \param maxRed Minimum value of red component (0-255).
 | 
					 | 
				
			||||||
            \param minGreen Minimum value of green component (0-255).
 | 
					 | 
				
			||||||
            \param maxGreen Minimum value of green component (0-255).
 | 
					 | 
				
			||||||
            \param minBlue Minimum value of blue component (0-255).
 | 
					 | 
				
			||||||
            \param maxBlue Minimum value of blue component (0-255).
 | 
					 | 
				
			||||||
            \param minAlpha Minimum value of alpha value (0-255).
 | 
					 | 
				
			||||||
            \param maxAlpha Minimum value of alpha value (0-255).
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void SetColorRange(Uint8 minRed, Uint8 maxRed, Uint8 minGreen, Uint8 maxGreen, 
 | 
					        void SetColorRange(Uint8 minRed, Uint8 maxRed, Uint8 minGreen, Uint8 maxGreen, 
 | 
				
			||||||
                            Uint8 minBlue, Uint8 maxBlue, Uint8 minAlpha, Uint8 maxAlpha);
 | 
					                            Uint8 minBlue, Uint8 maxBlue, Uint8 minAlpha, Uint8 maxAlpha);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
/*******************************************************************************
 | 
					/*******************************************************************************
 | 
				
			||||||
        This file is Part of the ZEngine Library for 2D game development.
 | 
					        This file is Part of the ZEngine Library for 2D game development.
 | 
				
			||||||
                   Copyright (C) 2002, 2003 James Turk
 | 
					                  Copyright (C) 2002-2004 James Turk
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                     Licensed under a BSD-style license.
 | 
					                     Licensed under a BSD-style license.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,15 +8,6 @@
 | 
				
			||||||
     and the home of this Library is http://www.zengine.sourceforge.net
 | 
					     and the home of this Library is http://www.zengine.sourceforge.net
 | 
				
			||||||
*******************************************************************************/
 | 
					*******************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*!
 | 
					 | 
				
			||||||
    \file ZE_ZSound.h
 | 
					 | 
				
			||||||
    \brief Definition file for ZSound.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Definition file for ZSound, the Sound Effect wrapper for ZEngine.
 | 
					 | 
				
			||||||
    <br>$Id: ZE_ZSound.h,v 1.12 2003/12/24 04:46:48 cozman Exp $<br>
 | 
					 | 
				
			||||||
    \author James Turk
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#ifndef __ze_zsound_h__
 | 
					#ifndef __ze_zsound_h__
 | 
				
			||||||
#define __ze_zsound_h__
 | 
					#define __ze_zsound_h__
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -27,164 +18,37 @@
 | 
				
			||||||
namespace ZE
 | 
					namespace ZE
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*!
 | 
					 | 
				
			||||||
    \brief ZSound class for playing sound effects. (WAV)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ZSound music class, class wraps common features for SDL_Mixer's Mix_Chunk.  Inherited from ZObject.
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
class ZSound
 | 
					class ZSound
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    protected:
 | 
					    protected:
 | 
				
			||||||
        //! Pointer to ZEngine Object
 | 
					 | 
				
			||||||
        ZEngine* rEngine;
 | 
					        ZEngine* rEngine;
 | 
				
			||||||
        //! Pointer to music data.
 | 
					 | 
				
			||||||
        Mix_Chunk* rSound;
 | 
					        Mix_Chunk* rSound;
 | 
				
			||||||
        //! Channel ID Number from SDL_Mixer.
 | 
					 | 
				
			||||||
        int rChannelID;
 | 
					        int rChannelID;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public:
 | 
					    public:
 | 
				
			||||||
        //! Static Variable For Infinite loop of sound. (Defined as -1)
 | 
					 | 
				
			||||||
        static const int LoopInfinite;
 | 
					        static const int LoopInfinite;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ///////////////////////
 | 
					 | 
				
			||||||
        //Opening and Closing//
 | 
					 | 
				
			||||||
        ///////////////////////
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Default Constructor.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Default Constructor, does nothing.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        ZSound();
 | 
					        ZSound();
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Constructor that opens a sound effect file.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Constructor simply calls ZSound::Open() with same filename. (WAV,MOD,MID,OGG)
 | 
					 | 
				
			||||||
            \param filename Sound effect to open.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        ZSound(std::string filename);
 | 
					        ZSound(std::string filename);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Destructor, frees memory.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Destructor calls ZSound::Release().
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        virtual ~ZSound();
 | 
					        virtual ~ZSound();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Opens a sound effect file.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Open a music file to be used.
 | 
					 | 
				
			||||||
            \param filename Music to open.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Open(std::string filename);
 | 
					        void Open(std::string filename);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Opens a sound effect file from within a zip archive.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Open a sound effect file from within a zip archive using zlib and SDL_RWops.
 | 
					 | 
				
			||||||
            \param zipname Zip file to open sound effect from.
 | 
					 | 
				
			||||||
            \param filename File to open as new sound effect.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void OpenFromZip(std::string zipname, std::string filename);
 | 
					        void OpenFromZip(std::string zipname, std::string filename);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Opens a sound effect file from the current ZEngine Resource File.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Open sound effect file from the current ZEngine Resource File, the XML resource file set via ZEngine::SetResourceFile.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void OpenFromZRF(std::string resourceId);
 | 
					        void OpenFromZRF(std::string resourceId);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Release sound effect.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Release memory held by sample data.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Release();
 | 
					        void Release();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /////////////////
 | 
					 | 
				
			||||||
        //Play Controls//
 | 
					 | 
				
			||||||
        /////////////////
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Play currently loaded sound effect.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Play sound effect, looping loopNum times. (use ZSound::LoopInfinite to loop forever.)  
 | 
					 | 
				
			||||||
            If fade is not zero (which it defaults to) music will fade in over specified number of milliseconds.
 | 
					 | 
				
			||||||
            \param loopNum Number of times to loop song, defaults to zero.
 | 
					 | 
				
			||||||
            \param fadeTime Milliseconds to fade to full volume, defaults to zero for no fade.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Play(int loopNum=0, int fadeTime=0);
 | 
					        void Play(int loopNum=0, int fadeTime=0);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Pause sound.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Pause currently playing sound.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Pause() const;
 | 
					        void Pause() const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Unpause sound.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Unpause currently playing sound.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Unpause() const;
 | 
					        void Unpause() const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Stop sound.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Stop currently playing sound, if fadeTime is not zero, fade out over specified time.
 | 
					 | 
				
			||||||
            \param fadeTime Milliseconds to fade out over, defaults to zero for immediate stop.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Stop(int fadeTime=0) const;
 | 
					        void Stop(int fadeTime=0) const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Change Volume.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Change volume of currently playing sample. 
 | 
					 | 
				
			||||||
            \param volume Volume to change to, can be in a range from 0 to 128.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void SetVolume(int volume);
 | 
					        void SetVolume(int volume);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /////////////
 | 
					 | 
				
			||||||
        //Accessors//
 | 
					 | 
				
			||||||
        /////////////
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Check if file is loaded.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Check if file is loaded and pointer to data is non-NULL.
 | 
					 | 
				
			||||||
            \return Loaded or Unloaded state of data.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        bool IsLoaded() const;
 | 
					        bool IsLoaded() const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Check if sound is Playing.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Check if sound is playing, specifically if it is not stopped. (Paused state should be checked for by IsPaused)
 | 
					 | 
				
			||||||
            \return Playing / Not Playing State of sound.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        bool IsPlaying() const;
 | 
					        bool IsPlaying() const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Check if sound is Paused.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Check if sound is "playing" but currently paused.
 | 
					 | 
				
			||||||
            \return Paused / Not Paused State of Sound.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        bool IsPaused() const;
 | 
					        bool IsPaused() const;
 | 
				
			||||||
 | 
					        int GetVolume() const;
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Find Current Volume of Sound Channel.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Get current volume of sound channel represented as a value from 0-128.
 | 
					 | 
				
			||||||
            \return Volume of sound channel, 0-128.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        int Volume() const;
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif //USE_SDL_MIXER
 | 
					#endif //USE_SDL_MIXER
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
/*******************************************************************************
 | 
					/*******************************************************************************
 | 
				
			||||||
        This file is Part of the ZEngine Library for 2D game development.
 | 
					        This file is Part of the ZEngine Library for 2D game development.
 | 
				
			||||||
                   Copyright (C) 2002, 2003 James Turk
 | 
					                  Copyright (C) 2002-2004 James Turk
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                     Licensed under a BSD-style license.
 | 
					                     Licensed under a BSD-style license.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,15 +8,6 @@
 | 
				
			||||||
     and the home of this Library is http://www.zengine.sourceforge.net
 | 
					     and the home of this Library is http://www.zengine.sourceforge.net
 | 
				
			||||||
*******************************************************************************/
 | 
					*******************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*!
 | 
					 | 
				
			||||||
    \file ZE_ZTimer.h
 | 
					 | 
				
			||||||
    \brief Definition file for ZTimer.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Definition file for ZTimer, the Timer class for ZEngine.
 | 
					 | 
				
			||||||
    <br>$Id: ZE_ZTimer.h,v 1.10 2003/11/24 22:24:33 cozman Exp $<br>
 | 
					 | 
				
			||||||
    \author James Turk
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#ifndef __ze_ztimer_h__
 | 
					#ifndef __ze_ztimer_h__
 | 
				
			||||||
#define __ze_ztimer_h__
 | 
					#define __ze_ztimer_h__
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -25,85 +16,26 @@
 | 
				
			||||||
namespace ZE
 | 
					namespace ZE
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*!
 | 
					 | 
				
			||||||
    \brief ZTimer class for Timer use.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ZTimer timing class, class wraps common features of SDL timer.  Inherited from ZObject and tied to ZEngine main timer.
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
class ZTimer
 | 
					class ZTimer
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    protected:
 | 
					    protected:
 | 
				
			||||||
        //! Pointer to ZEngine Object
 | 
					 | 
				
			||||||
        ZEngine* rEngine;
 | 
					        ZEngine* rEngine;
 | 
				
			||||||
        //! Paused / Unpaused state of Timer
 | 
					 | 
				
			||||||
        bool rPaused;
 | 
					        bool rPaused;
 | 
				
			||||||
        //! Using ZEngine timer or SDL global timer.
 | 
					 | 
				
			||||||
        bool rUseZEngine;
 | 
					        bool rUseZEngine;
 | 
				
			||||||
        //! Total time this timer has been paused.
 | 
					 | 
				
			||||||
        Uint32 rPausedTime;
 | 
					        Uint32 rPausedTime;
 | 
				
			||||||
        //! Time this Timer was paused.
 | 
					 | 
				
			||||||
        Uint32 rLastPause;
 | 
					        Uint32 rLastPause;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Get time from parent timer.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Protected method to get time from whichever timer is parent.
 | 
					 | 
				
			||||||
            \return Time on parent timer.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        Uint32 GetParentTime() const;
 | 
					        Uint32 GetParentTime() const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public:
 | 
					    public:
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Constructs a new Timer.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Sets TimePaused to current ZEngine time if useZEngine is true, otherwise uses SDL timer.
 | 
					 | 
				
			||||||
            \param useZEngine Tells if timer should use ZEngine or SDL.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        ZTimer(bool useZEngine=true);
 | 
					        ZTimer(bool useZEngine=true);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Virtual Destructor.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Virtual destructor making future inheritance safe.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        virtual ~ZTimer();
 | 
					        virtual ~ZTimer();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Reset Timer.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Set Timer back to Zero, will also unpause timer if it was paused.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Reset();
 | 
					        void Reset();
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Pause Timer.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Pause the timer if it is unpaused.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Pause();
 | 
					        void Pause();
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Unpause Timer.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Unpause the timer if it is paused.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        void Unpause();
 | 
					        void Unpause();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Get Time of Timer.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Get current time accounting for time paused.
 | 
					 | 
				
			||||||
            \return Current Timer Time.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        Uint32 GetTime() const;
 | 
					        Uint32 GetTime() const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /*!
 | 
					 | 
				
			||||||
            \brief Get paused state.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Find out paused state of timer.
 | 
					 | 
				
			||||||
            \return Paused state for timer.
 | 
					 | 
				
			||||||
        **/
 | 
					 | 
				
			||||||
        bool IsPaused() const;
 | 
					        bool IsPaused() const;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,53 +1,3 @@
 | 
				
			||||||
/*!
 | 
					 | 
				
			||||||
    \file ZEngine.h
 | 
					 | 
				
			||||||
    \brief Header file for ZEngine.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Public header file for ZEngine, this is the file that programs that wish to utilize ZEngine should include.
 | 
					 | 
				
			||||||
    <br>$Id: ZEngine.h,v 1.38 2003/11/25 01:02:17 cozman Exp $<br>
 | 
					 | 
				
			||||||
    \author James Turk
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*!
 | 
					 | 
				
			||||||
    \mainpage ZEngine Documentation
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    \author James Turk
 | 
					 | 
				
			||||||
    \version 0.8.5
 | 
					 | 
				
			||||||
    \date October 5th, 2003
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    \section ZEngine About ZEngine
 | 
					 | 
				
			||||||
    <br>
 | 
					 | 
				
			||||||
        -ZEngine is designed to provide a powerful yet easy to use 2D game engine in a well designed 
 | 
					 | 
				
			||||||
    Object Oriented manner, and uses cross platform libraries such as SDL and OpenGL. (ZEngine can use SDL_ttf,SDL_image,
 | 
					 | 
				
			||||||
    and SDL_mixer all of which are cross platform as well as Open Source.)<br>
 | 
					 | 
				
			||||||
        -It is licensed under a BSD-style license, and anyone is free to suggest or implement changes 
 | 
					 | 
				
			||||||
    to be added to the Engine, as well as modify the engine to their own needs or use it however they like.<br>
 | 
					 | 
				
			||||||
        -ZEngine now uses OpenGL rather than SDL to do 2D drawing, thus increasing the uses of the engine
 | 
					 | 
				
			||||||
    and making the engine much faster in all test cases, and the engine was tested for memory leaks with MSVC and is known
 | 
					 | 
				
			||||||
    to have no leaks.<br>
 | 
					 | 
				
			||||||
        -ZEngine homepage : http://zengine.sourceforge.net/. <br>
 | 
					 | 
				
			||||||
        -ZEngine tutorials : http://zengine.sourceforge.net/tutorials/. <br>
 | 
					 | 
				
			||||||
        -ZEngine forums : http://sourceforge.net/forum/?group_id=62098. <br>
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    \section Licensing Licensing
 | 
					 | 
				
			||||||
    <br>
 | 
					 | 
				
			||||||
<pre>        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://zengine.sourceforge.net
 | 
					 | 
				
			||||||
    </pre>
 | 
					 | 
				
			||||||
    \section Authors Contributing Authors
 | 
					 | 
				
			||||||
    <br>
 | 
					 | 
				
			||||||
    James Turk <a href="mailto:james@conceptofzero.net">james@conceptofzero.net</a> - Core Engine, Design, Docs, and Classes <br>
 | 
					 | 
				
			||||||
    Gamer Tazar <a href="mailto:tazar@conceptofzero.net">tazar@conceptofzero.net</a> - OpenGL assistance <br>
 | 
					 | 
				
			||||||
    Sean <a href="mailto:sean@conceptofzero.net">sean@conceptofzero.net</a> - MSVC++6 Project Files <br>
 | 
					 | 
				
			||||||
    Kevin Watters <a href="mailto:kwatters@adelphia.net">kwatters@adelphia.net</a> - Fix to ZImage::SetColorKey <br>
 | 
					 | 
				
			||||||
    Atani <a href="mailto:atani@atani-software.net">atani@atani-software.net</a> - Revised Linux Build System <br>
 | 
					 | 
				
			||||||
    Stinus Petersen <a href="mailto:bison@flytlet.dk">bison@flytlet.dk</a> - Fix for ZImage::OpenFromImage with alpha images <br>
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#ifndef __zengine_h__
 | 
					#ifndef __zengine_h__
 | 
				
			||||||
#define __zengine_h__
 | 
					#define __zengine_h__
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,26 +1,30 @@
 | 
				
			||||||
 | 
					/*******************************************************************************
 | 
				
			||||||
 | 
					        This file is Part of the ZEngine Library for 2D game development.
 | 
				
			||||||
 | 
					                  Copyright (C) 2002-2004 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
 | 
				
			||||||
 | 
					*******************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "VersionInfo.h"
 | 
					#include "VersionInfo.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*!
 | 
					 | 
				
			||||||
    \file VersionInfo.cpp
 | 
					 | 
				
			||||||
    \brief Implementation file for VersionInfo class.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Implementation file for VersinInfo class, simple class for containing and comparing 
 | 
					 | 
				
			||||||
    version numbers.
 | 
					 | 
				
			||||||
    <br>$Id: VersionInfo.cpp,v 1.6 2003/07/12 09:22:13 cozman Exp $<br>
 | 
					 | 
				
			||||||
    \author James Turk
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
VersionInfo::VersionInfo(unsigned int maj, unsigned int min, unsigned int rel, std::string ext) :
 | 
					VersionInfo::VersionInfo(unsigned int maj, unsigned int min, unsigned int rel, std::string ext) :
 | 
				
			||||||
    Major(maj), Minor(min), Release(rel), Extra(ext)
 | 
					    Major(maj), Minor(min), Release(rel), Extra(ext)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
std::string VersionInfo::GetString() const
 | 
					char* VersionInfo::GetString() const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    static char verStr[100];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if(Extra.length())
 | 
					    if(Extra.length())
 | 
				
			||||||
        return ZE::FormatStr("%d.%d.%d [%s]",Major,Minor,Release,Extra.c_str());
 | 
					        sprintf(verStr,"%d.%d.%d [%s]",Major,Minor,Release,Extra.c_str());
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
        return ZE::FormatStr("%d.%d.%d",Major,Minor,Release);
 | 
					        sprintf(verStr,"%d.%d.%d",Major,Minor,Release);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return verStr;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool VersionInfo::operator<(const VersionInfo &rhs) const
 | 
					bool VersionInfo::operator<(const VersionInfo &rhs) const
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
/*******************************************************************************
 | 
					/*******************************************************************************
 | 
				
			||||||
        This file is Part of the ZEngine Library for 2D game development.
 | 
					        This file is Part of the ZEngine Library for 2D game development.
 | 
				
			||||||
                   Copyright (C) 2002, 2003 James Turk
 | 
					                  Copyright (C) 2002-2004 James Turk
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                     Licensed under a BSD-style license.
 | 
					                     Licensed under a BSD-style license.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,27 +8,18 @@
 | 
				
			||||||
     and the home of this Library is http://www.zengine.sourceforge.net
 | 
					     and the home of this Library is http://www.zengine.sourceforge.net
 | 
				
			||||||
*******************************************************************************/
 | 
					*******************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
    \file ZE_Utility.cpp
 | 
					 | 
				
			||||||
    \brief Source file for ZEngine utility functions.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Source file containing open utilities for use inside and alongside ZEngine.
 | 
					 | 
				
			||||||
    <br>$Id: ZE_Utility.cpp,v 1.14 2003/11/24 02:07:03 cozman Exp $<br>
 | 
					 | 
				
			||||||
    \author James Turk
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "ZE_Utility.h"
 | 
					#include "ZE_Utility.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace ZE
 | 
					namespace ZE
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
std::string FormatStr(const std::string fmtstr, ...)
 | 
					std::string FormatStr(std::string fmtStr, ...)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    char buf[512];
 | 
					    std::va_list args;
 | 
				
			||||||
    va_list args;
 | 
					    char buf[1024];
 | 
				
			||||||
    //simply puts args into the buffer using standard parsing rules
 | 
					
 | 
				
			||||||
    va_start(args,fmtstr);
 | 
					    va_start(args,fmtStr);
 | 
				
			||||||
    vsprintf(buf, fmtstr.c_str(), args);
 | 
					    std::vsprintf(buf,fmtStr.c_str(),args);
 | 
				
			||||||
    va_end(args);
 | 
					    va_end(args);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return buf;
 | 
					    return buf;
 | 
				
			||||||
| 
						 | 
					@ -76,6 +67,85 @@ SDL_RWops* RWFromZip(std::string zipname, std::string filename)
 | 
				
			||||||
    return SDL_RWFromMem(buffer, info.uncompressed_size);   //return buffer in RW form
 | 
					    return SDL_RWFromMem(buffer, info.uncompressed_size);   //return buffer in RW form
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if (GFX_BACKEND == ZE_OGL)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//from SDL's testgl.c power_of_two
 | 
				
			||||||
 | 
					int PowerOfTwo(int num)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    int value = 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    while(value < num) //texture coord must be >= input
 | 
				
			||||||
 | 
					        value <<= 1;     //value <<= 1 is the same as value *= 2
 | 
				
			||||||
 | 
					    return value;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//from SDL's testgl.c SDL_GL_LoadTexture
 | 
				
			||||||
 | 
					GLuint SurfaceToTexture(SDL_Surface *surface, GLfloat *texcoord)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    GLuint texture;
 | 
				
			||||||
 | 
					    int w, h;
 | 
				
			||||||
 | 
					    SDL_Surface *temp;
 | 
				
			||||||
 | 
					    SDL_Rect area;
 | 
				
			||||||
 | 
					    Uint32 saved_flags;
 | 
				
			||||||
 | 
					    Uint8  saved_alpha;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //expand width and height to nearest powers of 2
 | 
				
			||||||
 | 
					    w = PowerOfTwo(surface->w);
 | 
				
			||||||
 | 
					    h = PowerOfTwo(surface->h);
 | 
				
			||||||
 | 
					    texcoord[0] = 0.0f; //min X
 | 
				
			||||||
 | 
					    texcoord[1] = 0.0f; //min Y
 | 
				
			||||||
 | 
					    texcoord[2] = (GLfloat)surface->w / w;  //max X
 | 
				
			||||||
 | 
					    texcoord[3] = (GLfloat)surface->h / h;  //max Y
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    temp = SDL_CreateRGBSurface(
 | 
				
			||||||
 | 
					        SDL_SWSURFACE,
 | 
				
			||||||
 | 
					        w, h,
 | 
				
			||||||
 | 
					        32,
 | 
				
			||||||
 | 
					#if SDL_BYTEORDER == SDL_LIL_ENDIAN //endian specific color masks
 | 
				
			||||||
 | 
					        0x000000FF, 
 | 
				
			||||||
 | 
					        0x0000FF00, 
 | 
				
			||||||
 | 
					        0x00FF0000, 
 | 
				
			||||||
 | 
					        0xFF000000
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					        0xFF000000,
 | 
				
			||||||
 | 
					        0x00FF0000, 
 | 
				
			||||||
 | 
					        0x0000FF00, 
 | 
				
			||||||
 | 
					        0x000000FF
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					    );
 | 
				
			||||||
 | 
					    if(!temp)  //failure in CreateRGBSurface
 | 
				
			||||||
 | 
					        return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //save alpha
 | 
				
			||||||
 | 
					    saved_flags = surface->flags&(SDL_SRCALPHA|SDL_RLEACCELOK);
 | 
				
			||||||
 | 
					    saved_alpha = surface->format->alpha;
 | 
				
			||||||
 | 
					    if((saved_flags & SDL_SRCALPHA) == SDL_SRCALPHA)
 | 
				
			||||||
 | 
					        SDL_SetAlpha(surface, 0, 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //copy surface (do not alter passed surface to allow this function to be used in special situations)
 | 
				
			||||||
 | 
					    area.x = 0;
 | 
				
			||||||
 | 
					    area.y = 0;
 | 
				
			||||||
 | 
					    area.w = static_cast<Sint16>(surface->w);
 | 
				
			||||||
 | 
					    area.h = static_cast<Sint16>(surface->h);
 | 
				
			||||||
 | 
					    SDL_BlitSurface(surface, &area, temp, &area);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //restore saved alpha
 | 
				
			||||||
 | 
					    if((saved_flags & SDL_SRCALPHA) == SDL_SRCALPHA)
 | 
				
			||||||
 | 
					        SDL_SetAlpha(surface, saved_flags, saved_alpha);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //create the OpenGL texture
 | 
				
			||||||
 | 
					    glGenTextures(1, &texture); 
 | 
				
			||||||
 | 
					    //setup texture parmaters
 | 
				
			||||||
 | 
					    glBindTexture(GL_TEXTURE_2D, texture);
 | 
				
			||||||
 | 
					    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
 | 
				
			||||||
 | 
					    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
 | 
				
			||||||
 | 
					    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, temp->pixels);
 | 
				
			||||||
 | 
					    SDL_FreeSurface(temp); //temp surface no longer needed
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return texture;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					#endif //GFX_BACKEND == ZE_OGL
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//Each of the Free*s safely frees & NULLs the pointer
 | 
					//Each of the Free*s safely frees & NULLs the pointer
 | 
				
			||||||
void FreeImage(SDL_Surface *&image)
 | 
					void FreeImage(SDL_Surface *&image)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
/*******************************************************************************
 | 
					/*******************************************************************************
 | 
				
			||||||
        This file is Part of the ZEngine Library for 2D game development.
 | 
					        This file is Part of the ZEngine Library for 2D game development.
 | 
				
			||||||
                   Copyright (C) 2002, 2003 James Turk
 | 
					                  Copyright (C) 2002-2004 James Turk
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                     Licensed under a BSD-style license.
 | 
					                     Licensed under a BSD-style license.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,15 +8,6 @@
 | 
				
			||||||
     and the home of this Library is http://www.zengine.sourceforge.net
 | 
					     and the home of this Library is http://www.zengine.sourceforge.net
 | 
				
			||||||
*******************************************************************************/
 | 
					*******************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
    \file ZE_ZAnimation.cpp
 | 
					 | 
				
			||||||
    \brief Source file for ZAnimation.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Implementation of ZAnimation, ZEngine's class for ZImage based animations.
 | 
					 | 
				
			||||||
    <br>$Id: ZE_ZAnimation.cpp,v 1.2 2003/12/24 04:44:41 cozman Exp $<br>
 | 
					 | 
				
			||||||
    \author James Turk
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "ZE_ZAnimation.h"
 | 
					#include "ZE_ZAnimation.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace ZE
 | 
					namespace ZE
 | 
				
			||||||
| 
						 | 
					@ -37,6 +28,10 @@ ZAnimation::ZAnimation(ZImage *images, int numFrames, Uint32 frameDelay, ZAnimTy
 | 
				
			||||||
    Create(images,numFrames,frameDelay,type,backwards);
 | 
					    Create(images,numFrames,frameDelay,type,backwards);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ZAnimation::~ZAnimation()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ZAnimation::Create(ZImage *images, int numFrames, Uint32 frameDelay, ZAnimType type, bool backwards)
 | 
					void ZAnimation::Create(ZImage *images, int numFrames, Uint32 frameDelay, ZAnimType type, bool backwards)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    rAnimImages = images;
 | 
					    rAnimImages = images;
 | 
				
			||||||
| 
						 | 
					@ -138,7 +133,7 @@ void ZAnimation::Draw(float x, float y) const
 | 
				
			||||||
    //error: images not loaded
 | 
					    //error: images not loaded
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool ZAnimation::Running() const
 | 
					bool ZAnimation::IsRunning() const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return rFrameStep != 0;
 | 
					    return rFrameStep != 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
/*******************************************************************************
 | 
					/*******************************************************************************
 | 
				
			||||||
        This file is Part of the ZEngine Library for 2D game development.
 | 
					        This file is Part of the ZEngine Library for 2D game development.
 | 
				
			||||||
                   Copyright (C) 2002, 2003 James Turk
 | 
					                  Copyright (C) 2002-2004 James Turk
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                     Licensed under a BSD-style license.
 | 
					                     Licensed under a BSD-style license.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,15 +8,6 @@
 | 
				
			||||||
     and the home of this Library is http://www.zengine.sourceforge.net
 | 
					     and the home of this Library is http://www.zengine.sourceforge.net
 | 
				
			||||||
*******************************************************************************/
 | 
					*******************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
    \file ZE_ZConfigFile.cpp
 | 
					 | 
				
			||||||
    \brief Source file for ZConfigFile.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Implementation of ZConfigFile, the ZEngine INI-Style Config File.
 | 
					 | 
				
			||||||
    <br>$Id: ZE_ZConfigFile.cpp,v 1.15 2003/11/24 22:20:49 cozman Exp $<br>
 | 
					 | 
				
			||||||
    \author James Turk
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "ZE_ZConfigFile.h"
 | 
					#include "ZE_ZConfigFile.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace ZE
 | 
					namespace ZE
 | 
				
			||||||
| 
						 | 
					@ -177,11 +168,12 @@ ZConfigFile::~ZConfigFile()
 | 
				
			||||||
void ZConfigFile::Process(std::string filename)
 | 
					void ZConfigFile::Process(std::string filename)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    rFilename = filename;
 | 
					    rFilename = filename;
 | 
				
			||||||
    int commentNum=0;
 | 
					    int commentNum,newlineNum;
 | 
				
			||||||
    int newlineNum=0;
 | 
					    char commentStr[15],newlineStr[15];
 | 
				
			||||||
 | 
					 | 
				
			||||||
    std::ifstream cfile(rFilename.c_str()); 
 | 
					 | 
				
			||||||
    std::string section, str, var, tmp;
 | 
					    std::string section, str, var, tmp;
 | 
				
			||||||
 | 
					    std::ifstream cfile(rFilename.c_str()); 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    commentNum = newlineNum = 0;    //comment/newline support is a bit of a hack
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    rFileLayout.clear();    //layout must be cleared, in case variable is being used multiple times
 | 
					    rFileLayout.clear();    //layout must be cleared, in case variable is being used multiple times
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -200,12 +192,14 @@ void ZConfigFile::Process(std::string filename)
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        else if(tmp[0] == '#' || tmp[0] == ';') //acceptable comment characters
 | 
					        else if(tmp[0] == '#' || tmp[0] == ';') //acceptable comment characters
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            SetVariable(section,FormatStr("__comment%d",commentNum),str);
 | 
					            sprintf(commentStr,"__comment%d",commentNum);
 | 
				
			||||||
 | 
					            SetVariable(section,commentStr,str);
 | 
				
			||||||
            ++commentNum;
 | 
					            ++commentNum;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        else if(tmp.length() == 0 && !cfile.eof())  //prevent writing a new newline with every write to disk
 | 
					        else if(tmp.length() == 0 && !cfile.eof())  //avoid adding a line to end of file each time
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            SetVariable(section,FormatStr("__newline%d",newlineNum),"");
 | 
					            sprintf(newlineStr,"__newline%d",newlineNum);
 | 
				
			||||||
 | 
					            SetVariable(section,newlineStr,str);
 | 
				
			||||||
            ++newlineNum;
 | 
					            ++newlineNum;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
/*******************************************************************************
 | 
					/*******************************************************************************
 | 
				
			||||||
        This file is Part of the ZEngine Library for 2D game development.
 | 
					        This file is Part of the ZEngine Library for 2D game development.
 | 
				
			||||||
                   Copyright (C) 2002, 2003 James Turk
 | 
					                  Copyright (C) 2002-2004 James Turk
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                     Licensed under a BSD-style license.
 | 
					                     Licensed under a BSD-style license.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,15 +8,6 @@
 | 
				
			||||||
     and the home of this Library is http://www.zengine.sourceforge.net
 | 
					     and the home of this Library is http://www.zengine.sourceforge.net
 | 
				
			||||||
*******************************************************************************/
 | 
					*******************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
    \file ZE_ZEngine.cpp
 | 
					 | 
				
			||||||
    \brief Central source file for ZEngine.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Actual implementation of ZEngine singleton class, the core of ZEngine.
 | 
					 | 
				
			||||||
    <br>$Id: ZE_ZEngine.cpp,v 1.67 2003/12/24 04:43:36 cozman Exp $<br>
 | 
					 | 
				
			||||||
    \author James Turk
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "ZE_ZEngine.h"
 | 
					#include "ZE_ZEngine.h"
 | 
				
			||||||
#include "ZE_ZRect.h"
 | 
					#include "ZE_ZRect.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -65,7 +56,7 @@ ZEngine* ZEngine::GetInstance()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if(!sInstance)  //first time through, gets new instance, each time after returns same one
 | 
					    if(!sInstance)  //first time through, gets new instance, each time after returns same one
 | 
				
			||||||
        sInstance = new ZEngine;
 | 
					        sInstance = new ZEngine;
 | 
				
			||||||
 | 
					    atexit(ZEngine::ReleaseInstance);
 | 
				
			||||||
    return sInstance;
 | 
					    return sInstance;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -73,6 +64,12 @@ void ZEngine::ReleaseInstance()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if(sInstance)
 | 
					    if(sInstance)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					        if(sInstance->mErrlog && sInstance->mLogStyle == ZLOG_HTML)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            fprintf(sInstance->mErrlog,"</body>\n</html>");
 | 
				
			||||||
 | 
					            fclose(sInstance->mErrlog);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        sInstance->CloseDisplay();
 | 
					        sInstance->CloseDisplay();
 | 
				
			||||||
        delete sInstance;
 | 
					        delete sInstance;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -265,11 +262,6 @@ void ZEngine::ToggleFullscreen()
 | 
				
			||||||
    SetReloadNeed(true);    //images need to be reloaded on fullscreen swap
 | 
					    SetReloadNeed(true);    //images need to be reloaded on fullscreen swap
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool ZEngine::Initialized()
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    return mInitialized;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
SDL_Surface *ZEngine::Display()
 | 
					SDL_Surface *ZEngine::Display()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return mScreen;
 | 
					    return mScreen;
 | 
				
			||||||
| 
						 | 
					@ -375,6 +367,11 @@ void ZEngine::UnpauseTimer()
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bool ZEngine::TimerIsPaused()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    return mPaused;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
double ZEngine::GetFrameTime()
 | 
					double ZEngine::GetFrameTime()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return mSecPerFrame;
 | 
					    return mSecPerFrame;
 | 
				
			||||||
| 
						 | 
					@ -385,25 +382,6 @@ double ZEngine::GetFramerate()
 | 
				
			||||||
    return mSecPerFrame ? 1/mSecPerFrame : 0;   //avoid /0
 | 
					    return mSecPerFrame ? 1/mSecPerFrame : 0;   //avoid /0
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef DEPRECIATED
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void ZEngine::SetDesiredFramerate(Uint8 rate)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    mDesiredFramerate = rate;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Uint8 ZEngine::GetDesiredFramerate()
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    return mDesiredFramerate;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#endif //DEPRECIATED
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
bool ZEngine::IsPaused()
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    return mPaused;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
bool ZEngine::IsActive()
 | 
					bool ZEngine::IsActive()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return mActive;
 | 
					    return mActive;
 | 
				
			||||||
| 
						 | 
					@ -488,7 +466,7 @@ bool ZEngine::MouseInRect(const SDL_Rect &rect)
 | 
				
			||||||
        mMouseY >= rect.y && mMouseY <= rect.y+rect.h);
 | 
					        mMouseY >= rect.y && mMouseY <= rect.y+rect.h);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool ZEngine::MouseInRect(ZRect rect)
 | 
					bool ZEngine::MouseInRect(const ZRect &rect)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return rect.Contains(static_cast<float>(mMouseX),static_cast<float>(mMouseY));
 | 
					    return rect.Contains(static_cast<float>(mMouseX),static_cast<float>(mMouseY));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -562,6 +540,8 @@ void ZEngine::SetEventFilter(SDL_EventFilter filter)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ZEngine::SetErrorLog(ZErrorLogStyle logStyle, std::string logFile)
 | 
					void ZEngine::SetErrorLog(ZErrorLogStyle logStyle, std::string logFile)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    mLogStyle = logStyle;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if(logStyle != ZLOG_NONE && logFile.length())
 | 
					    if(logStyle != ZLOG_NONE && logFile.length())
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        //stderr & stdout directed to their appropriate streams
 | 
					        //stderr & stdout directed to their appropriate streams
 | 
				
			||||||
| 
						 | 
					@ -575,24 +555,20 @@ void ZEngine::SetErrorLog(ZErrorLogStyle logStyle, std::string logFile)
 | 
				
			||||||
        if(logStyle == ZLOG_HTML)
 | 
					        if(logStyle == ZLOG_HTML)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            fprintf(mErrlog,
 | 
					            fprintf(mErrlog,
 | 
				
			||||||
                "<html><head><title>ZEngine Error Log</title>\n<style type="text/css">\n<!--\n"
 | 
					                "<html><head><title>ZEngine Error Log</title>\n<style type=\"text/css\">\n<!--\n"
 | 
				
			||||||
                "p.note { }\n"
 | 
					                "p { margin: 0 }\n"
 | 
				
			||||||
                "p.verbose { }\n"
 | 
					                ".note { font-style:italic color:gray }\n"
 | 
				
			||||||
                "p.depr { }\n"
 | 
					                ".verbose { font-style:italic; background:yellow; font-size:small }\n"
 | 
				
			||||||
                "p.warning { }\n"
 | 
					                ".depr { font-weight:bold; background:blue; color:white }\n"
 | 
				
			||||||
                "p.error { }\n"
 | 
					                ".warning { font-weight:bold; background:yellow }\n"
 | 
				
			||||||
                "p.critical { }\n"
 | 
					                ".error { font-weight:bold; background:orange }\n"
 | 
				
			||||||
 | 
					                ".critical { font-weight:bold; background:red; color:white }\n"
 | 
				
			||||||
                "-->\n</style>\n</head>\n<body>\n");
 | 
					                "-->\n</style>\n</head>\n<body>\n");
 | 
				
			||||||
            fflush(mErrlog);
 | 
					            fflush(mErrlog);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ZEngine::DisableErrorLog()
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    mErrlog = NULL;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void ZEngine::ReportError(ZErrorSeverity severity, std::string desc, ...)
 | 
					void ZEngine::ReportError(ZErrorSeverity severity, std::string desc, ...)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    static std::string prefix[] = { 
 | 
					    static std::string prefix[] = { 
 | 
				
			||||||
| 
						 | 
					@ -616,11 +592,10 @@ void ZEngine::ReportError(ZErrorSeverity severity, std::string desc, ...)
 | 
				
			||||||
    if(mLogStyle != ZLOG_NONE)
 | 
					    if(mLogStyle != ZLOG_NONE)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        char buf[1024];
 | 
					        char buf[1024];
 | 
				
			||||||
        va_list args;
 | 
					        std::va_list args;
 | 
				
			||||||
        std::string msg;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        va_start(args,desc);
 | 
					        va_start(args,desc);
 | 
				
			||||||
        vsprintf(buf,desc.c_str(),args);
 | 
					        std::vsprintf(buf,desc.c_str(),args);
 | 
				
			||||||
        va_end(args);
 | 
					        va_end(args);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if(mLogStyle == ZLOG_TEXT)
 | 
					        if(mLogStyle == ZLOG_TEXT)
 | 
				
			||||||
| 
						 | 
					@ -629,7 +604,7 @@ void ZEngine::ReportError(ZErrorSeverity severity, std::string desc, ...)
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        else if(mLogStyle == ZLOG_HTML)
 | 
					        else if(mLogStyle == ZLOG_HTML)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            fprintf(mErrlog,"<p style=\"%s\">%s%s</p>\n",style[static_cast<int>(severity)].c_str(),prefix[static_cast<int>(severity)].c_str(),buf);
 | 
					            fprintf(mErrlog,"<p class=\"%s\">%s%s</p>\n",style[static_cast<int>(severity)].c_str(),prefix[static_cast<int>(severity)].c_str(),buf);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        std::fflush(mErrlog);
 | 
					        std::fflush(mErrlog);
 | 
				
			||||||
| 
						 | 
					@ -638,17 +613,14 @@ void ZEngine::ReportError(ZErrorSeverity severity, std::string desc, ...)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ZEngine::WriteLog(std::string str, ...)
 | 
					void ZEngine::WriteLog(std::string str, ...)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if(mLogStyle != ZLOG_NONE)
 | 
					    std::va_list args;
 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
    char buf[1024];
 | 
					    char buf[1024];
 | 
				
			||||||
        va_list args;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    va_start(args,str);
 | 
					    va_start(args,str);
 | 
				
			||||||
        vsprintf(buf,str.c_str(),args);
 | 
					    std::vsprintf(buf,str.c_str(),args);
 | 
				
			||||||
    va_end(args);
 | 
					    va_end(args);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ReportError(ZERR_NOTE, buf);
 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ZEngine::SeedRandGen(unsigned long seed)
 | 
					void ZEngine::SeedRandGen(unsigned long seed)
 | 
				
			||||||
| 
						 | 
					@ -743,6 +715,11 @@ double ZEngine::GetDoubleResource(std::string type, std::string id, std::string
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bool ZEngine::DisplayCreated()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    return mInitialized;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int ZEngine::DisplayWidth()
 | 
					int ZEngine::DisplayWidth()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return mScreen->w;
 | 
					    return mScreen->w;
 | 
				
			||||||
| 
						 | 
					@ -758,25 +735,6 @@ int ZEngine::DisplayDepth()
 | 
				
			||||||
    return mScreen->format->BitsPerPixel;
 | 
					    return mScreen->format->BitsPerPixel;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef DEPRECIATED
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
int ZEngine::Width()
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    return mScreen->w;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
int ZEngine::Height()
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    return mScreen->h;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
int ZEngine::BPP()
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    return mScreen->format->BitsPerPixel;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#endif //DEPRECIATED
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
bool ZEngine::IsFullscreen()
 | 
					bool ZEngine::IsFullscreen()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return mFullscreen;
 | 
					    return mFullscreen;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
/*******************************************************************************
 | 
					/*******************************************************************************
 | 
				
			||||||
        This file is Part of the ZEngine Library for 2D game development.
 | 
					        This file is Part of the ZEngine Library for 2D game development.
 | 
				
			||||||
                   Copyright (C) 2002, 2003 James Turk
 | 
					                  Copyright (C) 2002-2004 James Turk
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                     Licensed under a BSD-style license.
 | 
					                     Licensed under a BSD-style license.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,15 +8,6 @@
 | 
				
			||||||
     and the home of this Library is http://www.zengine.sourceforge.net
 | 
					     and the home of this Library is http://www.zengine.sourceforge.net
 | 
				
			||||||
*******************************************************************************/
 | 
					*******************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
    \file ZE_ZFont.cpp
 | 
					 | 
				
			||||||
    \brief Source file for ZFont.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Implementation of ZFont, the basic Font class for ZEngine.
 | 
					 | 
				
			||||||
    <br>$Id: ZE_ZFont.cpp,v 1.17 2003/12/24 04:43:36 cozman Exp $<br>
 | 
					 | 
				
			||||||
    \author James Turk
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "ZE_ZFont.h"
 | 
					#include "ZE_ZFont.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef USE_SDL_TTF
 | 
					#ifdef USE_SDL_TTF
 | 
				
			||||||
| 
						 | 
					@ -197,7 +188,7 @@ bool ZFont::IsUnderlined() const
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int ZFont::Height() const
 | 
					int ZFont::GetHeight() const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if(rFont)
 | 
					    if(rFont)
 | 
				
			||||||
        return TTF_FontHeight(rFont);
 | 
					        return TTF_FontHeight(rFont);
 | 
				
			||||||
| 
						 | 
					@ -208,7 +199,7 @@ int ZFont::Height() const
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int ZFont::LineSkip() const
 | 
					int ZFont::GetLineSkip() const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if(rFont)
 | 
					    if(rFont)
 | 
				
			||||||
        return TTF_FontLineSkip(rFont);
 | 
					        return TTF_FontLineSkip(rFont);
 | 
				
			||||||
| 
						 | 
					@ -219,7 +210,7 @@ int ZFont::LineSkip() const
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int ZFont::StringWidth(std::string text) const
 | 
					int ZFont::CalcStringWidth(std::string text) const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    int w,h;
 | 
					    int w,h;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -235,7 +226,7 @@ int ZFont::StringWidth(std::string text) const
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int ZFont::StringHeight(std::string text) const
 | 
					int ZFont::CalcStringHeight(std::string text) const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    int w,h;
 | 
					    int w,h;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
/*******************************************************************************
 | 
					/*******************************************************************************
 | 
				
			||||||
        This file is Part of the ZEngine Library for 2D game development.
 | 
					        This file is Part of the ZEngine Library for 2D game development.
 | 
				
			||||||
                   Copyright (C) 2002, 2003 James Turk
 | 
					                  Copyright (C) 2002-2004 James Turk
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                     Licensed under a BSD-style license.
 | 
					                     Licensed under a BSD-style license.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,98 +8,12 @@
 | 
				
			||||||
     and the home of this Library is http://www.zengine.sourceforge.net
 | 
					     and the home of this Library is http://www.zengine.sourceforge.net
 | 
				
			||||||
*******************************************************************************/
 | 
					*******************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
    \file ZE_ZImage.cpp
 | 
					 | 
				
			||||||
    \brief Source file for ZImage.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Implementation of ZImage, the Image class for ZEngine.
 | 
					 | 
				
			||||||
    <br>$Id: ZE_ZImage.cpp,v 1.54 2003/12/24 04:43:36 cozman Exp $<br>
 | 
					 | 
				
			||||||
    \author James Turk
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "ZE_ZImage.h"
 | 
					#include "ZE_ZImage.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace ZE
 | 
					namespace ZE
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if (GFX_BACKEND == ZE_OGL)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
//from SDL's testgl.c power_of_two
 | 
					 | 
				
			||||||
int ZImage::PowerOfTwo(int num) const
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    int value = 1;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    while(value < num) //texture coord must be >= input
 | 
					 | 
				
			||||||
        value <<= 1;     //value <<= 1 is the same as value *= 2
 | 
					 | 
				
			||||||
    return value;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
//from SDL's testgl.c SDL_GL_LoadTexture
 | 
					 | 
				
			||||||
GLuint ZImage::SurfaceToTexture(SDL_Surface *surface, GLfloat *texcoord) const
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    GLuint texture;
 | 
					 | 
				
			||||||
    int w, h;
 | 
					 | 
				
			||||||
    SDL_Surface *temp;
 | 
					 | 
				
			||||||
    SDL_Rect area;
 | 
					 | 
				
			||||||
    Uint32 saved_flags;
 | 
					 | 
				
			||||||
    Uint8  saved_alpha;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    //expand width and height to nearest powers of 2
 | 
					 | 
				
			||||||
    w = PowerOfTwo(surface->w);
 | 
					 | 
				
			||||||
    h = PowerOfTwo(surface->h);
 | 
					 | 
				
			||||||
    texcoord[0] = 0.0f; //min X
 | 
					 | 
				
			||||||
    texcoord[1] = 0.0f; //min Y
 | 
					 | 
				
			||||||
    texcoord[2] = (GLfloat)surface->w / w;  //max X
 | 
					 | 
				
			||||||
    texcoord[3] = (GLfloat)surface->h / h;  //max Y
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    temp = SDL_CreateRGBSurface(
 | 
					 | 
				
			||||||
        SDL_SWSURFACE,
 | 
					 | 
				
			||||||
        w, h,
 | 
					 | 
				
			||||||
        32,
 | 
					 | 
				
			||||||
#if SDL_BYTEORDER == SDL_LIL_ENDIAN //endian specific color masks
 | 
					 | 
				
			||||||
        0x000000FF, 
 | 
					 | 
				
			||||||
        0x0000FF00, 
 | 
					 | 
				
			||||||
        0x00FF0000, 
 | 
					 | 
				
			||||||
        0xFF000000
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
        0xFF000000,
 | 
					 | 
				
			||||||
        0x00FF0000, 
 | 
					 | 
				
			||||||
        0x0000FF00, 
 | 
					 | 
				
			||||||
        0x000000FF
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
    );
 | 
					 | 
				
			||||||
    if(!temp)  //failure in CreateRGBSurface
 | 
					 | 
				
			||||||
        return 0;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    //save alpha
 | 
					 | 
				
			||||||
    saved_flags = surface->flags&(SDL_SRCALPHA|SDL_RLEACCELOK);
 | 
					 | 
				
			||||||
    saved_alpha = surface->format->alpha;
 | 
					 | 
				
			||||||
    if((saved_flags & SDL_SRCALPHA) == SDL_SRCALPHA)
 | 
					 | 
				
			||||||
        SDL_SetAlpha(surface, 0, 0);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    //copy surface (do not alter passed surface to allow this function to be used in special situations)
 | 
					 | 
				
			||||||
    area.x = 0;
 | 
					 | 
				
			||||||
    area.y = 0;
 | 
					 | 
				
			||||||
    area.w = static_cast<Sint16>(surface->w);
 | 
					 | 
				
			||||||
    area.h = static_cast<Sint16>(surface->h);
 | 
					 | 
				
			||||||
    SDL_BlitSurface(surface, &area, temp, &area);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    //restore saved alpha
 | 
					 | 
				
			||||||
    if((saved_flags & SDL_SRCALPHA) == SDL_SRCALPHA)
 | 
					 | 
				
			||||||
        SDL_SetAlpha(surface, saved_flags, saved_alpha);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    //create the OpenGL texture
 | 
					 | 
				
			||||||
    glGenTextures(1, &texture); 
 | 
					 | 
				
			||||||
    //setup texture parmaters
 | 
					 | 
				
			||||||
    glBindTexture(GL_TEXTURE_2D, texture);
 | 
					 | 
				
			||||||
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
 | 
					 | 
				
			||||||
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
 | 
					 | 
				
			||||||
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, temp->pixels);
 | 
					 | 
				
			||||||
    SDL_FreeSurface(temp); //temp surface no longer needed
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return texture;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
#endif //GFX_BACKEND == ZE_OGL
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
ZImage::ZImage() : 
 | 
					ZImage::ZImage() : 
 | 
				
			||||||
    rEngine(ZEngine::GetInstance()),
 | 
					    rEngine(ZEngine::GetInstance()),
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
/*******************************************************************************
 | 
					/*******************************************************************************
 | 
				
			||||||
        This file is Part of the ZEngine Library for 2D game development.
 | 
					        This file is Part of the ZEngine Library for 2D game development.
 | 
				
			||||||
                   Copyright (C) 2002, 2003 James Turk
 | 
					                  Copyright (C) 2002-2004 James Turk
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                     Licensed under a BSD-style license.
 | 
					                     Licensed under a BSD-style license.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,15 +8,6 @@
 | 
				
			||||||
     and the home of this Library is http://www.zengine.sourceforge.net
 | 
					     and the home of this Library is http://www.zengine.sourceforge.net
 | 
				
			||||||
*******************************************************************************/
 | 
					*******************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
    \file ZE_ZMusic.cpp
 | 
					 | 
				
			||||||
    \brief Source file for ZMusic.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Implementation of ZMusic, the basic Music class for ZEngine.
 | 
					 | 
				
			||||||
    <br>$Id: ZE_ZMusic.cpp,v 1.13 2003/12/24 04:43:36 cozman Exp $<br>
 | 
					 | 
				
			||||||
    \author James Turk
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "ZE_ZMusic.h"
 | 
					#include "ZE_ZMusic.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef USE_SDL_MIXER
 | 
					#ifdef USE_SDL_MIXER
 | 
				
			||||||
| 
						 | 
					@ -158,7 +149,7 @@ bool ZMusic::IsPaused() const
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int ZMusic::Volume() const
 | 
					int ZMusic::GetVolume() const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if(rMusic)
 | 
					    if(rMusic)
 | 
				
			||||||
        return Mix_VolumeMusic(-1);
 | 
					        return Mix_VolumeMusic(-1);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
/*******************************************************************************
 | 
					/*******************************************************************************
 | 
				
			||||||
        This file is Part of the ZEngine Library for 2D game development.
 | 
					        This file is Part of the ZEngine Library for 2D game development.
 | 
				
			||||||
                   Copyright (C) 2002, 2003 James Turk
 | 
					                  Copyright (C) 2002-2004 James Turk
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                     Licensed under a BSD-style license.
 | 
					                     Licensed under a BSD-style license.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,17 +8,6 @@
 | 
				
			||||||
     and the home of this Library is http://www.zengine.sourceforge.net
 | 
					     and the home of this Library is http://www.zengine.sourceforge.net
 | 
				
			||||||
*******************************************************************************/
 | 
					*******************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
    \file ZE_ZRandGen.cpp
 | 
					 | 
				
			||||||
    \brief Source file for ZRandGen.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Implementation file for ZRandGen, an OO encapsulated version of the Mersenne Twister.
 | 
					 | 
				
			||||||
    This implementation is derived from the original mt19937ar.c source from
 | 
					 | 
				
			||||||
    http://www.math.keio.ac.jp/matumoto/emt.html. See source for MT license.
 | 
					 | 
				
			||||||
    <br>$Id: ZE_ZRandGen.cpp,v 1.2 2003/07/12 01:25:42 cozman Exp $<br>
 | 
					 | 
				
			||||||
    \author James Turk, some code from Mersenne Twister.
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "ZE_ZRandGen.h"
 | 
					#include "ZE_ZRandGen.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace ZE
 | 
					namespace ZE
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
/*******************************************************************************
 | 
					/*******************************************************************************
 | 
				
			||||||
        This file is Part of the ZEngine Library for 2D game development.
 | 
					        This file is Part of the ZEngine Library for 2D game development.
 | 
				
			||||||
                   Copyright (C) 2002, 2003 James Turk
 | 
					                  Copyright (C) 2002-2004 James Turk
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                     Licensed under a BSD-style license.
 | 
					                     Licensed under a BSD-style license.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,15 +8,6 @@
 | 
				
			||||||
     and the home of this Library is http://www.zengine.sourceforge.net
 | 
					     and the home of this Library is http://www.zengine.sourceforge.net
 | 
				
			||||||
*******************************************************************************/
 | 
					*******************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
    \file ZE_ZRect.cpp
 | 
					 | 
				
			||||||
    \brief Source file for ZRect.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Implementation of ZRect, the Rectangle class for ZEngine.
 | 
					 | 
				
			||||||
    <br>$Id: ZE_ZRect.cpp,v 1.15 2003/11/24 22:20:49 cozman Exp $<br>
 | 
					 | 
				
			||||||
    \author James Turk
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "ZE_ZRect.h"
 | 
					#include "ZE_ZRect.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace ZE
 | 
					namespace ZE
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
/*******************************************************************************
 | 
					/*******************************************************************************
 | 
				
			||||||
        This file is Part of the ZEngine Library for 2D game development.
 | 
					        This file is Part of the ZEngine Library for 2D game development.
 | 
				
			||||||
                   Copyright (C) 2002, 2003 James Turk
 | 
					                  Copyright (C) 2002-2004 James Turk
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                     Licensed under a BSD-style license.
 | 
					                     Licensed under a BSD-style license.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,15 +8,6 @@
 | 
				
			||||||
     and the home of this Library is http://www.zengine.sourceforge.net
 | 
					     and the home of this Library is http://www.zengine.sourceforge.net
 | 
				
			||||||
*******************************************************************************/
 | 
					*******************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
    \file ZE_ZSound.cpp
 | 
					 | 
				
			||||||
    \brief Source file for ZSound.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Implementation of ZSound, the basic Sound class for ZEngine.
 | 
					 | 
				
			||||||
    <br>$Id: ZE_ZSound.cpp,v 1.15 2003/12/24 04:43:36 cozman Exp $<br>
 | 
					 | 
				
			||||||
    \author James Turk
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "ZE_ZSound.h"
 | 
					#include "ZE_ZSound.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef USE_SDL_MIXER
 | 
					#ifdef USE_SDL_MIXER
 | 
				
			||||||
| 
						 | 
					@ -170,7 +161,7 @@ bool ZSound::IsPaused() const
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int ZSound::Volume() const
 | 
					int ZSound::GetVolume() const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if(rSound)
 | 
					    if(rSound)
 | 
				
			||||||
        return Mix_VolumeChunk(rSound,-1);
 | 
					        return Mix_VolumeChunk(rSound,-1);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
/*******************************************************************************
 | 
					/*******************************************************************************
 | 
				
			||||||
        This file is Part of the ZEngine Library for 2D game development.
 | 
					        This file is Part of the ZEngine Library for 2D game development.
 | 
				
			||||||
                   Copyright (C) 2002, 2003 James Turk
 | 
					                  Copyright (C) 2002-2004 James Turk
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                     Licensed under a BSD-style license.
 | 
					                     Licensed under a BSD-style license.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,15 +8,6 @@
 | 
				
			||||||
     and the home of this Library is http://www.zengine.sourceforge.net
 | 
					     and the home of this Library is http://www.zengine.sourceforge.net
 | 
				
			||||||
*******************************************************************************/
 | 
					*******************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
    \file ZE_ZTimer.cpp
 | 
					 | 
				
			||||||
    \brief Source file for ZTimer.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Implementation of ZTimer, the basic Timer class for ZEngine.
 | 
					 | 
				
			||||||
    <br>$Id: ZE_ZTimer.cpp,v 1.12 2003/11/24 22:20:49 cozman Exp $<br>
 | 
					 | 
				
			||||||
    \author James Turk
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "ZE_ZTimer.h"
 | 
					#include "ZE_ZTimer.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace ZE
 | 
					namespace ZE
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue