explicitly use std in STL & ZE in ZEngine areas

This commit is contained in:
cozman 2003-06-11 00:19:29 +00:00
parent 560e916eae
commit 1166ec33c1
12 changed files with 50 additions and 51 deletions

View File

@ -13,7 +13,7 @@
\brief Definition file for GewiEngine. \brief Definition file for GewiEngine.
Definition file for GewiEngine, core engine for Gewi GUI control. Definition file for GewiEngine, core engine for Gewi GUI control.
<br>$Id: GewiEngine.h,v 1.6 2003/06/10 23:56:09 cozman Exp $<br> <br>$Id: GewiEngine.h,v 1.7 2003/06/11 00:19:40 cozman Exp $<br>
\author James Turk \author James Turk
**/ **/
@ -51,9 +51,9 @@ class GewiEngine
//! Singleton static instance of GewiEngine. //! Singleton static instance of GewiEngine.
static GewiEngine *sInstance; static GewiEngine *sInstance;
//! Vector of pointers to ZImages, used by resource management system. //! Vector of pointers to ZImages, used by resource management system.
vector<ZImage*> mImageVec; std::vector<ZE::ZImage*> mImageVec;
//! Vector of pointers to ZFonts, used by resource management system. //! Vector of pointers to ZFonts, used by resource management system.
vector<ZFont*> mFontVec; std::vector<ZE::ZFont*> mFontVec;
//! List of widgets in global context. //! List of widgets in global context.
WidgetList mWidgetList; WidgetList mWidgetList;
@ -122,7 +122,7 @@ class GewiEngine
\param image Image to add to resources. \param image Image to add to resources.
\return ID number of new resource. \return ID number of new resource.
**/ **/
ResourceID AddResource(ZImage *image); ResourceID AddResource(ZE::ZImage *image);
/*! /*!
\brief Adds a font resource to the private vector. \brief Adds a font resource to the private vector.
@ -131,7 +131,7 @@ class GewiEngine
\param font Font to add to resources. \param font Font to add to resources.
\return ID number of new resource. \return ID number of new resource.
**/ **/
ResourceID AddResource(ZFont *font); ResourceID AddResource(ZE::ZFont *font);
/*! /*!
\brief Access an image in the resource vector. \brief Access an image in the resource vector.
@ -140,7 +140,7 @@ class GewiEngine
\param id ID of image to retrieve. \param id ID of image to retrieve.
\return Pointer to image or NULL if invalid ID for images. \return Pointer to image or NULL if invalid ID for images.
**/ **/
ZImage* Image(ResourceID id); ZE::ZImage* Image(ResourceID id);
/*! /*!
\brief Access a font in the resource vector. \brief Access a font in the resource vector.
@ -149,7 +149,7 @@ class GewiEngine
\param id ID of font to retrieve. \param id ID of font to retrieve.
\return Pointer to font or NULL if invalid ID for fonts. \return Pointer to font or NULL if invalid ID for fonts.
**/ **/
ZFont* Font(ResourceID id); ZE::ZFont* Font(ResourceID id);
/*! /*!
\brief Free all resources. \brief Free all resources.

View File

@ -20,13 +20,11 @@
#ifndef __gewiincludes_h__ #ifndef __gewiincludes_h__
#define __gewiincludes_h__ #define __gewiincludes_h__
#include <string>
#include <vector> #include <vector>
#include <cmath> #include <cmath>
#include <climits> #include <climits>
#include "ZEngine.h" #include "ZEngine.h"
#include "GewiDefines.h" #include "GewiDefines.h"
using namespace std;
using namespace ZE;
#endif //__gewiincludes_h__ #endif //__gewiincludes_h__

View File

@ -13,7 +13,7 @@
\brief Definition file for GStaticText. \brief Definition file for GStaticText.
Definition file for GStaticText, file to hold static text, labels and such. Definition file for GStaticText, file to hold static text, labels and such.
<br>$Id: GewiStaticText.h,v 1.4 2003/06/07 05:41:18 cozman Exp $<br> <br>$Id: GewiStaticText.h,v 1.5 2003/06/11 00:19:40 cozman Exp $<br>
\author James Turk \author James Turk
**/ **/
@ -39,9 +39,9 @@ class GStaticText : public GWidget
//! Font to use for label. //! Font to use for label.
ResourceID rFont; ResourceID rFont;
//! Current text of label. //! Current text of label.
string rText; std::string rText;
//! Text buffer ZImage, used internally. //! Text buffer ZImage, used internally.
ZImage rTextBuf; ZE::ZImage rTextBuf;
//! Calculated X Offset for text, calculated from justification. //! Calculated X Offset for text, calculated from justification.
int rXOff; int rXOff;
//! Calculated Y Offset for text, calculated from justification. //! Calculated Y Offset for text, calculated from justification.
@ -71,7 +71,7 @@ class GStaticText : public GWidget
\param backgroundImg Image for background, defaults to GewiEngine::InvalidID. \param backgroundImg Image for background, defaults to GewiEngine::InvalidID.
**/ **/
virtual void Create(float x, float y, float width, float height, virtual void Create(float x, float y, float width, float height,
ResourceID font, string text=" ", GewiJustify just=GJ_CENTER, ResourceID backgroundImg=GewiEngine::InvalidID); ResourceID font, std::string text=" ", GewiJustify just=GJ_CENTER, ResourceID backgroundImg=GewiEngine::InvalidID);
/*! /*!
\brief Overload of Message, used to recieve messages. \brief Overload of Message, used to recieve messages.
@ -98,7 +98,7 @@ class GStaticText : public GWidget
Sets the current text of the label. Sets the current text of the label.
\param text New text for label. \param text New text for label.
**/ **/
void SetText(string text); void SetText(std::string text);
/*! /*!
\brief Get current text in label. \brief Get current text in label.
@ -106,7 +106,7 @@ class GStaticText : public GWidget
Return text in label. Return text in label.
\return text currently in label. \return text currently in label.
**/ **/
string GetText(); std::string GetText();
}; };
} }

