added const modifiers

This commit is contained in:
James Turk 2003-01-16 05:45:58 +00:00
parent e969faa5a9
commit c21b7984ee
16 changed files with 113 additions and 113 deletions

View File

@ -13,7 +13,7 @@
File: Types/ZE_ZConfigFile.h <br> File: Types/ZE_ZConfigFile.h <br>
Description: Header file for ZEngine INI-Style Config Files.<br> Description: Header file for ZEngine INI-Style Config Files.<br>
Author(s): James Turk <br> Author(s): James Turk <br>
$Id: ZE_ZConfigFile.h,v 1.5 2002/12/29 06:50:19 cozman Exp $<br> $Id: ZE_ZConfigFile.h,v 1.6 2003/01/16 05:46:39 cozman Exp $<br>
\file ZE_ZConfigFile.h \file ZE_ZConfigFile.h
\brief Definition file for ZConfigFile. \brief Definition file for ZConfigFile.
@ -84,7 +84,7 @@ class ZConfigFile : public ZObject
\param str The string to get a clean version of. \param str The string to get a clean version of.
\return Cleaned string. \return Cleaned string.
**/ **/
string CleanString(string str); string CleanString(string str) const;
/*! /*!
\brief Check if a section exists. \brief Check if a section exists.
@ -93,7 +93,7 @@ class ZConfigFile : public ZObject
\param sec Section to check for. \param sec Section to check for.
\return bool, true if section exists in file. \return bool, true if section exists in file.
**/ **/
bool Exists(string sec); bool Exists(string sec) const;
/*! /*!
\brief Check if a variable exists. \brief Check if a variable exists.
@ -103,7 +103,7 @@ class ZConfigFile : public ZObject
\param var Variable to check for. \param var Variable to check for.
\return bool, true if section exists in file. \return bool, true if section exists in file.
**/ **/
bool Exists(string sec, string var); bool Exists(string sec, string var) const;
/*! /*!
\brief Internal function to set variables. \brief Internal function to set variables.
@ -124,7 +124,7 @@ class ZConfigFile : public ZObject
\param defVal Value to return if variable doesnt exist. \param defVal Value to return if variable doesnt exist.
\return Value of variable. \return Value of variable.
**/ **/
string GetVariable(string sec, string var, string defVal); string GetVariable(string sec, string var, string defVal) const;
public: public:
@ -167,7 +167,7 @@ class ZConfigFile : public ZObject
\param defVal Value to return if var does not exist within section. \param defVal Value to return if var does not exist within section.
\return Contents of the variable in integer format. \return Contents of the variable in integer format.
**/ **/
int GetInt(string section, string var, int defVal); int GetInt(string section, string var, int defVal) const;
/*! /*!
\brief Get value in boolean format from file. \brief Get value in boolean format from file.
@ -179,7 +179,7 @@ class ZConfigFile : public ZObject
\param defVal Value to return if var does not exist within section. \param defVal Value to return if var does not exist within section.
\return Contents of the variable in boolean format. \return Contents of the variable in boolean format.
**/ **/
bool GetBool(string section, string var, bool defVal); bool GetBool(string section, string var, bool defVal) const;
/*! /*!
\brief Get value in string format from file. \brief Get value in string format from file.
@ -190,7 +190,7 @@ class ZConfigFile : public ZObject
\param defVal Value to return if var does not exist within section. \param defVal Value to return if var does not exist within section.
\return Contents of the variable in string format. \return Contents of the variable in string format.
**/ **/
string GetString(string section, string var, string defVal); string GetString(string section, string var, string defVal) const;
/*! /*!
\brief Set value in integer format in file. \brief Set value in integer format in file.

View File

@ -13,7 +13,7 @@
File: ZE_ZError.h <br> File: ZE_ZError.h <br>
Description: Header file for ZEngine Error Object. <br> Description: Header file for ZEngine Error Object. <br>
Author(s): James Turk <br> Author(s): James Turk <br>
$Id: ZE_ZError.h,v 1.3 2003/01/16 05:06:54 cozman Exp $<br> $Id: ZE_ZError.h,v 1.4 2003/01/16 05:46:39 cozman Exp $<br>
\file ZE_ZError.h \file ZE_ZError.h
\brief Definition file for ZError. \brief Definition file for ZError.
@ -109,14 +109,14 @@ class ZError
Access ZErrorCode of the ZError object. Access ZErrorCode of the ZError object.
\return The error ZErrorCode. \return The error ZErrorCode.
**/ **/
ZErrorCode Code(); ZErrorCode Code() const;
/*! /*!
\brief Get formatted string for log file. \brief Get formatted string for log file.
Return the string to be written to the logfile. Called by ZEngine in LogError. Return the string to be written to the logfile. Called by ZEngine in LogError.
**/ **/
string LogString(); string LogString() const;
}; };
} }

View File