View File

@ -13,7 +13,7 @@
\brief Definition file for GTextButton. \brief Definition file for GTextButton.
Definition file for GTextButton, a GButton that has a text label. Definition file for GTextButton, a GButton that has a text label.
<br>$Id: GewiTextButton.h,v 1.4 2003/06/07 05:41:18 cozman Exp $<br> <br>$Id: GewiTextButton.h,v 1.5 2003/06/11 00:19:40 cozman Exp $<br>
\author James Turk \author James Turk
**/ **/
@ -35,9 +35,9 @@ class GTextButton : public GButton
{ {
protected: protected:
//! Text label for button. //! Text label for button.
string rText; std::string rText;
//! Text Buffer, used internally. //! Text Buffer, used internally.
ZImage rTextBuf; ZE::ZImage rTextBuf;
//! X offset of text. //! X offset of text.
int rXOff; int rXOff;
//! Y offset of text. //! Y offset of text.
@ -69,7 +69,7 @@ class GTextButton : public GButton
\param type GButtonType, either the default, GBT_PRESS (normal button), or GBT_HOVER (a button which responds to the hovering mouse). \param type GButtonType, either the default, GBT_PRESS (normal button), or GBT_HOVER (a button which responds to the hovering mouse).
**/ **/
virtual void Create(float x, float y, float width, float height, ResourceID normalImg, ResourceID pressImg, ResourceID font, virtual void Create(float x, float y, float width, float height, ResourceID normalImg, ResourceID pressImg, ResourceID font,
string text=" ", GButtonType type=GBT_PRESS); std::string text=" ", GButtonType type=GBT_PRESS);
/*! /*!
\brief Draws static label to the screen. \brief Draws static label to the screen.
@ -84,7 +84,7 @@ class GTextButton : public GButton
Sets the current text of the button. Sets the current text of the button.
\param text New text for button. \param text New text for button.
**/ **/
void SetText(string text); void SetText(std::string text);
/*! /*!
\brief Get current text of button label. \brief Get current text of button label.
@ -92,7 +92,7 @@ class GTextButton : public GButton
Return text on button label. Return text on button label.
\return text currently on button label. \return text currently on button label.
**/ **/
string GetText(); std::string GetText();
}; };
} }

View File