@ -13,7 +13,7 @@
File: ZE_ZFont.h <br> File: ZE_ZFont.h <br>
Description: Header file for core ZEngine Font Object. <br> Description: Header file for core ZEngine Font Object. <br>
Author(s): James Turk <br> Author(s): James Turk <br>
$Id: ZE_ZFont.h,v 1.3 2002/12/29 06:50:19 cozman Exp $<br> $Id: ZE_ZFont.h,v 1.4 2003/01/16 05:46:39 cozman Exp $<br>
\file ZE_ZFont.h \file ZE_ZFont.h
\brief Definition file for ZFont. \brief Definition file for ZFont.
@ -105,7 +105,7 @@ class ZFont : public ZObject
\param text String to write. \param text String to write.
\param image ZImage to draw to. \param image ZImage to draw to.
**/ **/
void DrawText(string text, ZImage &image); void DrawText(string text, ZImage &image) const;
/*! /*!
\brief Draws a string with a colored background to a ZImage. \brief Draws a string with a colored background to a ZImage.
@ -114,7 +114,7 @@ class ZFont : public ZObject
\param text String to write. \param text String to write.
\param image ZImage to draw to. \param image ZImage to draw to.
**/ **/
void DrawShadedText(string text, ZImage &image); void DrawShadedText(string text, ZImage &image) const;
/*! /*!
\brief Set Text rColor. \brief Set Text rColor.
@ -164,7 +164,7 @@ class ZFont : public ZObject
Check if file is loaded and pointer to data is non-NULL. Check if file is loaded and pointer to data is non-NULL.
\return Loaded or Unloaded state of data. \return Loaded or Unloaded state of data.
**/ **/
bool IsLoaded(); bool IsLoaded() const;
/*! /*!
\brief Get Bold Setting. \brief Get Bold Setting.
@ -172,7 +172,7 @@ class ZFont : public ZObject
Check if font output is currently bold. Check if font output is currently bold.
\return True or False state of bold. \return True or False state of bold.
**/ **/
bool IsBold(); bool IsBold() const;
/*! /*!
\brief Get Italic Setting. \brief Get Italic Setting.
@ -180,7 +180,7 @@ class ZFont : public ZObject
Check if font output is currently italic. Check if font output is currently italic.
\return True or False state of italic. \return True or False state of italic.
**/ **/
bool IsItalic(); bool IsItalic() const;
/*! /*!
\brief Get Underlined Setting. \brief Get Underlined Setting.
@ -188,7 +188,7 @@ class ZFont : public ZObject
Check if font output is currently underline. Check if font output is currently underline.
\return True or False state of underline. \return True or False state of underline.
**/ **/
bool IsUnderlined(); bool IsUnderlined() const;
/*! /*!
\brief Get Height of Font. \brief Get Height of Font.
@ -196,7 +196,7 @@ class ZFont : public ZObject
Check font height as reported by SDL_ttf. Check font height as reported by SDL_ttf.
\return Height of font. \return Height of font.
**/ **/
int Height(); int Height() const;
/*! /*!
\brief Get Line Skip for Font. \brief Get Line Skip for Font.
@ -204,7 +204,7 @@ class ZFont : public ZObject
Check font line skip as reported by SDL_ttf. Check font line skip as reported by SDL_ttf.
\return Recommended Line Skip of font. \return Recommended Line Skip of font.
**/ **/
int LineSkip(); int LineSkip() const;
/*! /*!
\brief Get String Width. \brief Get String Width.
@ -213,7 +213,7 @@ class ZFont : public ZObject
\param text String to get width of. \param text String to get width of.
\return Width of String in Current font. \return Width of String in Current font.
**/ **/
int StringWidth(string text); int StringWidth(string text) const;
/*! /*!
\brief Get String Height. \brief Get String Height.
@ -222,7 +222,7 @@ class ZFont : public ZObject
\param text String to get height of. \param text String to get height of.
\return Height of String in Current font. \return Height of String in Current font.
**/ **/
int StringHeight(string text); int StringHeight(string text) const;
}; };
} }

View File

@ -13,7 +13,7 @@
File: ZE_ZImage.h <br> File: ZE_ZImage.h <br>
Description: Header file for core ZEngine Image and Texture Object. <br> Description: Header file for core ZEngine Image and Texture Object. <br>
Author(s): James Turk, Gamer Tazar <br> Author(s): James Turk, Gamer Tazar <br>
$Id: ZE_ZImage.h,v 1.7 2002/12/29 07:22:02 cozman Exp $<br> $Id: ZE_ZImage.h,v 1.8 2003/01/16 05:46:39 cozman Exp $<br>
\file ZE_ZImage.h \file ZE_ZImage.h
\brief Definition file for ZImage. \brief Definition file for ZImage.
@ -193,7 +193,7 @@ class ZImage : public ZObject
OpenGL related bind call, only available in case you want to bind image in 3D. 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. Draw uses this but the average user should never need to call this.
**/ **/
void Bind(); void Bind() const;
/*! /*!
\brief Draw Image to Screen. \brief Draw Image to Screen.
@ -202,7 +202,7 @@ class ZImage : public ZObject
\param x X coord to draw Image to. \param x X coord to draw Image to.
\param y Y coord to draw Image to. \param y Y coord to draw Image to.
**/ **/
void Draw(float x, float y); void Draw(float x, float y) const;
/*! /*!
\brief Draw Image rotated to screen. \brief Draw Image rotated to screen.
@ -212,7 +212,7 @@ class ZImage : public ZObject
\param y Y coord to draw Image to. \param y Y coord to draw Image to.
\param angle Angle in degrees to rotate image. \param angle Angle in degrees to rotate image.
**/ **/
void DrawRotated(int x, int y, float angle); void DrawRotated(int x, int y, float angle) const;
///////////// /////////////
//Accessors// //Accessors//
@ -224,14 +224,14 @@ class ZImage : public ZObject
Check if surface is a valid GL texture. (does not detect surface loss) Check if surface is a valid GL texture. (does not detect surface loss)
\return Loaded or Unloaded state of data. \return Loaded or Unloaded state of data.
**/ **/
bool IsLoaded(); bool IsLoaded() const;
/*! /*!
\brief Get SDL_Surface. \brief Get SDL_Surface.
Get SDL_Surface pointer to actual image data. Get SDL_Surface pointer to actual image data.
\return SDL_Surface* of rImage. \return SDL_Surface* of rImage.
**/ **/
SDL_Surface *Surface(); SDL_Surface *Surface() const;
/*! /*!
\brief Get Width. \brief Get Width.
@ -239,7 +239,7 @@ class ZImage : public ZObject
Get Current Width of Image. Get Current Width of Image.
\return Image Width. \return Image Width.
**/ **/
int Width(); int Width() const;
/*! /*!
\brief Get Height. \brief Get Height.
@ -247,7 +247,7 @@ class ZImage : public ZObject
Get Current Height of Image. Get Current Height of Image.
\return Image Height. \return Image Height.
**/ **/
int Height(); int Height() const;
}; };
} }

View File

@ -13,7 +13,7 @@
File: ZE_ZMusic.h <br> File: ZE_ZMusic.h <br>
Description: Header file for core ZEngine Music Wrapper Object. <br> Description: Header file for core ZEngine Music Wrapper Object. <br>
Author(s): James Turk <br> Author(s): James Turk <br>
$Id: ZE_ZMusic.h,v 1.3 2002/12/29 06:50:19 cozman Exp $<br> $Id: ZE_ZMusic.h,v 1.4 2003/01/16 05:46:39 cozman Exp $<br>
\file ZE_ZMusic.h \file ZE_ZMusic.h
\brief Definition file for ZMusic. \brief Definition file for ZMusic.
@ -99,28 +99,28 @@ class ZMusic : public ZObject
\param loopNum Number of times to loop song, defaults to zero. \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. \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) const;
/*! /*!
\brief Pause music. \brief Pause music.
Pause currently playing music. Pause currently playing music.
**/ **/
void Pause(); void Pause() const;
/*! /*!
\brief Unpause music. \brief Unpause music.
Unpause currently paused music. Unpause currently paused music.
**/ **/
void Unpause(); void Unpause() const;
/*! /*!
\brief Rewind music. \brief Rewind music.
Rewind music to beginning. Rewind music to beginning.
**/ **/
void Rewind(); void Rewind() const;
/*! /*!
\brief Stop music. \brief Stop music.
@ -128,7 +128,7 @@ class ZMusic : public ZObject
Stop currently playing music, if fadeTime is not zero, fade out over specified time. 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. \param fadeTime Milliseconds to fade out over, defaults to zero for immediate stop.
**/ **/
void Stop(int fadeTime=0); void Stop(int fadeTime=0) const;
/*! /*!
\brief Change Volume. \brief Change Volume.
@ -148,7 +148,7 @@ class ZMusic : public ZObject
Check if file is loaded and pointer to data is non-NULL. Check if file is loaded and pointer to data is non-NULL.
\return Loaded or Unloaded state of data. \return Loaded or Unloaded state of data.
**/ **/
bool IsLoaded(); bool IsLoaded() const;
/*! /*!
\brief Check if music is Playing. \brief Check if music is Playing.
@ -156,7 +156,7 @@ class ZMusic : public ZObject
Check if music is playing, specifically if it is not stopped. (Paused state should be checked for by IsPaused) 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. \return Playing / Not Playing State of Music.
**/ **/
bool IsPlaying(); bool IsPlaying() const;
/*! /*!
\brief Check if music is Paused. \brief Check if music is Paused.
@ -164,7 +164,7 @@ class ZMusic : public ZObject
Check if music is "playing" but currently paused. Check if music is "playing" but currently paused.
\return Paused / Not Paused State of Music. \return Paused / Not Paused State of Music.
**/ **/
bool IsPaused(); bool IsPaused() const;
/*! /*!
\brief Find Current Volume of Music. \brief Find Current Volume of Music.
@ -172,7 +172,7 @@ class ZMusic : public ZObject
Get current volume of music represented as a value from 0-128. Get current volume of music represented as a value from 0-128.
\return Volume of music, 0-128. \return Volume of music, 0-128.
**/ **/
int Volume(); int Volume() const;
}; };

View File