@ -13,7 +13,7 @@
\brief Definition file for GTextField. \brief Definition file for GTextField.
Definition file for GTextField, text input area widget. Definition file for GTextField, text input area widget.
<br>$Id: GewiTextField.h,v 1.5 2003/06/07 05:41:18 cozman Exp $<br> <br>$Id: GewiTextField.h,v 1.6 2003/06/11 00:19:40 cozman Exp $<br>
\author James Turk \author James Turk
**/ **/
@ -35,9 +35,9 @@ class GTextField : public GWidget
{ {
protected: protected:
//! Text currently entered. //! Text currently entered.
string rText; std::string rText;
//! Text buffer, used internally. //! Text buffer, used internally.
ZImage rBuffer; ZE::ZImage rBuffer;
//! Font for text. //! Font for text.
ResourceID rFont; ResourceID rFont;
//! Background for text input area. //! Background for text input area.
@ -96,7 +96,7 @@ class GTextField : public GWidget
Sets the current text of the buffer for input area. Sets the current text of the buffer for input area.
\param text New text for button. \param text New text for button.
**/ **/
void SetText(string text); void SetText(std::string text);
/*! /*!
\brief Get current text of the input box. \brief Get current text of the input box.
@ -104,7 +104,7 @@ class GTextField : public GWidget
Return text in the input buffer. Return text in the input buffer.
\return text currently in input buffer. \return text currently in input buffer.
**/ **/
string GetText(); std::string GetText();
}; };
} }

View File

@ -13,7 +13,7 @@
\brief Definition file for GWidget. \brief Definition file for GWidget.
Definition file for GWidget, virtual widget base class. Definition file for GWidget, virtual widget base class.
<br>$Id: GewiWidget.h,v 1.5 2003/06/09 03:28:59 cozman Exp $<br> <br>$Id: GewiWidget.h,v 1.6 2003/06/11 00:19:40 cozman Exp $<br>
\author James Turk \author James Turk
**/ **/
@ -39,9 +39,9 @@ class GWidget
//! Pointer to GewiEngine instance. //! Pointer to GewiEngine instance.
GewiEngine *rGewi; GewiEngine *rGewi;
//! Pointer to ZEngine instance. //! Pointer to ZEngine instance.
ZEngine *rZE; ZE::ZEngine *rZE;
//! Rectangle describing area of widget. //! Rectangle describing area of widget.
ZRect rBoundRect; ZE::ZRect rBoundRect;
//! Pointer to parent container. (NULL means it lays in the global setting). //! Pointer to parent container. (NULL means it lays in the global setting).
GContainer *rParent; GContainer *rParent;
//! Relative X position, relative to parent, or top corner of screen if in global setting. //! Relative X position, relative to parent, or top corner of screen if in global setting.

View File