@ -13,7 +13,7 @@
File: ZE_ZRect.h <br> File: ZE_ZRect.h <br>
Description: Header file for core ZEngine Rectangle Object. <br> Description: Header file for core ZEngine Rectangle Object. <br>
Author(s): James Turk <br> Author(s): James Turk <br>
$Id: ZE_ZRect.h,v 1.4 2002/12/29 06:50:19 cozman Exp $<br> $Id: ZE_ZRect.h,v 1.5 2003/01/16 05:46:39 cozman Exp $<br>
\file ZE_ZRect.h \file ZE_ZRect.h
\brief Definition file for ZRect. \brief Definition file for ZRect.
@ -102,7 +102,7 @@ class ZRect
\param blue Blue component of color (0-255). \param blue Blue component of color (0-255).
\param alpha Alpha component of color (0-255). \param alpha Alpha component of color (0-255).
**/ **/
void Draw(Uint8 red, Uint8 green, Uint8 blue, Uint8 alpha=255); void Draw(Uint8 red, Uint8 green, Uint8 blue, Uint8 alpha=255) const;
/*! /*!
\brief Changes the location of the rectangle. \brief Changes the location of the rectangle.

View File

@ -13,7 +13,7 @@
File: ZE_ZSound.h <br> File: ZE_ZSound.h <br>
Description: Header file for core ZEngine Sound Wrapper Object. <br> Description: Header file for core ZEngine Sound Wrapper Object. <br>
Author(s): James Turk <br> Author(s): James Turk <br>
$Id: ZE_ZSound.h,v 1.3 2002/12/29 06:50:19 cozman Exp $<br> $Id: ZE_ZSound.h,v 1.4 2003/01/16 05:46:39 cozman Exp $<br>
\file ZE_ZSound.h \file ZE_ZSound.h
\brief Definition file for ZSound. \brief Definition file for ZSound.
@ -108,14 +108,14 @@ class ZSound : public ZObject
Pause currently playing sound. Pause currently playing sound.
**/ **/
void Pause(); void Pause() const;
/*! /*!
\brief Unpause sound. \brief Unpause sound.
Unpause currently playing sound. Unpause currently playing sound.
**/ **/
void Unpause(); void Unpause() const;
/*! /*!
\brief Stop sound. \brief Stop sound.
@ -123,7 +123,7 @@ class ZSound : public ZObject
Stop currently playing sound, if fadeTime is not zero, fade out over specified time. 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. \param fadeTime Milliseconds to fade out over, defaults to zero for immediate stop.
**/ **/
void Stop(int fadeTime=0); void Stop(int fadeTime=0) const;
/*! /*!
\brief Change Volume. \brief Change Volume.
@ -143,7 +143,7 @@ class ZSound : public ZObject
Check if file is loaded and pointer to data is non-NULL. Check if file is loaded and pointer to data is non-NULL.
\return Loaded or Unloaded state of data. \return Loaded or Unloaded state of data.
**/ **/
bool IsLoaded(); bool IsLoaded() const;
/*! /*!
\brief Check if sound is Playing. \brief Check if sound is Playing.
@ -151,7 +151,7 @@ class ZSound : public ZObject
Check if sound is playing, specifically if it is not stopped. (Paused state should be checked for by IsPaused) 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. \return Playing / Not Playing State of sound.
**/ **/
bool IsPlaying(); bool IsPlaying() const;
/*! /*!
\brief Check if sound is Paused. \brief Check if sound is Paused.
@ -159,7 +159,7 @@ class ZSound : public ZObject
Check if sound is "playing" but currently paused. Check if sound is "playing" but currently paused.
\return Paused / Not Paused State of Sound. \return Paused / Not Paused State of Sound.
**/ **/
bool IsPaused(); bool IsPaused() const;
/*! /*!
\brief Find Current Volume of Sound Channel. \brief Find Current Volume of Sound Channel.
@ -167,7 +167,7 @@ class ZSound : public ZObject
Get current volume of sound channel represented as a value from 0-128. Get current volume of sound channel represented as a value from 0-128.
\return Volume of sound channel, 0-128. \return Volume of sound channel, 0-128.
**/ **/
int Volume(); int Volume() const;
}; };

View File

@ -13,7 +13,7 @@
File: ZE_ZTimer.h <br> File: ZE_ZTimer.h <br>
Description: Header file for core ZEngine Timer Object. <br> Description: Header file for core ZEngine Timer Object. <br>
Author(s): James Turk <br> Author(s): James Turk <br>
$Id: ZE_ZTimer.h,v 1.3 2002/12/29 06:50:19 cozman Exp $<br> $Id: ZE_ZTimer.h,v 1.4 2003/01/16 05:46:39 cozman Exp $<br>
\file ZE_ZTimer.h \file ZE_ZTimer.h
\brief Definition file for ZTimer. \brief Definition file for ZTimer.
@ -52,7 +52,7 @@ class ZTimer : public ZObject
Protected method to get time from whichever timer is parent. Protected method to get time from whichever timer is parent.
\return Time on parent timer. \return Time on parent timer.
**/ **/
Uint32 GetParentTime(); Uint32 GetParentTime() const;
public: public:
@ -91,7 +91,7 @@ class ZTimer : public ZObject
Get current time accounting for time paused. Get current time accounting for time paused.
\return Current Timer Time. \return Current Timer Time.
**/ **/
Uint32 GetTime(); Uint32 GetTime() const;
/*! /*!
\brief Get paused state. \brief Get paused state.
@ -99,7 +99,7 @@ class ZTimer : public ZObject
Find out paused state of timer. Find out paused state of timer.
\return Paused state for timer. \return Paused state for timer.
**/ **/
bool IsPaused(); bool IsPaused() const;
}; };
} }

View File

@ -13,7 +13,7 @@
File: ZE_ZConfigFile.cpp <br> File: ZE_ZConfigFile.cpp <br>
Description: Implementation source file for ZConfigFile, the ZEngine INI-Style Config File. <br> Description: Implementation source file for ZConfigFile, the ZEngine INI-Style Config File. <br>
Author(s): James Turk <br> Author(s): James Turk <br>
$Id: ZE_ZConfigFile.cpp,v 1.3 2002/12/29 06:52:07 cozman Exp $<br> $Id: ZE_ZConfigFile.cpp,v 1.4 2003/01/16 05:45:58 cozman Exp $<br>
\file ZE_ZConfigFile.cpp \file ZE_ZConfigFile.cpp
\brief Source file for ZConfigFile. \brief Source file for ZConfigFile.
@ -26,7 +26,7 @@ $Id: ZE_ZConfigFile.cpp,v 1.3 2002/12/29 06:52:07 cozman Exp $<br>
namespace ZE namespace ZE
{ {
string ZConfigFile::CleanString(string str) string ZConfigFile::CleanString(string str) const
{ {
string tmpStr; string tmpStr;
bool inQuotes = false; bool inQuotes = false;
@ -46,9 +46,9 @@ string ZConfigFile::CleanString(string str)
return tmpStr; return tmpStr;
} }
bool ZConfigFile::Exists(string sec) bool ZConfigFile::Exists(string sec) const
{ {
list<ZCF_Section>::iterator secIter; list<ZCF_Section>::const_iterator secIter;
sec = CleanString(sec); sec = CleanString(sec);
@ -60,10 +60,10 @@ bool ZConfigFile::Exists(string sec)
return false; return false;
} }
bool ZConfigFile::Exists(string sec, string var) bool ZConfigFile::Exists(string sec, string var) const
{ {
list<ZCF_Section>::iterator secIter; list<ZCF_Section>::const_iterator secIter;
list<ZCF_Variable>::iterator varIter; list<ZCF_Variable>::const_iterator varIter;
sec = CleanString(sec); sec = CleanString(sec);
var = CleanString(var); var = CleanString(var);
@ -126,10 +126,10 @@ void ZConfigFile::SetVariable(string sec, string var, string val)
} }
} }
string ZConfigFile::GetVariable(string sec, string var, string defVal) string ZConfigFile::GetVariable(string sec, string var, string defVal) const
{ {
list<ZCF_Section>::iterator secIter; list<ZCF_Section>::const_iterator secIter;
list<ZCF_Variable>::iterator varIter; list<ZCF_Variable>::const_iterator varIter;
sec = CleanString(sec); sec = CleanString(sec);
var = CleanString(var); var = CleanString(var);
@ -199,7 +199,7 @@ void ZConfigFile::Process(string filename)
cfile.close(); cfile.close();
} }
int ZConfigFile::GetInt(string section, string var, int defVal) int ZConfigFile::GetInt(string section, string var, int defVal) const
{ {
string val; string val;
char tmp[20]; char tmp[20];
@ -218,7 +218,7 @@ int ZConfigFile::GetInt(string section, string var, int defVal)
return atoi(val.c_str()); return atoi(val.c_str());
} }
bool ZConfigFile::GetBool(string section, string var, bool defVal) bool ZConfigFile::GetBool(string section, string var, bool defVal) const
{ {
string val,tmp; string val,tmp;
@ -238,7 +238,7 @@ bool ZConfigFile::GetBool(string section, string var, bool defVal)
return defVal; return defVal;
} }
string ZConfigFile::GetString(string section, string var, string defVal) string ZConfigFile::GetString(string section, string var, string defVal) const
{ {
string val; string val;

View File

@ -13,7 +13,7 @@
File: ZE_ZError.cpp <br> File: ZE_ZError.cpp <br>
Description: Implementation source file for core ZEngine Error Object. <br> Description: Implementation source file for core ZEngine Error Object. <br>
Author(s): James Turk <br> Author(s): James Turk <br>
$Id: ZE_ZError.cpp,v 1.1 2003/01/15 05:40:09 cozman Exp $<br> $Id: ZE_ZError.cpp,v 1.2 2003/01/16 05:45:58 cozman Exp $<br>
\file ZE_ZError.cpp \file ZE_ZError.cpp
\brief Source file for ZError. \brief Source file for ZError.
@ -53,12 +53,12 @@ void ZError::Create(ZErrorCode code, string desc, string file, int line)
rLine = line; rLine = line;
} }
ZErrorCode ZError::Code() ZErrorCode ZError::Code() const
{ {
return rCode; return rCode;
} }
string ZError::LogString() string ZError::LogString() const
{ {
string msg; string msg;

View File

@ -13,7 +13,7 @@
File: ZE_ZFont.cpp <br> File: ZE_ZFont.cpp <br>
Description: Implementation source file for core ZEngine Font Object. <br> Description: Implementation source file for core ZEngine Font Object. <br>
Author(s): James Turk <br> Author(s): James Turk <br>
$Id: ZE_ZFont.cpp,v 1.4 2003/01/13 06:00:38 cozman Exp $<br> $Id: ZE_ZFont.cpp,v 1.5 2003/01/16 05:45:58 cozman Exp $<br>
\file ZE_ZFont.cpp \file ZE_ZFont.cpp
\brief Source file for ZFont. \brief Source file for ZFont.
@ -60,12 +60,12 @@ void ZFont::Release()
FreeFont(rFont); FreeFont(rFont);
} }
void ZFont::DrawText(string text, ZImage &image) void ZFont::DrawText(string text, ZImage &image) const
{ {
image.Attach(TTF_RenderText_Solid(rFont, text.c_str(), rColor)); image.Attach(TTF_RenderText_Solid(rFont, text.c_str(), rColor));
} }
void ZFont::DrawShadedText(string text, ZImage &image) void ZFont::DrawShadedText(string text, ZImage &image) const
{ {
image.Attach(TTF_RenderText_Shaded(rFont, text.c_str(), rColor, rBGColor)); image.Attach(TTF_RenderText_Shaded(rFont, text.c_str(), rColor, rBGColor));
} }
@ -108,12 +108,12 @@ void ZFont::Resize(int size)
Open(rFilename,size); Open(rFilename,size);
} }
bool ZFont::IsLoaded() bool ZFont::IsLoaded() const
{ {
return rFont != NULL; return rFont != NULL;
} }
bool ZFont::IsBold() bool ZFont::IsBold() const
{ {
if(rFont) if(rFont)
return (TTF_GetFontStyle(rFont) & TTF_STYLE_BOLD) > 0; return (TTF_GetFontStyle(rFont) & TTF_STYLE_BOLD) > 0;
@ -124,7 +124,7 @@ bool ZFont::IsBold()
} }
} }
bool ZFont::IsItalic() bool ZFont::IsItalic() const
{ {
if(rFont) if(rFont)
return (TTF_GetFontStyle(rFont) & TTF_STYLE_ITALIC) > 0; return (TTF_GetFontStyle(rFont) & TTF_STYLE_ITALIC) > 0;
@ -135,7 +135,7 @@ bool ZFont::IsItalic()
} }
} }
bool ZFont::IsUnderlined() bool ZFont::IsUnderlined() const
{ {
if(rFont) if(rFont)
return (TTF_GetFontStyle(rFont) & TTF_STYLE_UNDERLINE) > 0; return (TTF_GetFontStyle(rFont) & TTF_STYLE_UNDERLINE) > 0;
@ -146,7 +146,7 @@ bool ZFont::IsUnderlined()
} }
} }
int ZFont::Height() int ZFont::Height() const
{ {
if(rFont) if(rFont)
return TTF_FontHeight(rFont); return TTF_FontHeight(rFont);
@ -157,7 +157,7 @@ int ZFont::Height()
} }
} }
int ZFont::LineSkip() int ZFont::LineSkip() const
{ {
if(rFont) if(rFont)
return TTF_FontLineSkip(rFont); return TTF_FontLineSkip(rFont);
@ -168,7 +168,7 @@ int ZFont::LineSkip()
} }
} }
int ZFont::StringWidth(string text) int ZFont::StringWidth(string text) const
{ {
int w,h; int w,h;
@ -184,7 +184,7 @@ int ZFont::StringWidth(string text)
} }
} }
int ZFont::StringHeight(string text) int ZFont::StringHeight(string text) const
{ {
int w,h; int w,h;

View File

@ -13,7 +13,7 @@
File: ZE_ZImage.cpp <br> File: ZE_ZImage.cpp <br>
Description: Implementation source file for core ZEngine Image or Texture Object. <br> Description: Implementation source file for core ZEngine Image or Texture Object. <br>
Author(s): James Turk, Gamer Tazar <br> Author(s): James Turk, Gamer Tazar <br>
$Id: ZE_ZImage.cpp,v 1.14 2003/01/13 06:00:38 cozman Exp $<br> $Id: ZE_ZImage.cpp,v 1.15 2003/01/16 05:45:58 cozman Exp $<br>
\file ZE_ZImage.cpp \file ZE_ZImage.cpp
\brief Source file for ZImage. \brief Source file for ZImage.
@ -189,7 +189,7 @@ void ZImage::Resize(unsigned int width, unsigned int height)
rHeight = height; rHeight = height;
} }
void ZImage::Bind() void ZImage::Bind() const
{ {
if(!rTexID) if(!rTexID)
rEngine->ReportError(ZERR_NOIMAGE,"Bind"); rEngine->ReportError(ZERR_NOIMAGE,"Bind");
@ -197,7 +197,7 @@ void ZImage::Bind()
glBindTexture(GL_TEXTURE_2D, rTexID); glBindTexture(GL_TEXTURE_2D, rTexID);
} }
void ZImage::Draw(float x, float y) void ZImage::Draw(float x, float y) const
{ {
Bind(); Bind();
@ -209,7 +209,7 @@ void ZImage::Draw(float x, float y)
glEnd(); glEnd();
} }
void ZImage::DrawRotated(int x, int y, float angle) void ZImage::DrawRotated(int x, int y, float angle) const
{ {
float cX,cY; //center variables float cX,cY; //center variables
@ -229,22 +229,22 @@ void ZImage::DrawRotated(int x, int y, float angle)
glPopMatrix(); glPopMatrix();
} }
bool ZImage::IsLoaded() bool ZImage::IsLoaded() const
{ {
return glIsTexture(rTexID) == GL_TRUE; return glIsTexture(rTexID) == GL_TRUE;
} }
SDL_Surface* ZImage::Surface() SDL_Surface* ZImage::Surface() const
{ {
return rImage; return rImage;
} }
int ZImage::Width() int ZImage::Width() const
{ {
return rWidth; return rWidth;
} }
int ZImage::Height() int ZImage::Height() const
{ {
return rHeight; return rHeight;
} }