@ -13,7 +13,7 @@
\brief Implementation of GewiEngine. \brief Implementation of GewiEngine.
Implementation of GewiEngine, core engine for Gewi GUI control. Implementation of GewiEngine, core engine for Gewi GUI control.
<br>$Id: GewiEngine.cpp,v 1.6 2003/06/10 23:55:59 cozman Exp $<br> <br>$Id: GewiEngine.cpp,v 1.7 2003/06/11 00:19:29 cozman Exp $<br>
\author James Turk \author James Turk
**/ **/
@ -33,7 +33,7 @@ GewiEngine::GewiEngine()
//check version of ZEngine //check version of ZEngine
if(ZE::ZEngine::Version < GewiEngine::MinZEVersion) if(ZE::ZEngine::Version < GewiEngine::MinZEVersion)
ze->WriteLog(FormatStr("Gewi %s requires ZEngine %s or greater, ZEngine %s in use.", ze->WriteLog(ZE::FormatStr("Gewi %s requires ZEngine %s or greater, ZEngine %s in use.",
GewiEngine::Version.GetString().c_str(), GewiEngine::Version.GetString().c_str(),
GewiEngine::MinZEVersion.GetString().c_str(), GewiEngine::MinZEVersion.GetString().c_str(),
ZE::ZEngine::Version.GetString().c_str())); ZE::ZEngine::Version.GetString().c_str()));
@ -61,7 +61,7 @@ void GewiEngine::ReleaseInstance()
//set everything back to default //set everything back to default
SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_INTERVAL,SDL_DEFAULT_REPEAT_INTERVAL); SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_INTERVAL,SDL_DEFAULT_REPEAT_INTERVAL);
SDL_EnableUNICODE(0); SDL_EnableUNICODE(0);
ZEngine::GetInstance()->SetEventFilter(NULL); ZE::ZEngine::GetInstance()->SetEventFilter(NULL);
} }
} }
@ -122,19 +122,19 @@ void GewiEngine::Display()
mWidgetList.ShowWidgets(); mWidgetList.ShowWidgets();
} }
ResourceID GewiEngine::AddResource(ZImage *image) ResourceID GewiEngine::AddResource(ZE::ZImage *image)
{ {
mImageVec.push_back(image); mImageVec.push_back(image);
return static_cast<ResourceID>(mImageVec.size()-1); return static_cast<ResourceID>(mImageVec.size()-1);
} }
ResourceID GewiEngine::AddResource(ZFont *font) ResourceID GewiEngine::AddResource(ZE::ZFont *font)
{ {
mFontVec.push_back(font); mFontVec.push_back(font);
return static_cast<ResourceID>(mFontVec.size()-1); return static_cast<ResourceID>(mFontVec.size()-1);
} }
ZImage* GewiEngine::Image(ResourceID id) ZE::ZImage* GewiEngine::Image(ResourceID id)
{ {
//do range checking //do range checking
if(id >= 0 && id < mImageVec.size()) if(id >= 0 && id < mImageVec.size())
@ -143,7 +143,7 @@ ZImage* GewiEngine::Image(ResourceID id)
return NULL; return NULL;
} }
ZFont* GewiEngine::Font(ResourceID id) ZE::ZFont* GewiEngine::Font(ResourceID id)
{ {
//do range checking //do range checking
if(id >= 0 && id < mFontVec.size()) if(id >= 0 && id < mFontVec.size())

View File

@ -13,7 +13,7 @@
\brief Implementation of GStaticText. \brief Implementation of GStaticText.
Implementation of GStaticText, file to hold static text, labels and such. Implementation of GStaticText, file to hold static text, labels and such.
<br>$Id: GewiStaticText.cpp,v 1.4 2003/06/07 05:42:33 cozman Exp $<br> <br>$Id: GewiStaticText.cpp,v 1.5 2003/06/11 00:19:29 cozman Exp $<br>
\author James Turk \author James Turk
**/ **/
@ -34,7 +34,7 @@ GStaticText::GStaticText(GContainer *parent) :
void GStaticText::Create(float x, float y, float width, float height, void GStaticText::Create(float x, float y, float width, float height,
ResourceID font, string text, GewiJustify justify, ResourceID backgroundImg) ResourceID font, std::string text, GewiJustify justify, ResourceID backgroundImg)
{ {
GWidget::Create(x,y,width,height); GWidget::Create(x,y,width,height);
@ -61,7 +61,7 @@ void GStaticText::Show()
} }
void GStaticText::SetText(string text) void GStaticText::SetText(std::string text)
{ {
int w,h; int w,h;
@ -94,7 +94,7 @@ void GStaticText::SetText(string text)
} }
} }
string GStaticText::GetText() std::string GStaticText::GetText()
{ {
return rText; return rText;
} }

View File

@ -13,7 +13,7 @@
\brief Implementation of GTextButton. \brief Implementation of GTextButton.
Implementation of GTextButton, a GButton that has a text label. Implementation of GTextButton, a GButton that has a text label.
<br>$Id: GewiTextButton.cpp,v 1.3 2003/05/20 00:08:55 cozman Exp $<br> <br>$Id: GewiTextButton.cpp,v 1.4 2003/06/11 00:19:29 cozman Exp $<br>
\author James Turk \author James Turk
**/ **/
@ -31,7 +31,7 @@ GTextButton::GTextButton(GContainer *parent) :
void GTextButton::Create(float x, float y, float width, float height, ResourceID normalImg, ResourceID pressImg, ResourceID font, void GTextButton::Create(float x, float y, float width, float height, ResourceID normalImg, ResourceID pressImg, ResourceID font,
string text, GButtonType type) std::string text, GButtonType type)
{ {
GButton::Create(x,y,width,height,normalImg,pressImg,type); GButton::Create(x,y,width,height,normalImg,pressImg,type);
rFont = font; rFont = font;
@ -49,7 +49,7 @@ void GTextButton::Show()
rTextBuf.Draw(rBoundRect.X()+rXOff,rBoundRect.Y()+rYOff); //draw text shifted by offset rTextBuf.Draw(rBoundRect.X()+rXOff,rBoundRect.Y()+rYOff); //draw text shifted by offset
} }
void GTextButton::SetText(string text) void GTextButton::SetText(std::string text)
{ {
rText = text; rText = text;
rGewi->Font(rFont)->DrawText(rText,rTextBuf); rGewi->Font(rFont)->DrawText(rText,rTextBuf);
@ -58,7 +58,7 @@ void GTextButton::SetText(string text)
rYOff = static_cast<int>(rBoundRect.Height()-rTextBuf.Height())/2; rYOff = static_cast<int>(rBoundRect.Height()-rTextBuf.Height())/2;
} }
string GTextButton::GetText() std::string GTextButton::GetText()
{ {
return rText; return rText;
} }

View File

@ -13,7 +13,7 @@
\brief Implementation of GTextField. \brief Implementation of GTextField.
Implementation of GTextField, text input area widget. Implementation of GTextField, text input area widget.
<br>$Id: GewiTextField.cpp,v 1.4 2003/06/07 05:42:33 cozman Exp $<br> <br>$Id: GewiTextField.cpp,v 1.5 2003/06/11 00:19:29 cozman Exp $<br>
\author James Turk \author James Turk
**/ **/
@ -61,13 +61,13 @@ void GTextField::Show()
rBuffer.Draw(rLeftPadding+rBoundRect.X(),rBoundRect.Y()+(rBoundRect.Height()-rBuffer.Height())/2); rBuffer.Draw(rLeftPadding+rBoundRect.X(),rBoundRect.Y()+(rBoundRect.Height()-rBuffer.Height())/2);
} }
void GTextField::SetText(string text) void GTextField::SetText(std::string text)
{ {
rText = text; rText = text;
rGewi->Font(rFont)->DrawText(rText,rBuffer); rGewi->Font(rFont)->DrawText(rText,rBuffer);
} }
string GTextField::GetText() std::string GTextField::GetText()
{ {
return rText; return rText;
} }

View File

@ -13,7 +13,7 @@
\brief Implementation of GWidget. \brief Implementation of GWidget.
Implementation of GWidget, virtual widget base class. Implementation of GWidget, virtual widget base class.
<br>$Id: GewiWidget.cpp,v 1.5 2003/06/09 03:28:43 cozman Exp $<br> <br>$Id: GewiWidget.cpp,v 1.6 2003/06/11 00:19:29 cozman Exp $<br>
\author James Turk \author James Turk
**/ **/
@ -34,7 +34,7 @@ void GWidget::FitParent() //adjust to relative pos + parent pos
GWidget::GWidget(GContainer *parent) : GWidget::GWidget(GContainer *parent) :
rGewi(GewiEngine::GetInstance()), rGewi(GewiEngine::GetInstance()),
rZE(ZEngine::GetInstance()), rZE(ZE::ZEngine::GetInstance()),
rParent(parent), rParent(parent),
rRelX(0), rRelX(0),
rRelY(0), rRelY(0),

View File

@ -10,6 +10,7 @@
#include "ZEngine.h" #include "ZEngine.h"
#include "Gewi.h" #include "Gewi.h"
#include <string>
using namespace ZE; using namespace ZE;
using namespace Gewi; using namespace Gewi;
@ -20,7 +21,7 @@ void Init()
ZConfigFile cfg("gewiTest.zcf"); ZConfigFile cfg("gewiTest.zcf");
int w,h,bpp; int w,h,bpp;
bool fs; bool fs;
string title; std::string title;
w = cfg.GetInt("screen","width",800); w = cfg.GetInt("screen","width",800);
h = cfg.GetInt("screen","height",600); h = cfg.GetInt("screen","height",600);