View File

@ -13,7 +13,7 @@
File: ZE_ZMusic.cpp <br> File: ZE_ZMusic.cpp <br>
Description: Implementation source file for core ZEngine Music Object. <br> Description: Implementation source file for core ZEngine Music Object. <br>
Author(s): James Turk <br> Author(s): James Turk <br>
$Id: ZE_ZMusic.cpp,v 1.4 2003/01/13 06:00:38 cozman Exp $<br> $Id: ZE_ZMusic.cpp,v 1.5 2003/01/16 05:45:58 cozman Exp $<br>
\file ZE_ZMusic.cpp \file ZE_ZMusic.cpp
\brief Source file for ZMusic. \brief Source file for ZMusic.
@ -58,7 +58,7 @@ void ZMusic::Release()
FreeMusic(rMusic); FreeMusic(rMusic);
} }
void ZMusic::Play(int loopNum, int fadeTime) void ZMusic::Play(int loopNum, int fadeTime) const
{ {
if(Mix_PlayingMusic()) //stop currently playing music if(Mix_PlayingMusic()) //stop currently playing music
Mix_HaltMusic(); Mix_HaltMusic();
@ -74,7 +74,7 @@ void ZMusic::Play(int loopNum, int fadeTime)
rEngine->ReportError(ZERR_NOMUSIC, "Play"); rEngine->ReportError(ZERR_NOMUSIC, "Play");
} }
void ZMusic::Pause() void ZMusic::Pause() const
{ {
if(rMusic) if(rMusic)
Mix_PauseMusic(); Mix_PauseMusic();
@ -82,7 +82,7 @@ void ZMusic::Pause()
rEngine->ReportError(ZERR_NOMUSIC, "Pause"); rEngine->ReportError(ZERR_NOMUSIC, "Pause");
} }
void ZMusic::Unpause() void ZMusic::Unpause() const
{ {
if(rMusic) if(rMusic)
Mix_ResumeMusic(); Mix_ResumeMusic();
@ -90,7 +90,7 @@ void ZMusic::Unpause()
rEngine->ReportError(ZERR_NOMUSIC, "Unpause"); rEngine->ReportError(ZERR_NOMUSIC, "Unpause");
} }
void ZMusic::Rewind() void ZMusic::Rewind() const
{ {
if(rMusic) if(rMusic)
Mix_RewindMusic(); Mix_RewindMusic();
@ -98,7 +98,7 @@ void ZMusic::Rewind()
rEngine->ReportError(ZERR_NOMUSIC, "Rewind"); rEngine->ReportError(ZERR_NOMUSIC, "Rewind");
} }
void ZMusic::Stop(int fadeTime) void ZMusic::Stop(int fadeTime) const
{ {
if(rMusic) if(rMusic)
{ {
@ -119,12 +119,12 @@ void ZMusic::SetVolume(int volume)
rEngine->ReportError(ZERR_NOMUSIC, "SetVolume"); rEngine->ReportError(ZERR_NOMUSIC, "SetVolume");
} }
bool ZMusic::IsLoaded() bool ZMusic::IsLoaded() const
{ {
return rMusic != NULL; return rMusic != NULL;
} }
bool ZMusic::IsPlaying() bool ZMusic::IsPlaying() const
{ {
if(rMusic) if(rMusic)
return Mix_PlayingMusic() > 0; return Mix_PlayingMusic() > 0;
@ -135,7 +135,7 @@ bool ZMusic::IsPlaying()
} }
} }
bool ZMusic::IsPaused() bool ZMusic::IsPaused() const
{ {
if(rMusic) if(rMusic)
return Mix_PausedMusic() > 0; return Mix_PausedMusic() > 0;
@ -146,7 +146,7 @@ bool ZMusic::IsPaused()
} }
} }
int ZMusic::Volume() int ZMusic::Volume() const
{ {
if(rMusic) if(rMusic)
return Mix_VolumeMusic(-1); return Mix_VolumeMusic(-1);

View File

@ -13,7 +13,7 @@
File: ZE_ZRect.cpp <br> File: ZE_ZRect.cpp <br>
Description: Implementation source file for core ZEngine Rectangle Object. <br> Description: Implementation source file for core ZEngine Rectangle Object. <br>
Author(s): James Turk <br> Author(s): James Turk <br>
$Id: ZE_ZRect.cpp,v 1.6 2003/01/08 06:07:07 cozman Exp $<br> $Id: ZE_ZRect.cpp,v 1.7 2003/01/16 05:45:58 cozman Exp $<br>
\file ZE_ZRect.cpp \file ZE_ZRect.cpp
\brief Source file for ZRect. \brief Source file for ZRect.
@ -86,7 +86,7 @@ bool ZRect::operator<(const ZRect &rhs) const
} }
} }
void ZRect::Draw(Uint8 red, Uint8 green, Uint8 blue, Uint8 alpha) void ZRect::Draw(Uint8 red, Uint8 green, Uint8 blue, Uint8 alpha) const
{ {
glBindTexture(GL_TEXTURE_2D,0); //reset to blank texture glBindTexture(GL_TEXTURE_2D,0); //reset to blank texture
glColor4ub(red,green,blue,alpha); glColor4ub(red,green,blue,alpha);

View File

@ -13,7 +13,7 @@
File: ZE_ZSound.cpp <br> File: ZE_ZSound.cpp <br>
Description: Implementation source file for core ZEngine Sound Object. <br> Description: Implementation source file for core ZEngine Sound Object. <br>
Author(s): James Turk <br> Author(s): James Turk <br>
$Id: ZE_ZSound.cpp,v 1.4 2003/01/13 06:00:38 cozman Exp $<br> $Id: ZE_ZSound.cpp,v 1.5 2003/01/16 05:45:58 cozman Exp $<br>
\file ZE_ZSound.cpp \file ZE_ZSound.cpp
\brief Source file for ZSound. \brief Source file for ZSound.
@ -77,7 +77,7 @@ void ZSound::Play(int loopNum, int fadeTime)
rEngine->ReportError(ZERR_NOSOUND, "Play"); rEngine->ReportError(ZERR_NOSOUND, "Play");
} }
void ZSound::Pause() void ZSound::Pause() const
{ {
if(rSound && rChannelID >= 0) if(rSound && rChannelID >= 0)
Mix_Pause(rChannelID); Mix_Pause(rChannelID);
@ -85,7 +85,7 @@ void ZSound::Pause()
rEngine->ReportError(ZERR_NOSOUND, "Pause"); rEngine->ReportError(ZERR_NOSOUND, "Pause");
} }
void ZSound::Unpause() void ZSound::Unpause() const
{ {
if(rSound && rChannelID >= 0) if(rSound && rChannelID >= 0)
Mix_Resume(rChannelID); Mix_Resume(rChannelID);
@ -93,7 +93,7 @@ void ZSound::Unpause()
rEngine->ReportError(ZERR_NOSOUND, "Unpause"); rEngine->ReportError(ZERR_NOSOUND, "Unpause");
} }
void ZSound::Stop(int fadeTime) void ZSound::Stop(int fadeTime) const
{ {
if(rSound && rChannelID >= 0) if(rSound && rChannelID >= 0)
{ {
@ -114,12 +114,12 @@ void ZSound::SetVolume(int volume)
rEngine->ReportError(ZERR_NOSOUND, "SetVolume"); rEngine->ReportError(ZERR_NOSOUND, "SetVolume");
} }
bool ZSound::IsLoaded() bool ZSound::IsLoaded() const
{ {
return rSound != NULL; return rSound != NULL;
} }
bool ZSound::IsPlaying() bool ZSound::IsPlaying() const
{ {
if(rSound && rChannelID >= 0) if(rSound && rChannelID >= 0)
return Mix_Playing(rChannelID) > 0; return Mix_Playing(rChannelID) > 0;
@ -131,7 +131,7 @@ bool ZSound::IsPlaying()
} }
} }
bool ZSound::IsPaused() bool ZSound::IsPaused() const
{ {
if(rSound && rChannelID >= 0) if(rSound && rChannelID >= 0)
return Mix_Paused(rChannelID) > 0; return Mix_Paused(rChannelID) > 0;
@ -142,7 +142,7 @@ bool ZSound::IsPaused()
} }
} }
int ZSound::Volume() int ZSound::Volume() const
{ {
if(rSound) if(rSound)
return Mix_VolumeChunk(rSound,-1); return Mix_VolumeChunk(rSound,-1);

View File

@ -13,7 +13,7 @@
File: ZE_ZTimer.cpp <br> File: ZE_ZTimer.cpp <br>
Description: Implementation source file for core ZEngine Timer Object. <br> Description: Implementation source file for core ZEngine Timer Object. <br>
Author(s): James Turk <br> Author(s): James Turk <br>
$Id: ZE_ZTimer.cpp,v 1.3 2002/12/29 06:52:07 cozman Exp $<br> $Id: ZE_ZTimer.cpp,v 1.4 2003/01/16 05:45:58 cozman Exp $<br>
\file ZE_ZTimer.cpp \file ZE_ZTimer.cpp
\brief Source file for ZTimer. \brief Source file for ZTimer.
@ -26,7 +26,7 @@ $Id: ZE_ZTimer.cpp,v 1.3 2002/12/29 06:52:07 cozman Exp $<br>
namespace ZE namespace ZE
{ {
Uint32 ZTimer::GetParentTime() Uint32 ZTimer::GetParentTime() const
{ {
if(rUseZEngine) if(rUseZEngine)
return rEngine->GetTime(); return rEngine->GetTime();
@ -65,7 +65,7 @@ void ZTimer::Unpause()
} }
} }
Uint32 ZTimer::GetTime() Uint32 ZTimer::GetTime() const
{ {
if(rPaused) if(rPaused)
return GetParentTime() - (rPausedTime + (GetParentTime() - rLastPause)); return GetParentTime() - (rPausedTime + (GetParentTime() - rLastPause));
@ -73,7 +73,7 @@ Uint32 ZTimer::GetTime()
return GetParentTime() - rPausedTime; return GetParentTime() - rPausedTime;
} }
bool ZTimer::IsPaused() bool ZTimer::IsPaused() const
{ {
return rPaused; return rPaused;
} }