BoxSizer to Sizer

This commit is contained in:
2018-08-15 22:04:06 -04:00
parent 353dc21750
commit bd3c111fa1
67 changed files with 369 additions and 308 deletions
+2 -2
View File
@@ -5,8 +5,8 @@ using Equipment::cBall;
cBall::cBall( const signed long int xpos /*= 0*/, const signed long int ypos /*= 0*/, const signed long int xarea /*= 0*/, cBall::cBall( const signed long int xpos /*= 0*/, const signed long int ypos /*= 0*/, const signed long int xarea /*= 0*/,
const signed long int yarea /*= 0*/, const unsigned long int warea /*= 0*/, const unsigned long int harea /*= 0*/, const signed long int yarea /*= 0*/, const unsigned long int warea /*= 0*/, const unsigned long int harea /*= 0*/,
VideoEngine::cImage** image /*= nullptr*/, VideoEngine::cCamera** camera /*= nullptr*/ ) VideoEngine::cImage** image /*= nullptr*/, VideoEngine::cCamera** camera /*= nullptr*/ )
: cSprite(xpos, ypos, xarea, yarea, warea, harea, image, camera), : cSprite(xpos, ypos, xarea, yarea, warea, harea, image, camera),
m_pause(false), m_ballState(Serve), m_speed(-10.0, -10.0), m_maxSpeed(10), m_minSpeed(5), m_boucedAllReady(false) m_pause(false), m_ballState(Serve), m_speed(-10.0, -10.0), m_maxSpeed(10), m_minSpeed(5), m_boucedAllReady(false)
{} {}
cBall::~cBall() cBall::~cBall()
+1 -1
View File
@@ -9,7 +9,7 @@ using MathEngine::Vector4;
using MathEngine::Vector2; using MathEngine::Vector2;
cCourt::cCourt( cBall* ball /*= nullptr*/, cPaddle* player1 /*= nullptr*/, cPaddle* player2 /*= nullptr*/, VideoEngine::cImage** image /*= nullptr*/ ) cCourt::cCourt( cBall* ball /*= nullptr*/, cPaddle* player1 /*= nullptr*/, cPaddle* player2 /*= nullptr*/, VideoEngine::cImage** image /*= nullptr*/ )
: cSprite( 0, 0, 0, 0, 640, 480, image), mp_ball(ball), m_pause(false) : cSprite( 0, 0, 0, 0, 640, 480, image), mp_ball(ball), m_pause(false)
{ {
m_topWall.x = 0.0f; m_topWall.x = 0.0f;
m_topWall.y = 0.0f; m_topWall.y = 0.0f;
+1 -1
View File
@@ -5,7 +5,7 @@ using Equipment::cPaddle;
cPaddle::cPaddle( const signed long int xpos /*= 0*/, const signed long int ypos /*= 0*/, const signed long int xarea /*= 0*/, cPaddle::cPaddle( const signed long int xpos /*= 0*/, const signed long int ypos /*= 0*/, const signed long int xarea /*= 0*/,
const signed long int yarea /*= 0*/, const unsigned long int warea /*= 0*/, const unsigned long int harea /*= 0*/, const signed long int yarea /*= 0*/, const unsigned long int warea /*= 0*/, const unsigned long int harea /*= 0*/,
VideoEngine::cImage** image /*= nullptr*/, VideoEngine::cCamera** camera /*= nullptr*/ ) VideoEngine::cImage** image /*= nullptr*/, VideoEngine::cCamera** camera /*= nullptr*/ )
: cSprite( xpos, ypos, xarea, yarea, warea, harea, image, camera ), m_speed(0.0), m_pause(false), m_state(Still) : cSprite( xpos, ypos, xarea, yarea, warea, harea, image, camera ), m_speed(0.0), m_pause(false), m_state(Still)
{} {}
cPaddle::~cPaddle() cPaddle::~cPaddle()
+2 -2
View File
@@ -41,9 +41,9 @@ namespace Equipment {
private: private:
double m_speed; double m_speed;
bool m_pause;// = false bool m_pause;/// = false
eState m_state;// = Still eState m_state;/// = Still
};/// END CLASS DEFINITION cPaddle };/// END CLASS DEFINITION cPaddle
}/// END NAMESPACE DEFINITION Equipment }/// END NAMESPACE DEFINITION Equipment
#endif/// END IFNDEF _CPADDLE_HPP_ #endif/// END IFNDEF _CPADDLE_HPP_
+2 -2
View File
@@ -123,8 +123,8 @@ void cPongStart::MainMenu()
void cPongStart::Start() void cPongStart::Start()
{ {
VideoEngine::cImageFile* p_image = new VideoEngine::cImageFile("img/", "Equipment.png", true, 0, 0, 0); VideoEngine::cImage* p_image = new VideoEngine::cImageFile("img/", "Equipment.png", true, 0, 0, 0);
VideoEngine::cImageFile* p_court = new VideoEngine::cImageFile("img/", "Court.png"); VideoEngine::cImage* p_court = new VideoEngine::cImageFile("img/", "Court.png");
Equipment::cBall* ball = new Equipment::cBall(400, 400, 17, 65, 12, 12, &p_image); Equipment::cBall* ball = new Equipment::cBall(400, 400, 17, 65, 12, 12, &p_image);
Equipment::cPaddle* paddle = new Equipment::cPaddle(0, 0, 0, 0, 16, 77, &p_image); Equipment::cPaddle* paddle = new Equipment::cPaddle(0, 0, 0, 0, 16, 77, &p_image);
@@ -6,7 +6,7 @@ cMusic::cMusic()
{} {}
/* Copy constructor */ /* Copy constructor */
cMusic::cMusic(const cMusic& copy) cMusic::cMusic( const cMusic& copy )
{ {
copy; copy;
} }
@@ -20,13 +20,13 @@ void cMusic::PlayMusic()
{} {}
/* Fades in the music for time */ /* Fades in the music for time */
void cMusic::FadeIn(const unsigned int time /*= 1000*/) const void cMusic::FadeIn( const unsigned int time /*= 1000*/ ) const
{ {
time; time;
} }
/* Fades out the music for time */ /* Fades out the music for time */
void cMusic::FideOut(const unsigned int time /*= 1000*/) const void cMusic::FideOut( const unsigned int time /*= 1000*/ ) const
{ {
time; time;
} }
@@ -70,13 +70,13 @@ cEvent::cEvent()
//Pure virtual, do nothing //Pure virtual, do nothing
} }
/*virtual*/ void cEvent::OnKeyDown(SDL_Keycode sym, Uint16 mod)//, Uint16 unicode) /*virtual*/ void cEvent::OnKeyDown( SDL_Keycode sym, Uint16 mod )//, Uint16 unicode)
{ {
sym, mod; sym, mod;
//Pure virtual, do nothing //Pure virtual, do nothing
} }
/*virtual*/ void cEvent::OnKeyUp(SDL_Keycode sym, Uint16 mod)//, Uint16 unicode) /*virtual*/ void cEvent::OnKeyUp( SDL_Keycode sym, Uint16 mod )//, Uint16 unicode)
{ {
sym, mod; sym, mod;
//Pure virtual, do nothing //Pure virtual, do nothing
@@ -92,79 +92,79 @@ cEvent::cEvent()
//Pure virtual, do nothing //Pure virtual, do nothing
} }
/*virtual*/ void cEvent::OnMouseMove(int mX, int mY, int relX, int relY, bool Left, bool Right, bool Middle) /*virtual*/ void cEvent::OnMouseMove( int mX, int mY, int relX, int relY, bool Left, bool Right, bool Middle )
{ {
mX, mY, relX, relY, Left, Right, Middle; mX, mY, relX, relY, Left, Right, Middle;
//Pure virtual, do nothing //Pure virtual, do nothing
} }
/*virtual*/ void cEvent::OnMouseWheel(bool Up, bool Down) /*virtual*/ void cEvent::OnMouseWheel( bool Up, bool Down )
{ {
Up, Down; Up, Down;
//Pure virtual, do nothing //Pure virtual, do nothing
} }
/*virtual*/ void cEvent::OnLButtonDown(int mX, int mY) /*virtual*/ void cEvent::OnLButtonDown( int mX, int mY )
{ {
mX, mY; mX, mY;
//Pure virtual, do nothing //Pure virtual, do nothing
} }
/*virtual*/ void cEvent::OnLButtonUp(int mX, int mY) /*virtual*/ void cEvent::OnLButtonUp( int mX, int mY )
{ {
mX, mY; mX, mY;
//Pure virtual, do nothing //Pure virtual, do nothing
} }
/*virtual*/ void cEvent::OnRButtonDown(int mX, int mY) /*virtual*/ void cEvent::OnRButtonDown( int mX, int mY )
{ {
mX, mY; mX, mY;
//Pure virtual, do nothing //Pure virtual, do nothing
} }
/*virtual*/ void cEvent::OnRButtonUp(int mX, int mY) /*virtual*/ void cEvent::OnRButtonUp( int mX, int mY )
{ {
mX, mY; mX, mY;
//Pure virtual, do nothing //Pure virtual, do nothing
} }
/*virtual*/ void cEvent::OnMButtonDown(int mX, int mY) /*virtual*/ void cEvent::OnMButtonDown( int mX, int mY )
{ {
mX, mY; mX, mY;
//Pure virtual, do nothing //Pure virtual, do nothing
} }
/*virtual*/ void cEvent::OnMButtonUp(int mX, int mY) /*virtual*/ void cEvent::OnMButtonUp( int mX, int mY )
{ {
mX, mY; mX, mY;
//Pure virtual, do nothing //Pure virtual, do nothing
} }
/*virtual*/ void cEvent::OnJoyAxis(SDL_JoystickID which, Uint8 axis, Sint16 value) /*virtual*/ void cEvent::OnJoyAxis( SDL_JoystickID which, Uint8 axis, Sint16 value )
{ {
which, axis, value; which, axis, value;
//Pure virtual, do nothing //Pure virtual, do nothing
} }
/*virtual*/ void cEvent::OnJoyButtonDown(SDL_JoystickID which, Uint8 button) /*virtual*/ void cEvent::OnJoyButtonDown( SDL_JoystickID which, Uint8 button )
{ {
which, button; which, button;
//Pure virtual, do nothing //Pure virtual, do nothing
} }
/*virtual*/ void cEvent::OnJoyButtonUp(SDL_JoystickID which, Uint8 button) /*virtual*/ void cEvent::OnJoyButtonUp( SDL_JoystickID which, Uint8 button )
{ {
which, button; which, button;
//Pure virtual, do nothing //Pure virtual, do nothing
} }
/*virtual*/ void cEvent::OnJoyHat(SDL_JoystickID which, Uint8 hat, Uint8 value) /*virtual*/ void cEvent::OnJoyHat( SDL_JoystickID which, Uint8 hat, Uint8 value )
{ {
which, hat, value; which, hat, value;
//Pure virtual, do nothing //Pure virtual, do nothing
} }
/*virtual*/ void cEvent::OnJoyBall(SDL_JoystickID which, Uint8 ball, Sint16 xrel, Sint16 yrel) /*virtual*/ void cEvent::OnJoyBall( SDL_JoystickID which, Uint8 ball, Sint16 xrel, Sint16 yrel )
{ {
which, ball, xrel, yrel; which, ball, xrel, yrel;
//Pure virtual, do nothing //Pure virtual, do nothing
@@ -180,7 +180,7 @@ cEvent::cEvent()
//Pure virtual, do nothing //Pure virtual, do nothing
} }
/*virtual*/ void cEvent::OnResize(int w, int h) /*virtual*/ void cEvent::OnResize( int w, int h )
{ {
w, h; w, h;
//Pure virtual, do nothing //Pure virtual, do nothing
@@ -196,7 +196,7 @@ cEvent::cEvent()
//Pure virtual, do nothing //Pure virtual, do nothing
} }
/*virtual*/ void cEvent::OnUser(Uint32 type, int code, void* data1, void* data2) /*virtual*/ void cEvent::OnUser( Uint32 type, int code, void* data1, void* data2 )
{ {
type, code, data1, data2; type, code, data1, data2;
//Pure virtual, do nothing //Pure virtual, do nothing
@@ -22,51 +22,51 @@ namespace EventEngine {
virtual void OnInputBlur(); virtual void OnInputBlur();
virtual void OnKeyDown(SDL_Keycode sym, Uint16 mod);//, Uint16 unicode); virtual void OnKeyDown( SDL_Keycode sym, Uint16 mod );//, Uint16 unicode);
virtual void OnKeyUp(SDL_Keycode sym, Uint16 mod);//, Uint16 unicode); virtual void OnKeyUp( SDL_Keycode sym, Uint16 mod );//, Uint16 unicode);
virtual void OnMouseFocus(); virtual void OnMouseFocus();
virtual void OnMouseBlur(); virtual void OnMouseBlur();
virtual void OnMouseMove(int mX, int mY, int relX, int relY, bool Left, bool Right, bool Middle); virtual void OnMouseMove( int mX, int mY, int relX, int relY, bool Left, bool Right, bool Middle );
virtual void OnMouseWheel(bool Up, bool Down); //Not implemented virtual void OnMouseWheel( bool Up, bool Down ); //Not implemented
virtual void OnLButtonDown(int mX, int mY); virtual void OnLButtonDown( int mX, int mY );
virtual void OnLButtonUp(int mX, int mY); virtual void OnLButtonUp( int mX, int mY );
virtual void OnRButtonDown(int mX, int mY); virtual void OnRButtonDown( int mX, int mY );
virtual void OnRButtonUp(int mX, int mY); virtual void OnRButtonUp( int mX, int mY );
virtual void OnMButtonDown(int mX, int mY); virtual void OnMButtonDown( int mX, int mY );
virtual void OnMButtonUp(int mX, int mY); virtual void OnMButtonUp( int mX, int mY );
virtual void OnJoyAxis(SDL_JoystickID which, Uint8 axis, Sint16 value); virtual void OnJoyAxis( SDL_JoystickID which, Uint8 axis, Sint16 value );
virtual void OnJoyButtonDown(SDL_JoystickID which, Uint8 button); virtual void OnJoyButtonDown( SDL_JoystickID which, Uint8 button );
virtual void OnJoyButtonUp(SDL_JoystickID which, Uint8 button); virtual void OnJoyButtonUp( SDL_JoystickID which, Uint8 button );
virtual void OnJoyHat(SDL_JoystickID which, Uint8 hat, Uint8 value); virtual void OnJoyHat( SDL_JoystickID which, Uint8 hat, Uint8 value );
virtual void OnJoyBall(SDL_JoystickID which, Uint8 ball, Sint16 xrel, Sint16 yrel); virtual void OnJoyBall( SDL_JoystickID which, Uint8 ball, Sint16 xrel, Sint16 yrel );
virtual void OnMinimize(); virtual void OnMinimize();
virtual void OnRestore(); virtual void OnRestore();
virtual void OnResize(int w, int h); virtual void OnResize( int w, int h );
virtual void OnExpose(); virtual void OnExpose();
virtual void OnExit(); virtual void OnExit();
virtual void OnUser(Uint32 type, int code, void* data1, void* data2); virtual void OnUser( Uint32 type, int code, void* data1, void* data2 );
private: private:
void OnWindowsEvent( const SDL_Event& event ); void OnWindowsEvent( const SDL_Event& event );
void OnMouseButtonDown( const SDL_Event& event ); void OnMouseButtonDown( const SDL_Event& event );
@@ -86,12 +86,12 @@ void cEventControl::CheckEvents()
} }
} }
void cEventControl::AddEvent(EventEngine::cEvent* event) void cEventControl::AddEvent( EventEngine::cEvent* event )
{ {
m_children.push_back(event); m_children.push_back(event);
} }
const bool cEventControl::RemoveEvent(EventEngine::cEvent* event) const bool cEventControl::RemoveEvent( EventEngine::cEvent* event )
{ {
bool rtn = false; bool rtn = false;
std::vector<EventEngine::cEvent*>::iterator it; std::vector<EventEngine::cEvent*>::iterator it;
@@ -33,8 +33,8 @@ namespace EventEngine {
/* Checks for Events */ /* Checks for Events */
void CheckEvents(); void CheckEvents();
void AddEvent(EventEngine::cEvent* event); void AddEvent( EventEngine::cEvent* event );
const bool RemoveEvent(EventEngine::cEvent* event); const bool RemoveEvent( EventEngine::cEvent* event );
std::vector<EventEngine::cEvent*>& GetEvents(); std::vector<EventEngine::cEvent*>& GetEvents();
@@ -13,9 +13,9 @@
using UtilityEngine::cString; using UtilityEngine::cString;
namespace EXPORT_FROM_MYDLL FXEngine { namespace FXEngine {
/* Singleton */ /* Singleton */
class cGFX class EXPORT_FROM_MYDLL cGFX
{ {
private: private:
cGFX(); cGFX();
@@ -19,7 +19,7 @@ namespace GUIHelpers {
CWINDOW, CWINDOW,
CPANEL, CPANEL,
CLAYOUT, CLAYOUT,
CBOXSIZER, CSIZER,
CBUTTON, CBUTTON,
CTEXTBUTTON, CTEXTBUTTON,
CLABEL, CLABEL,
@@ -13,7 +13,7 @@ cObject::cObject( const signed int id )
/*virtual*/ cObject::~cObject() /*virtual*/ cObject::~cObject()
{} {}
bool cObject::operator == (const cObject& other) bool cObject::operator == ( const cObject& other )
{ {
if (m_id == other.getID()) if (m_id == other.getID())
return true; return true;
@@ -14,7 +14,7 @@ namespace GUIHelpers {
cObject( const signed int id ); cObject( const signed int id );
virtual ~cObject(); virtual ~cObject();
bool operator == (const cObject& other); bool operator == ( const cObject& other );
///Functions ///Functions
@@ -21,20 +21,22 @@ cXMLoader::~cXMLoader()
{} {}
/// Functions /// Functions
void cXMLoader::Load( const cString& filename, const cString& dir /*= ""*/, GUIEngine::cWindow* parent /*= nullptr*/ ) const bool cXMLoader::Load( const cString& filename, const cString& dir /*= ""*/, GUIEngine::cWindow* parent /*= nullptr*/ )
{ {
bool rtn = false;
cString file = dir + filename; cString file = dir + filename;
tinyxml2::XMLDocument doc; tinyxml2::XMLDocument doc;
if (doc.LoadFile(file.c_str()) != tinyxml2::XMLError::XML_NO_ERROR) if (doc.LoadFile(file.c_str()) != tinyxml2::XMLError::XML_NO_ERROR)
cUtility::Inst().Message("Could not load file. " + file + " Error='" + doc.ErrorName() + "'."); cUtility::Inst().Message("Could not load file. " + file + " Error='" + doc.ErrorName() + "'.");
else { else {
rtn = true;
tinyxml2::XMLElement* element = doc.FirstChildElement(); tinyxml2::XMLElement* element = doc.FirstChildElement();
if (element == nullptr) if (element == nullptr)
cUtility::Inst().Message("No tag found."); cUtility::Inst().Message("No tag found.");
else { else {
//OK check for defaults /// OK check for defaults
tinyxml2::XMLElement* defaultEl = element->FirstChildElement("default"); tinyxml2::XMLElement* defaultEl = element->FirstChildElement("default");
if (defaultEl != nullptr) if (defaultEl != nullptr)
Default(*defaultEl); Default(*defaultEl);
@@ -44,7 +46,7 @@ void cXMLoader::Load( const cString& filename, const cString& dir /*= ""*/, GUIE
GetElement(*element, parent); GetElement(*element, parent);
} }
} }
return rtn;
} }
void cXMLoader::GetElement( tinyxml2::XMLElement& element, GUIEngine::cWindow* parent /*= nullptr*/ ) const void cXMLoader::GetElement( tinyxml2::XMLElement& element, GUIEngine::cWindow* parent /*= nullptr*/ ) const
@@ -62,8 +64,8 @@ void cXMLoader::GetElement( tinyxml2::XMLElement& element, GUIEngine::cWindow* p
tmp = LayoutBuild(element, parent); tmp = LayoutBuild(element, parent);
if (name == "label") if (name == "label")
tmp = LabelBuild(element, parent); tmp = LabelBuild(element, parent);
if (name == "boxsizer") if (name == "sizer")
tmp = BoxSizerBuild(element, parent); tmp = SizerBuild(element, parent);
tinyxml2::XMLElement* child = element.FirstChildElement(); tinyxml2::XMLElement* child = element.FirstChildElement();
if (child != nullptr) if (child != nullptr)
@@ -191,7 +193,7 @@ GUIEngine::cLabel* cXMLoader::LabelBuild( const tinyxml2::XMLElement& element, G
return rtn; return rtn;
} }
GUIEngine::cBoxSizer* cXMLoader::BoxSizerBuild(const tinyxml2::XMLElement& element, GUIEngine::cWindow* parent) const GUIEngine::cSizer* cXMLoader::SizerBuild(const tinyxml2::XMLElement& element, GUIEngine::cWindow* parent) const
{ {
signed long int id = getID(element); signed long int id = getID(element);
//GUIHelpers::eOrientation orientation = getOrientation(element); //GUIHelpers::eOrientation orientation = getOrientation(element);
@@ -203,7 +205,7 @@ GUIEngine::cBoxSizer* cXMLoader::BoxSizerBuild(const tinyxml2::XMLElement& eleme
cString txt = getText(element); cString txt = getText(element);
GUIEngine::cBoxSizer* rtn = new GUIEngine::cBoxSizer(parent, id, align, layout, pos, size, pad); GUIEngine::cSizer* rtn = new GUIEngine::cSizer(parent, id, align, layout, pos, size, pad);
return rtn; return rtn;
} }
@@ -384,7 +386,8 @@ const GUIHelpers::Padding cXMLoader::getPadding( const tinyxml2::XMLElement& ele
const cString cXMLoader::getText( const tinyxml2::XMLElement& element ) const const cString cXMLoader::getText( const tinyxml2::XMLElement& element ) const
{ {
return GetAttribute(element, "text"); //return GetAttribute(element, "text");
return element.GetText();
} }
const GUIHelpers::RGBA cXMLoader::getColour( const tinyxml2::XMLElement& element ) const const GUIHelpers::RGBA cXMLoader::getColour( const tinyxml2::XMLElement& element ) const
@@ -14,7 +14,7 @@
#include "../cPanel.hpp" #include "../cPanel.hpp"
#include "../cLayout.hpp" #include "../cLayout.hpp"
#include "../cLabel.hpp" #include "../cLabel.hpp"
#include "../cBoxSizer.hpp" #include "../cSizer.hpp"
#include "../../UtilityEngine/cString.hpp" #include "../../UtilityEngine/cString.hpp"
@@ -27,7 +27,7 @@ namespace GUIHelpers {
cXMLoader(); cXMLoader();
~cXMLoader(); ~cXMLoader();
void Load( const cString& filename, const cString& dir = "", GUIEngine::cWindow* parent = nullptr ); const bool Load( const cString& filename, const cString& dir = "", GUIEngine::cWindow* parent = nullptr );
private: private:
void GetElement( tinyxml2::XMLElement& element, GUIEngine::cWindow* parent = nullptr ) const; void GetElement( tinyxml2::XMLElement& element, GUIEngine::cWindow* parent = nullptr ) const;
@@ -41,7 +41,7 @@ namespace GUIHelpers {
GUIEngine::cPanel* PanelBuild( const tinyxml2::XMLElement& element, GUIEngine::cWindow* parent ) const; GUIEngine::cPanel* PanelBuild( const tinyxml2::XMLElement& element, GUIEngine::cWindow* parent ) const;
GUIEngine::cLayout* LayoutBuild( const tinyxml2::XMLElement& element, GUIEngine::cWindow* parent ) const; GUIEngine::cLayout* LayoutBuild( const tinyxml2::XMLElement& element, GUIEngine::cWindow* parent ) const;
GUIEngine::cLabel* LabelBuild( const tinyxml2::XMLElement& element, GUIEngine::cWindow* parent ) const; GUIEngine::cLabel* LabelBuild( const tinyxml2::XMLElement& element, GUIEngine::cWindow* parent ) const;
GUIEngine::cBoxSizer* BoxSizerBuild( const tinyxml2::XMLElement& element, GUIEngine::cWindow* parent ) const; GUIEngine::cSizer* SizerBuild( const tinyxml2::XMLElement& element, GUIEngine::cWindow* parent ) const;
const cString getDir( const tinyxml2::XMLElement& element ) const; const cString getDir( const tinyxml2::XMLElement& element ) const;
const cString getFileName( const tinyxml2::XMLElement& element ) const; const cString getFileName( const tinyxml2::XMLElement& element ) const;
@@ -55,17 +55,18 @@ const bool cGUI::Initialize( const cString& filename, const cString& dir /*= ""*
bool rtn = IsInit(); bool rtn = IsInit();
GUIHelpers::cXMLoader xml; GUIHelpers::cXMLoader xml;
xml.Load(filename, dir); rtn = xml.Load(filename, dir);
//GUIHelpers::cXMLoader::Inst().Load(filename, dir); //GUIHelpers::cXMLoader::Inst().Load(filename, dir);
// if (rtn == false) { // if (rtn == false) {
// setFont( filename, dir, size ); // setFont( filename, dir, size );
// cUtility::Inst().Message("GUI initialized."); // cUtility::Inst().Message("GUI initialized.");
// } // }
m_inited = rtn;
return rtn; return rtn;
} }
void cGUI::Event(const MathEngine::iVector2& location, const eGUIEventType& type) void cGUI::Event( const MathEngine::iVector2& location, const eGUIEventType& type )
{ {
location; location;
type; type;
@@ -112,7 +113,7 @@ void cGUI::Display()
} }
/// Sets /// Sets
void cGUI::setDebugLevel(const unsigned long int debugLevel) void cGUI::setDebugLevel( const unsigned long int debugLevel )
{ {
m_debugLevel = debugLevel; m_debugLevel = debugLevel;
} }
@@ -36,6 +36,7 @@ namespace GUIEngine {
MouseButton3, MouseButton3,
Keyboard Keyboard
}; };
/// Functions /// Functions
static cGUI& Inst(); static cGUI& Inst();
static void Delete(); static void Delete();
@@ -5,9 +5,9 @@ using GUIEngine::cLabel;
/*static*/ const cString cLabel::sNAME = "label"; /*static*/ const cString cLabel::sNAME = "label";
/*static*/ const GUIHelpers::eLayout cLabel::sLAYOUT = GUIHelpers::eLayout::WRAP_CONTENT; /*static*/ const GUIHelpers::eLayout cLabel::sLAYOUT = GUIHelpers::eLayout::WRAP_CONTENT;
cLabel::cLabel(cWindow* parent, const signed int id, const cString& label /*= ""*/, const GUIHelpers::eAlign& align /*= sALIGN*/, cLabel::cLabel( cWindow* parent, const signed int id, const cString& label /*= ""*/, const GUIHelpers::eAlign& align /*= sALIGN*/,
const GUIHelpers::eLayout& layout /*= sLAYOUT*/, const GUIHelpers::Position& pos /*= sPOSITION*/, const GUIHelpers::Size& size /*= sSIZE*/, const GUIHelpers::eLayout& layout /*= sLAYOUT*/, const GUIHelpers::Position& pos /*= sPOSITION*/, const GUIHelpers::Size& size /*= sSIZE*/,
const GUIHelpers::Padding& padding /*= sPADDING*/, const cString& name /*= sNAME*/) const GUIHelpers::Padding& padding /*= sPADDING*/, const cString& name /*= sNAME*/ )
{ {
mp_text = new TextTypeEngine::cText(label); mp_text = new TextTypeEngine::cText(label);
Create(parent, id, label, align, layout, pos, size, padding, name); Create(parent, id, label, align, layout, pos, size, padding, name);
@@ -20,11 +20,13 @@ cLabel::cLabel(cWindow* parent, const signed int id, const cString& label /*= ""
} }
/// Functions /// Functions
void cLabel::Create(cWindow* parent, const signed int id, const cString& label /*= ""*/, const GUIHelpers::eAlign& align /*= sALIGN*/, void cLabel::Create( cWindow* parent, const signed int id, const cString& label /*= ""*/, const GUIHelpers::eAlign& align /*= sALIGN*/,
const GUIHelpers::eLayout& layout /*= sLAYOUT*/, const GUIHelpers::Position& pos /*= sPOSITION*/, const GUIHelpers::Size& size /*= sSIZE*/, const GUIHelpers::eLayout& layout /*= sLAYOUT*/, const GUIHelpers::Position& pos /*= sPOSITION*/, const GUIHelpers::Size& size /*= sSIZE*/,
const GUIHelpers::Padding& padding /*= sPADDING*/, const cString& name /*= sNAME*/) const GUIHelpers::Padding& padding /*= sPADDING*/, const cString& name /*= sNAME*/ )
{ {
cWindow::Create(parent, id, sORIENTATION, align, layout, pos, size, padding, name); cWindow::Create(parent, id, sORIENTATION, align, layout, pos, size, padding, name);
if (layout == GUIHelpers::eLayout::DEFAULT_LAYOUT)
setLayout(sLAYOUT);
if (this->getParent() != nullptr) { if (this->getParent() != nullptr) {
this->getParent()->AddChild(this); this->getParent()->AddChild(this);
} }
@@ -54,12 +56,12 @@ void cLabel::GenerateTexture()
} }
/// Sets /// Sets
void cLabel::setFontColour(const GUIHelpers::RGBA& colour) void cLabel::setFontColour( const GUIHelpers::RGBA& colour )
{ {
mp_text->setColour(colour); mp_text->setColour(colour);
} }
void cLabel::setFontSize(const unsigned long int size) void cLabel::setFontSize( const unsigned long int size )
{ {
mp_text->setSize(size); mp_text->setSize(size);
SetSize(); SetSize();
@@ -71,7 +73,7 @@ void cLabel::setText(const cString& text)
SetSize(); SetSize();
} }
void cLabel::setFont(const TextTypeEngine::cFont* font) void cLabel::setFont( const TextTypeEngine::cFont* font )
{ {
mp_text->setFont((TextTypeEngine::cFont**)(&font)); mp_text->setFont((TextTypeEngine::cFont**)(&font));
} }
@@ -113,7 +115,7 @@ const cString& cLabel::getText() const
// cWindow::RePos(); // cWindow::RePos();
// } // }
/*virtual*/ void cLabel::RebuildLayout(const GUIHelpers::eLayout& layout) /*virtual*/ void cLabel::RebuildLayout( const GUIHelpers::eLayout& layout )
{ {
SetSize(); SetSize();
} }
@@ -19,15 +19,15 @@ namespace GUIEngine {
static const cString sNAME; /*= "label";*/ static const cString sNAME; /*= "label";*/
static const GUIHelpers::eLayout sLAYOUT;/* = GUIHelpers::eLayout::WRAP_CONTENT;*/ static const GUIHelpers::eLayout sLAYOUT;/* = GUIHelpers::eLayout::WRAP_CONTENT;*/
cLabel(cWindow* parent, const signed int id, const cString& label = "", const GUIHelpers::eAlign& align = sALIGN, cLabel( cWindow* parent, const signed int id, const cString& label = "", const GUIHelpers::eAlign& align = sALIGN,
const GUIHelpers::eLayout& layout = sLAYOUT, const GUIHelpers::Position& pos = sPOSITION, const GUIHelpers::Size& size = sSIZE, const GUIHelpers::eLayout& layout = sLAYOUT, const GUIHelpers::Position& pos = sPOSITION, const GUIHelpers::Size& size = sSIZE,
const GUIHelpers::Padding& padding = sPADDING, const cString& name = sNAME); const GUIHelpers::Padding& padding = sPADDING, const cString& name = sNAME );
virtual ~cLabel(); virtual ~cLabel();
/// Functions /// Functions
void Create(cWindow* parent, const signed int id, const cString& label = "", const GUIHelpers::eAlign& align = sALIGN, void Create( cWindow* parent, const signed int id, const cString& label = "", const GUIHelpers::eAlign& align = sALIGN,
const GUIHelpers::eLayout& layout = sLAYOUT, const GUIHelpers::Position& pos = sPOSITION, const GUIHelpers::Size& size = sSIZE, const GUIHelpers::eLayout& layout = sLAYOUT, const GUIHelpers::Position& pos = sPOSITION, const GUIHelpers::Size& size = sSIZE,
const GUIHelpers::Padding& padding = sPADDING, const cString& name = sNAME); const GUIHelpers::Padding& padding = sPADDING, const cString& name = sNAME );
virtual void Display(); virtual void Display();
@@ -49,13 +49,11 @@ namespace GUIEngine {
//virtual void Resize(); //virtual void Resize();
virtual void RebuildLayout(const GUIHelpers::eLayout& layout); virtual void RebuildLayout( const GUIHelpers::eLayout& layout );
private: private:
void SetSize(); void SetSize();
private: private:
VideoEngine::cSprite m_sprite; VideoEngine::cSprite m_sprite;
TextTypeEngine::cText* mp_text;/// = nullptr TextTypeEngine::cText* mp_text;/// = nullptr
@@ -5,9 +5,9 @@ using GUIEngine::cLayout;
/*static*/ const cString cLayout::sNAME = "layout"; /*static*/ const cString cLayout::sNAME = "layout";
/*static*/ const GUIHelpers::eOrientation cLayout::sORIENTATION = GUIHelpers::eOrientation::VERTICAL; /*static*/ const GUIHelpers::eOrientation cLayout::sORIENTATION = GUIHelpers::eOrientation::VERTICAL;
cLayout::cLayout(cWindow* parent, const signed int id, const GUIHelpers::eOrientation& orientation /*= sORIENTATION*/, const GUIHelpers::eAlign& align /*= sALIGN*/, cLayout::cLayout( cWindow* parent, const signed int id, const GUIHelpers::eOrientation& orientation /*= sORIENTATION*/, const GUIHelpers::eAlign& align /*= sALIGN*/,
const GUIHelpers::eLayout& layout /*= sLAYOUT*/, const GUIHelpers::Position& pos /*= sPOSITION*/, const GUIHelpers::Size& size /*= sSIZE*/, const GUIHelpers::eLayout& layout /*= sLAYOUT*/, const GUIHelpers::Position& pos /*= sPOSITION*/, const GUIHelpers::Size& size /*= sSIZE*/,
const GUIHelpers::Padding& padding /*= sPADDING*/, const cString& name /*= sNAME*/) const GUIHelpers::Padding& padding /*= sPADDING*/, const cString& name /*= sNAME*/ )
{ {
Create(parent, id, orientation, align, layout, pos, size, padding, name); Create(parent, id, orientation, align, layout, pos, size, padding, name);
} }
@@ -16,9 +16,9 @@ cLayout::cLayout(cWindow* parent, const signed int id, const GUIHelpers::eOrient
{} {}
/// Functions /// Functions
/*virtual*/ void cLayout::Create(cWindow* parent, const signed int id, const GUIHelpers::eOrientation& orientation /*= sORIENTATION*/, const GUIHelpers::eAlign& align /*= sALIGN*/, /*virtual*/ void cLayout::Create( cWindow* parent, const signed int id, const GUIHelpers::eOrientation& orientation /*= sORIENTATION*/, const GUIHelpers::eAlign& align /*= sALIGN*/,
const GUIHelpers::eLayout& layout /*= sLAYOUT*/, const GUIHelpers::Position& pos /*= sPOSITION*/, const GUIHelpers::Size& size /*= sSIZE*/, const GUIHelpers::eLayout& layout /*= sLAYOUT*/, const GUIHelpers::Position& pos /*= sPOSITION*/, const GUIHelpers::Size& size /*= sSIZE*/,
const GUIHelpers::Padding& padding/* = sPADDING*/, const cString& name /*= sNAME*/) const GUIHelpers::Padding& padding/* = sPADDING*/, const cString& name /*= sNAME*/ )
{ {
GUIHelpers::eOrientation ori = orientation; GUIHelpers::eOrientation ori = orientation;
if (ori == GUIHelpers::eOrientation::DEFAULT_ORIENTATION) if (ori == GUIHelpers::eOrientation::DEFAULT_ORIENTATION)
@@ -16,9 +16,9 @@ cPanel::cPanel( cWindow* parent /*= nullptr*/, const signed int id /*= -1*/, con
{} {}
/// Functions /// Functions
/*virtual*/ void cPanel::Create(cWindow* parent /*= nullptr*/, const signed int id /*= -1*/, const GUIHelpers::eOrientation& orientation /*= sORIENTATION*/, const GUIHelpers::eAlign& align /*= sALIGN*/, /*virtual*/ void cPanel::Create( cWindow* parent /*= nullptr*/, const signed int id /*= -1*/, const GUIHelpers::eOrientation& orientation /*= sORIENTATION*/, const GUIHelpers::eAlign& align /*= sALIGN*/,
const GUIHelpers::eLayout& layout /*= sLAYOUT*/, const GUIHelpers::Position& pos /*= sPOSITION*/, const GUIHelpers::Size& size /*= sSIZE*/, const GUIHelpers::eLayout& layout /*= sLAYOUT*/, const GUIHelpers::Position& pos /*= sPOSITION*/, const GUIHelpers::Size& size /*= sSIZE*/,
const GUIHelpers::Padding& padding /*= sPADDING*/, const cString& name /*= sNAME*/) const GUIHelpers::Padding& padding /*= sPADDING*/, const cString& name /*= sNAME*/ )
{ {
padding; padding;
cLayout::Create( parent, id, orientation, align, layout, pos, size, { 0,0,0,0 }, name ); cLayout::Create( parent, id, orientation, align, layout, pos, size, { 0,0,0,0 }, name );
@@ -1,22 +1,22 @@
#include "cBoxSizer.hpp" #include "cSizer.hpp"
using GUIEngine::cBoxSizer; using GUIEngine::cSizer;
/*static*/ const cString cBoxSizer::sNAME = "boxsizer"; /*static*/ const cString cSizer::sNAME = "sizer";
/*static*/ GUIHelpers::Size cBoxSizer::sSIZE = { 5, 5 }; /*static*/ GUIHelpers::Size cSizer::sSIZE = { 5, 5 };
cBoxSizer::cBoxSizer( cWindow* parent, const signed int id, const GUIHelpers::eAlign& align /*= sALIGN*/, const GUIHelpers::eLayout& layout /*= sLAYOUT*/, cSizer::cSizer( cWindow* parent, const signed int id, const GUIHelpers::eAlign& align /*= sALIGN*/, const GUIHelpers::eLayout& layout /*= sLAYOUT*/,
const GUIHelpers::Position& pos /*= sPOSITION*/, const GUIHelpers::Size& size /*= sSIZE*/, const GUIHelpers::Padding& padding /*= sPADDING*/, const GUIHelpers::Position& pos /*= sPOSITION*/, const GUIHelpers::Size& size /*= sSIZE*/, const GUIHelpers::Padding& padding /*= sPADDING*/,
const cString& name /*= sNAME*/ ) const cString& name /*= sNAME*/ )
{ {
Create(parent, id, align, layout, pos, size, padding, name); Create(parent, id, align, layout, pos, size, padding, name);
} }
/*virtual*/ cBoxSizer::~cBoxSizer() /*virtual*/ cSizer::~cSizer()
{} {}
/// Functions /// Functions
void cBoxSizer::Create( cWindow* parent, const signed int id, const GUIHelpers::eAlign& align /*= sALIGN*/, const GUIHelpers::eLayout& layout /*= sLAYOUT*/, void cSizer::Create( cWindow* parent, const signed int id, const GUIHelpers::eAlign& align /*= sALIGN*/, const GUIHelpers::eLayout& layout /*= sLAYOUT*/,
const GUIHelpers::Position& pos/* = sPOSITION*/, const GUIHelpers::Size& size /*= sSIZE*/, const GUIHelpers::Padding& padding /*= sPADDING*/, const GUIHelpers::Position& pos/* = sPOSITION*/, const GUIHelpers::Size& size /*= sSIZE*/, const GUIHelpers::Padding& padding /*= sPADDING*/,
const cString& name /*= sNAME*/ ) const cString& name /*= sNAME*/ )
{ {
@@ -29,12 +29,12 @@ void cBoxSizer::Create( cWindow* parent, const signed int id, const GUIHelpers::
} }
} }
/*virtual*/ const GUIHelpers::eType cBoxSizer::getType() const /*virtual*/ const GUIHelpers::eType cSizer::getType() const
{ {
return GUIHelpers::eType::CBOXSIZER; return GUIHelpers::eType::CSIZER;
} }
/*virtual*/ const GUIHelpers::RGBA& cBoxSizer::getDebugColour() const /*virtual*/ const GUIHelpers::RGBA& cSizer::getDebugColour() const
{ {
return GUIHelpers::CYAN; return GUIHelpers::CYAN;
} }
@@ -1,5 +1,5 @@
#ifndef _CBOXSIZER_HPP_ #ifndef _CSIZER_HPP_
#define _CBOXSIZER_HPP_ #define _CSIZER_HPP_
/*** SDL Header Files ***/ /*** SDL Header Files ***/
#include <SDL.h> #include <SDL.h>
@@ -20,16 +20,16 @@
using UtilityEngine::cString; using UtilityEngine::cString;
namespace GUIEngine { namespace GUIEngine {
class EXPORT_FROM_MYDLL cBoxSizer : public cWindow class EXPORT_FROM_MYDLL cSizer : public cWindow
{ {
public: public:
static const cString sNAME; /*= "boxsizer";*/ static const cString sNAME; /*= "sizer";*/
static GUIHelpers::Size sSIZE; /*= { 5, 5 }*/ static GUIHelpers::Size sSIZE; /*= { 5, 5 }*/
cBoxSizer( cWindow* parent, const signed int id, const GUIHelpers::eAlign& align = sALIGN, const GUIHelpers::eLayout& layout = sLAYOUT, cSizer( cWindow* parent, const signed int id, const GUIHelpers::eAlign& align = sALIGN, const GUIHelpers::eLayout& layout = sLAYOUT,
const GUIHelpers::Position& pos = sPOSITION, const GUIHelpers::Size& size = sSIZE, const GUIHelpers::Padding& padding = sPADDING, const GUIHelpers::Position& pos = sPOSITION, const GUIHelpers::Size& size = sSIZE, const GUIHelpers::Padding& padding = sPADDING,
const cString& name = sNAME ); const cString& name = sNAME );
virtual ~cBoxSizer(); virtual ~cSizer();
/// Functions /// Functions
void Create( cWindow* parent, const signed int id, const GUIHelpers::eAlign& align = sALIGN, const GUIHelpers::eLayout& layout = sLAYOUT, void Create( cWindow* parent, const signed int id, const GUIHelpers::eAlign& align = sALIGN, const GUIHelpers::eLayout& layout = sLAYOUT,
@@ -40,6 +40,6 @@ namespace GUIEngine {
virtual const GUIHelpers::RGBA& getDebugColour() const; virtual const GUIHelpers::RGBA& getDebugColour() const;
private: private:
private: private:
};/// END CLASS DEFINITION cBoxSizer };/// END CLASS DEFINITION cSizer
}/// END NAMESPACE DEFINITION GUIEngine }/// END NAMESPACE DEFINITION GUIEngine
#endif/// END IFNDEF _CBOXSIZER_HPP_ #endif/// END IFNDEF _CSIZER_HPP_
@@ -4,9 +4,9 @@ using GUIEngine::cTextButton;
/*static*/ const cString cTextButton::sNAME = "textButton"; /*static*/ const cString cTextButton::sNAME = "textButton";
cTextButton::cTextButton(cWindow* parent, const signed int id, const cString& text, const GUIHelpers::eAlign& align /*= GUIHelpers::eAlign::CENTER*/, cTextButton::cTextButton( cWindow* parent, const signed int id, const cString& text, const GUIHelpers::eAlign& align /*= GUIHelpers::eAlign::CENTER*/,
const GUIHelpers::eLayout& layout /*= GUIHelpers::eLayout::FILL_PARENT*/, const GUIHelpers::Position& pos /*= POSITION*/, const GUIHelpers::eLayout& layout /*= GUIHelpers::eLayout::FILL_PARENT*/, const GUIHelpers::Position& pos /*= POSITION*/,
const GUIHelpers::Size& size /*= SIZE*/, const GUIHelpers::Padding& padding /*= PADDING*/, const cString& name /*= NAME*/) const GUIHelpers::Size& size /*= SIZE*/, const GUIHelpers::Padding& padding /*= PADDING*/, const cString& name /*= NAME*/ )
: m_label(this, -1, text) : m_label(this, -1, text)
{ {
Create(parent, id, text, align, layout, pos, size, padding, name); Create(parent, id, text, align, layout, pos, size, padding, name);
@@ -16,26 +16,26 @@ cTextButton::cTextButton(cWindow* parent, const signed int id, const cString& te
{} {}
///Functions ///Functions
void cTextButton::Create(cWindow* parent, const signed int id, const cString& text, const GUIHelpers::eAlign& align /*= GUIHelpers::eAlign::CENTER*/, void cTextButton::Create( cWindow* parent, const signed int id, const cString& text, const GUIHelpers::eAlign& align /*= GUIHelpers::eAlign::CENTER*/,
const GUIHelpers::eLayout& layout /*= GUIHelpers::eLayout::FILL_PARENT*/, const GUIHelpers::Position& pos /*= POSITION*/, const GUIHelpers::eLayout& layout /*= GUIHelpers::eLayout::FILL_PARENT*/, const GUIHelpers::Position& pos /*= POSITION*/,
const GUIHelpers::Size& size /*= SIZE*/, const GUIHelpers::Padding& padding /*= PADDING*/, const cString& name /*= NAME*/) const GUIHelpers::Size& size /*= SIZE*/, const GUIHelpers::Padding& padding /*= PADDING*/, const cString& name /*= NAME*/ )
{ {
cButton::Create(parent, id, align, layout, pos, size, padding, name); cButton::Create(parent, id, align, layout, pos, size, padding, name);
setText(text); setText(text);
} }
/// Sets /// Sets
void cTextButton::setText(const cString& text) void cTextButton::setText( const cString& text )
{ {
m_label.setText(text); m_label.setText(text);
} }
void cTextButton::setTextColour(const GUIHelpers::RGBA& colour) void cTextButton::setTextColour( const GUIHelpers::RGBA& colour )
{ {
m_label.setFontColour(colour); m_label.setFontColour(colour);
} }
void cTextButton::setTextSize(const unsigned long int size) void cTextButton::setTextSize( const unsigned long int size )
{ {
m_label.setSize(size); m_label.setSize(size);
} }
@@ -28,15 +28,15 @@ namespace GUIEngine {
public: public:
static const cString sNAME; /*= "button";*/ static const cString sNAME; /*= "button";*/
cTextButton(cWindow* parent, const signed int id, const cString& text, const GUIHelpers::eAlign& align = GUIHelpers::eAlign::CENTER, cTextButton( cWindow* parent, const signed int id, const cString& text, const GUIHelpers::eAlign& align = GUIHelpers::eAlign::CENTER,
const GUIHelpers::eLayout& layout = GUIHelpers::eLayout::FILL_PARENT, const GUIHelpers::Position& pos = sPOSITION, const GUIHelpers::eLayout& layout = GUIHelpers::eLayout::FILL_PARENT, const GUIHelpers::Position& pos = sPOSITION,
const GUIHelpers::Size& size = sSIZE, const GUIHelpers::Padding& padding = sPADDING, const cString& name = sNAME); const GUIHelpers::Size& size = sSIZE, const GUIHelpers::Padding& padding = sPADDING, const cString& name = sNAME );
virtual ~cTextButton(); virtual ~cTextButton();
/// Functions /// Functions
void Create(cWindow* parent, const signed int id, const cString& text, const GUIHelpers::eAlign& align = GUIHelpers::eAlign::CENTER, void Create( cWindow* parent, const signed int id, const cString& text, const GUIHelpers::eAlign& align = GUIHelpers::eAlign::CENTER,
const GUIHelpers::eLayout& layout = GUIHelpers::eLayout::FILL_PARENT, const GUIHelpers::Position& pos = sPOSITION, const GUIHelpers::eLayout& layout = GUIHelpers::eLayout::FILL_PARENT, const GUIHelpers::Position& pos = sPOSITION,
const GUIHelpers::Size& size = sSIZE, const GUIHelpers::Padding& padding = sPADDING, const cString& name = sNAME); const GUIHelpers::Size& size = sSIZE, const GUIHelpers::Padding& padding = sPADDING, const cString& name = sNAME );
/// Sets /// Sets
void setText( const cString& text ); void setText( const cString& text );
@@ -287,11 +287,50 @@ cWindow* cWindow::getParent()
return mp_parent; return mp_parent;
} }
const unsigned long int cWindow::getFillParentSize()
{
unsigned long int rtn = 0;
int count = 0;
GUIHelpers::Size size = getSize(false);
std::vector<cWindow*>::iterator it;
for (it = m_children.begin(); it < m_children.end(); it++) {
if ((*it)->getLayout() == GUIHelpers::eLayout::WRAP_CONTENT) {
size -= (*it)->getSize();
}
else {
count++;
}
}
switch (m_orientation) {
case GUIHelpers::eOrientation::VERTICAL:
rtn = size.y;
break;
case GUIHelpers::eOrientation::HORIZONTAL:
rtn = size.x;
break;
default:
break;
}
//if ((rtn % count) != 0)
rtn /= count;
return rtn;
}
/*virtual*/ const GUIHelpers::eType cWindow::getType() const /*virtual*/ const GUIHelpers::eType cWindow::getType() const
{ {
return GUIHelpers::eType::CWINDOW; return GUIHelpers::eType::CWINDOW;
} }
/// protected /// protected
/*virtual*/ void cWindow::Resize() /*virtual*/ void cWindow::Resize()
@@ -316,12 +355,19 @@ cWindow* cWindow::getParent()
mySize = mp_parent->getSize(false); mySize = mp_parent->getSize(false);
if (mp_parent->getType() == GUIHelpers::eType::CLAYOUT) { if (mp_parent->getType() == GUIHelpers::eType::CLAYOUT) {
if (mp_parent->getChildren().size() > 1) unsigned long int fillSize = 0;
if (mp_parent->getChildren().size() > 1) {
fillSize = mp_parent->getFillParentSize();
mySize -= mp_parent->getChildrenSize(this); mySize -= mp_parent->getChildrenSize(this);
if (mp_parent->getOrientation() == GUIHelpers::eOrientation::VERTICAL) }
if (mp_parent->getOrientation() == GUIHelpers::eOrientation::VERTICAL) {
mySize.x = m_size.x; mySize.x = m_size.x;
if (mp_parent->getOrientation() == GUIHelpers::eOrientation::HORIZONTAL) mySize.y = fillSize;
}
if (mp_parent->getOrientation() == GUIHelpers::eOrientation::HORIZONTAL) {
mySize.y = m_size.y; mySize.y = m_size.y;
mySize.x = fillSize;
}
} }
mySize.x -= m_padding.x + m_padding.w; mySize.x -= m_padding.x + m_padding.w;
@@ -460,6 +506,10 @@ std::vector<cWindow*>& cWindow::getChildren()
} }
/// private /// private
void cWindow::Rebuild(cWindow * const parent, const GUIHelpers::eLayout & layout)
{
}
void cWindow::AddSize( const int x, const int y, GUIHelpers::Size& mySize ) const void cWindow::AddSize( const int x, const int y, GUIHelpers::Size& mySize ) const
{ {
int addFrom = x; int addFrom = x;
@@ -89,8 +89,12 @@ namespace GUIEngine {
cWindow* getParent(); cWindow* getParent();
const unsigned long int getFillParentSize();
virtual const GUIHelpers::eType getType() const; virtual const GUIHelpers::eType getType() const;
virtual void Resize(); virtual void Resize();
virtual void RebuildLayout( const GUIHelpers::eLayout& layout ); virtual void RebuildLayout( const GUIHelpers::eLayout& layout );
@@ -18,17 +18,17 @@ namespace InputEngine {
virtual ~cJoystick(); virtual ~cJoystick();
/// Functions /// Functions
virtual void OnEvent(const SDL_Event& event); virtual void OnEvent( const SDL_Event& event );
virtual void OnJoyAxis(SDL_JoystickID which, Uint8 axis, Sint16 value); virtual void OnJoyAxis( SDL_JoystickID which, Uint8 axis, Sint16 value );
virtual void OnJoyButtonDown(SDL_JoystickID which, Uint8 button); virtual void OnJoyButtonDown( SDL_JoystickID which, Uint8 button );
virtual void OnJoyButtonUp(SDL_JoystickID which, Uint8 button); virtual void OnJoyButtonUp( SDL_JoystickID which, Uint8 button );
virtual void OnJoyHat(SDL_JoystickID which, Uint8 hat, Uint8 value); virtual void OnJoyHat( SDL_JoystickID which, Uint8 hat, Uint8 value );
virtual void OnJoyBall(SDL_JoystickID which, Uint8 ball, Sint16 xrel, Sint16 yrel); virtual void OnJoyBall( SDL_JoystickID which, Uint8 ball, Sint16 xrel, Sint16 yrel );
/// Used when looking for keys that have been add to the check list /// Used when looking for keys that have been add to the check list
void JoystickCheck(); void JoystickCheck();
@@ -16,7 +16,7 @@ Vector2::Vector2( const SDL_Rect& copy )
y = float(copy.y); y = float(copy.y);
} }
Vector2& Vector2::operator=( const SDL_Rect& copy ) Vector2& Vector2::operator = ( const SDL_Rect& copy )
{ {
x = float(copy.x); x = float(copy.x);
y = float(copy.y); y = float(copy.y);
@@ -30,7 +30,7 @@ Vector2::Vector2( const iVector2& copy )
y = float(copy.y); y = float(copy.y);
} }
Vector2& Vector2::operator=( const iVector2& copy ) Vector2& Vector2::operator = ( const iVector2& copy )
{ {
x = float(copy.x); x = float(copy.x);
y = float(copy.y); y = float(copy.y);
@@ -16,11 +16,11 @@ namespace MathEngine {
Vector2( const SDL_Rect& copy ); Vector2( const SDL_Rect& copy );
Vector2& operator=( const SDL_Rect& copy ); Vector2& operator = ( const SDL_Rect& copy );
Vector2( const iVector2& copy ); Vector2( const iVector2& copy );
Vector2& operator=( const iVector2& copy ); Vector2& operator = ( const iVector2& copy );
float x; float x;
float y; float y;
@@ -17,7 +17,7 @@ Vector3::Vector3( const SDL_Rect& copy )
z = float(copy.w); z = float(copy.w);
} }
Vector3& Vector3::operator=( const SDL_Rect& copy ) Vector3& Vector3::operator = ( const SDL_Rect& copy )
{ {
x = float(copy.x); x = float(copy.x);
y = float(copy.y); y = float(copy.y);
@@ -33,7 +33,7 @@ Vector3::Vector3( const iVector3& copy )
z = float(copy.z); z = float(copy.z);
} }
Vector3& Vector3::operator=( const iVector3& copy ) Vector3& Vector3::operator = ( const iVector3& copy )
{ {
x = float(copy.x); x = float(copy.x);
y = float(copy.y); y = float(copy.y);
@@ -19,11 +19,11 @@ namespace MathEngine {
Vector3( const SDL_Rect& copy ); Vector3( const SDL_Rect& copy );
Vector3& operator=( const SDL_Rect& copy ); Vector3& operator = ( const SDL_Rect& copy );
Vector3( const iVector3& copy ); Vector3( const iVector3& copy );
Vector3& operator=( const iVector3& copy ); Vector3& operator = ( const iVector3& copy );
float z; float z;
};/// END STRUCT DEFINITION Vector3 };/// END STRUCT DEFINITION Vector3
@@ -5,7 +5,7 @@
using MathEngine::Vector4; using MathEngine::Vector4;
using MathEngine::iVector4; using MathEngine::iVector4;
Vector4::Vector4( const float X /*= 0.0f*/, const float Y /*= 0.0f*/, const float Z /*= 0.0f*/, const float W /*= 0.0f*/) Vector4::Vector4( const float X /*= 0.0f*/, const float Y /*= 0.0f*/, const float Z /*= 0.0f*/, const float W /*= 0.0f*/ )
: Vector3( X, Y, Z ), w(W) : Vector3( X, Y, Z ), w(W)
{} {}
@@ -17,7 +17,7 @@ Vector4::Vector4( const SDL_Rect& copy )
w = float(copy.h); w = float(copy.h);
} }
Vector4& Vector4::operator=( const SDL_Rect& copy ) Vector4& Vector4::operator = ( const SDL_Rect& copy )
{ {
x = float(copy.x); x = float(copy.x);
y = float(copy.y); y = float(copy.y);
@@ -35,7 +35,7 @@ Vector4::Vector4( const iVector4& copy )
w = float(copy.w); w = float(copy.w);
} }
Vector4& Vector4::operator=( const iVector4& copy ) Vector4& Vector4::operator = ( const iVector4& copy )
{ {
x = float(copy.x); x = float(copy.x);
y = float(copy.y); y = float(copy.y);
@@ -19,15 +19,11 @@ namespace MathEngine {
Vector4( const SDL_Rect& copy ); Vector4( const SDL_Rect& copy );
Vector4& operator=( const SDL_Rect& copy ); Vector4& operator = ( const SDL_Rect& copy );
bool operator==(const SDL_Rect& other) const;
Vector4( const iVector4& copy ); Vector4( const iVector4& copy );
Vector4& operator=( const iVector4& copy ); Vector4& operator = ( const iVector4& copy );
bool operator==(const Vector4& other) const;
float w; float w;
};/// END STRUCT DEFINITION Vector4 };/// END STRUCT DEFINITION Vector4
@@ -18,31 +18,31 @@ cCollision::~cCollision()
/*static*/ const bool cCollision::BoundingBox( const SDL_Rect& a, const SDL_Rect& b ) /*static*/ const bool cCollision::BoundingBox( const SDL_Rect& a, const SDL_Rect& b )
{ {
if ((b.x + b.w) < a.x) if ((b.x + b.w) < a.x)
return false; //just checking if their return false; /// just checking if their
if ((a.x + a.w) < b.x ) if ((a.x + a.w) < b.x )
return false; //bounding boxes even touch return false; /// bounding boxes even touch
if ((b.y + b.h) < a.y) if ((b.y + b.h) < a.y)
return false; return false;
if ((a.y + a.h) < b.y) if ((a.y + a.h) < b.y)
return false; return false;
return true; //bounding boxes intersect return true; /// bounding boxes intersect
} }
/*static*/ const bool cCollision::BoundingBox( const Vector4& a, const Vector4& b ) /*static*/ const bool cCollision::BoundingBox( const Vector4& a, const Vector4& b )
{ {
if ((b.x + b.z) < a.x) if ((b.x + b.z) < a.x)
return false; //just checking if their return false; /// just checking if their
if ((a.x + a.z) < b.x ) if ((a.x + a.z) < b.x )
return false; //bounding boxes even touch return false; /// bounding boxes even touch
if ((b.y + b.w) < a.y) if ((b.y + b.w) < a.y)
return false; return false;
if ((a.y + a.w) < b.y) if ((a.y + a.w) < b.y)
return false; return false;
return true; //bounding boxes intersect return true; /// bounding boxes intersect
} }
/*static*/ const bool cCollision::BoundingBox( const SDL_Rect& a, const Vector4& b ) /*static*/ const bool cCollision::BoundingBox( const SDL_Rect& a, const Vector4& b )
@@ -60,16 +60,16 @@ cCollision::~cCollision()
/*static*/ const bool cCollision::BoundingBox( const iVector4& a, const iVector4& b ) /*static*/ const bool cCollision::BoundingBox( const iVector4& a, const iVector4& b )
{ {
if ((b.x + b.z) < a.x) if ((b.x + b.z) < a.x)
return false; //just checking if their return false; /// just checking if their
if ((a.x + a.z) < b.x ) if ((a.x + a.z) < b.x )
return false; //bounding boxes even touch return false; /// bounding boxes even touch
if ((b.y + b.w) < a.y) if ((b.y + b.w) < a.y)
return false; return false;
if ((a.y + a.w) < b.y) if ((a.y + a.w) < b.y)
return false; return false;
return true; //bounding boxes intersect return true; /// bounding boxes intersect
} }
/*static*/ const bool cCollision::BoundingBox( const SDL_Rect& a, const iVector4& b ) /*static*/ const bool cCollision::BoundingBox( const SDL_Rect& a, const iVector4& b )
@@ -102,16 +102,16 @@ cCollision::~cCollision()
rtn.x = 0.0f; rtn.x = 0.0f;
rtn.y = 0.0f; rtn.y = 0.0f;
//Check if left side of b is inside of a /// Check if left side of b is inside of a
if (b.x < a.x) if (b.x < a.x)
rtn.x = (float)(b.x - a.x); rtn.x = (float)(b.x - a.x);
//Check if right side of b is inside of a /// Check if right side of b is inside of a
if ((b.x + b.w) > (a.x + a.w)) if ((b.x + b.w) > (a.x + a.w))
rtn.x = (float)((b.x + b.w) - (a.x + a.w)); rtn.x = (float)((b.x + b.w) - (a.x + a.w));
//Check if top side of b is inside of a /// Check if top side of b is inside of a
if (b.y < a.y) if (b.y < a.y)
rtn.y = (float)(b.y - a.y); rtn.y = (float)(b.y - a.y);
//Check if botton side of b is inside of a /// Check if bottom side of b is inside of a
if ((b.y + b.h) > (a.y + a.h)) if ((b.y + b.h) > (a.y + a.h))
rtn.y = (float)((b.y + b.h) - (a.y + a.h)); rtn.y = (float)((b.y + b.h) - (a.y + a.h));
@@ -124,16 +124,16 @@ cCollision::~cCollision()
rtn.x = 0.0f; rtn.x = 0.0f;
rtn.y = 0.0f; rtn.y = 0.0f;
//Check if left side of b is inside of a /// Check if left side of b is inside of a
if (b.x < a.x) if (b.x < a.x)
rtn.x = a.x - b.x; rtn.x = a.x - b.x;
//Check if right side of b is inside of a /// Check if right side of b is inside of a
if ((b.x + b.z) > (a.x + a.z)) if ((b.x + b.z) > (a.x + a.z))
rtn.x = (a.x + a.z) - (b.x + b.z); rtn.x = (a.x + a.z) - (b.x + b.z);
//Check if top side of b is inside of a /// Check if top side of b is inside of a
if (b.y < a.y) if (b.y < a.y)
rtn.y = a.y - b.y; rtn.y = a.y - b.y;
//Check if botton side of b is inside of a /// Check if bottom side of b is inside of a
if ((b.y + b.w) > (a.y + a.w)) if ((b.y + b.w) > (a.y + a.w))
rtn.y = (a.y + a.w) - (b.y + b.w); rtn.y = (a.y + a.w) - (b.y + b.w);
@@ -160,16 +160,16 @@ cCollision::~cCollision()
rtn.x = 0; rtn.x = 0;
rtn.y = 0; rtn.y = 0;
//Check if left side of b is inside of a /// Check if left side of b is inside of a
if (b.x < a.x) if (b.x < a.x)
rtn.x = b.x - a.x; rtn.x = b.x - a.x;
//Check if right side of b is inside of a /// Check if right side of b is inside of a
if ((b.x + b.z) > (a.x + a.z)) if ((b.x + b.z) > (a.x + a.z))
rtn.x = (b.x + b.z) - (a.x + a.z); rtn.x = (b.x + b.z) - (a.x + a.z);
//Check if top side of b is inside of a /// Check if top side of b is inside of a
if (b.y < a.y) if (b.y < a.y)
rtn.y = b.y - a.y; rtn.y = b.y - a.y;
//Check if botton side of b is inside of a /// Check if bottom side of b is inside of a
if ((b.y + b.w) > (a.y + a.w)) if ((b.y + b.w) > (a.y + a.w))
rtn.y = (b.y + b.w) - (a.y + a.w); rtn.y = (b.y + b.w) - (a.y + a.w);
@@ -74,7 +74,7 @@ iVector2& iVector2::operator += ( const SDL_Rect& other )
return *this; return *this;
} }
iVector2& iVector2::operator -= (const iVector2& other) iVector2& iVector2::operator -= ( const iVector2& other )
{ {
x -= int(other.x); x -= int(other.x);
y -= int(other.y); y -= int(other.y);
@@ -82,7 +82,7 @@ iVector2& iVector2::operator -= (const iVector2& other)
return *this; return *this;
} }
iVector2& iVector2::operator -= (const SDL_Rect& other) iVector2& iVector2::operator -= ( const SDL_Rect& other )
{ {
x -= int(other.x); x -= int(other.x);
y -= int(other.y); y -= int(other.y);
@@ -90,7 +90,7 @@ iVector2& iVector2::operator -= (const SDL_Rect& other)
return *this; return *this;
} }
iVector2 operator + (const iVector2& lhs, const iVector2& rhs) iVector2 operator + ( const iVector2& lhs, const iVector2& rhs )
{ {
iVector2 rs = lhs; iVector2 rs = lhs;
rs += rhs; rs += rhs;
@@ -25,15 +25,12 @@ namespace MathEngine {
iVector2& operator += ( const iVector2& other ); iVector2& operator += ( const iVector2& other );
iVector2& operator += ( const SDL_Rect& other ); iVector2& operator += ( const SDL_Rect& other );
iVector2& operator -= (const iVector2& other); iVector2& operator -= ( const iVector2& other );
iVector2& operator -= (const SDL_Rect& other); iVector2& operator -= ( const SDL_Rect& other );
iVector2& operator + ( const iVector2& other );
iVector2& operator + ( const SDL_Rect& other );
int x; int x;
int y; int y;
};/// END STRUCT DEFINITION iVector2 };/// END STRUCT DEFINITION iVector2
}/// END NAMESPACE DEFINITION MathEngine }/// END NAMESPACE DEFINITION MathEngine
MathEngine::iVector2 operator + (const MathEngine::iVector2& lhs, const MathEngine::iVector2& rhs); MathEngine::iVector2 operator + ( const MathEngine::iVector2& lhs, const MathEngine::iVector2& rhs );
#endif/// END IFNDEF _IVECTOR2_HPP_ #endif/// END IFNDEF _IVECTOR2_HPP_
@@ -21,7 +21,7 @@ iVector3::iVector3( const SDL_Rect& copy )
z = int(copy.w); z = int(copy.w);
} }
iVector3& iVector3::operator=( const SDL_Rect& copy ) iVector3& iVector3::operator = ( const SDL_Rect& copy )
{ {
x = int(copy.x); x = int(copy.x);
y = int(copy.y); y = int(copy.y);
@@ -30,7 +30,7 @@ iVector3& iVector3::operator=( const SDL_Rect& copy )
return *this; return *this;
} }
bool iVector3::operator==( const SDL_Rect& other ) const bool iVector3::operator == ( const SDL_Rect& other ) const
{ {
bool rtn = false; bool rtn = false;
if ( x == other.x ) if ( x == other.x )
@@ -47,7 +47,7 @@ iVector3::iVector3( const Vector3& copy )
z = int(copy.z); z = int(copy.z);
} }
iVector3& iVector3::operator=( const Vector3& copy ) iVector3& iVector3::operator = ( const Vector3& copy )
{ {
x = int(copy.x); x = int(copy.x);
y = int(copy.y); y = int(copy.y);
@@ -56,7 +56,7 @@ iVector3& iVector3::operator=( const Vector3& copy )
return *this; return *this;
} }
bool iVector3::operator==( const iVector3& other ) const bool iVector3::operator == ( const iVector3& other ) const
{ {
bool rtn = false; bool rtn = false;
if ( x == other.x ) if ( x == other.x )
@@ -21,15 +21,15 @@ namespace MathEngine {
iVector3( const SDL_Rect& copy ); iVector3( const SDL_Rect& copy );
iVector3& operator=( const SDL_Rect& copy ); iVector3& operator = ( const SDL_Rect& copy );
bool operator==( const SDL_Rect& other ) const; bool operator == ( const SDL_Rect& other ) const;
iVector3( const Vector3& copy ); iVector3( const Vector3& copy );
iVector3& operator=( const Vector3& copy ); iVector3& operator = ( const Vector3& copy );
bool operator==( const iVector3& other ) const; bool operator == ( const iVector3& other ) const;
int z; int z;
};/// END STRUCT DEFINITION iVector3 };/// END STRUCT DEFINITION iVector3
@@ -26,7 +26,7 @@ iVector4::iVector4( const SDL_Rect& copy )
w = int(copy.h); w = int(copy.h);
} }
iVector4& iVector4::operator=( const SDL_Rect& copy ) iVector4& iVector4::operator = ( const SDL_Rect& copy )
{ {
x = int(copy.x); x = int(copy.x);
y = int(copy.y); y = int(copy.y);
@@ -36,7 +36,7 @@ iVector4& iVector4::operator=( const SDL_Rect& copy )
return *this; return *this;
} }
bool iVector4::operator==( const SDL_Rect& other ) const bool iVector4::operator == ( const SDL_Rect& other ) const
{ {
bool rtn = false; bool rtn = false;
if ( x == other.x ) if ( x == other.x )
@@ -55,7 +55,7 @@ iVector4::iVector4( const Vector4& copy )
w = int(copy.w); w = int(copy.w);
} }
iVector4& iVector4::operator=( const Vector4& copy ) iVector4& iVector4::operator = ( const Vector4& copy )
{ {
x = int(copy.x); x = int(copy.x);
y = int(copy.y); y = int(copy.y);
@@ -65,7 +65,7 @@ iVector4& iVector4::operator=( const Vector4& copy )
return *this; return *this;
} }
bool iVector4::operator==( const iVector4& other ) const bool iVector4::operator == ( const iVector4& other ) const
{ {
bool rtn = false; bool rtn = false;
if ( x == other.x ) if ( x == other.x )
@@ -23,15 +23,15 @@ namespace MathEngine {
iVector4( const SDL_Rect& copy ); iVector4( const SDL_Rect& copy );
iVector4& operator=( const SDL_Rect& copy ); iVector4& operator = ( const SDL_Rect& copy );
bool operator==( const SDL_Rect& other ) const; bool operator == ( const SDL_Rect& other ) const;
iVector4( const Vector4& copy ); iVector4( const Vector4& copy );
iVector4& operator=( const Vector4& copy ); iVector4& operator = ( const Vector4& copy );
bool operator==( const iVector4& other ) const; bool operator == ( const iVector4& other ) const;
int w; int w;
};/// END STRUCT DEFINITION iVector4 };/// END STRUCT DEFINITION iVector4
@@ -70,7 +70,7 @@ void cText::Red()
} }
/// Sets /// Sets
void cText::setSize(const unsigned long int size /*= 8*/) void cText::setSize( const unsigned long int size /*= 8*/ )
{ {
if (m_size != size) { if (m_size != size) {
m_size = size; m_size = size;
@@ -19,7 +19,7 @@ cTiming::~cTiming()
CleanUp(); CleanUp();
} }
cTiming& cTiming::operator=( const cTiming& copy ) cTiming& cTiming::operator = ( const cTiming& copy )
{ {
if (this != &copy) if (this != &copy)
setFTP(copy.getFTP()); setFTP(copy.getFTP());
@@ -21,7 +21,7 @@ namespace TimingEngine {
~cTiming(); ~cTiming();
public: public:
cTiming& operator=( const cTiming& copy ); cTiming& operator = ( const cTiming& copy );
/// Functions /// Functions
static cTiming& Inst(); static cTiming& Inst();
@@ -1,6 +1,6 @@
#include "msunix.hpp" #include "msunix.hpp"
int vasprintf(char ** ret, const char * format, va_list ap) int vasprintf( char ** ret, const char * format, va_list ap )
{ {
int len; int len;
char *buffer; char *buffer;
@@ -25,7 +25,7 @@ int vasprintf(char ** ret, const char * format, va_list ap)
return len - 1; return len - 1;
}*/ }*/
int setenv(const char *name, const char *value, int overwrite) int setenv( const char *name, const char *value, int overwrite )
{ {
int errcode = 0; int errcode = 0;
if(!overwrite) { if(!overwrite) {
@@ -7,8 +7,8 @@
#include <cstdlib> #include <cstdlib>
#include <cstdarg> #include <cstdarg>
int vasprintf(char ** ret, const char * format, va_list ap); int vasprintf( char ** ret, const char * format, va_list ap );
//int snprintf(char * str, size_t size, const char * format, ...); //int snprintf(char * str, size_t size, const char * format, ...);
int setenv(const char *name, const char *value, int overwrite); int setenv( const char *name, const char *value, int overwrite );
#endif // __MSUNIX__ #endif // __MSUNIX__
@@ -19,12 +19,12 @@ cString::cString()
clear(); clear();
} }
cString::cString(const char* s) cString::cString( const char* s )
{ {
copy_str(s); copy_str(s);
} }
cString::cString(const cString& copy) cString::cString( const cString& copy )
{ {
copy_str(copy); copy_str(copy);
} }
@@ -35,7 +35,7 @@ cString::~cString()
clear(); clear();
} }
const char* cString::alloc_str(size_t sz) const char* cString::alloc_str( size_t sz )
{ {
if (mp_str) if (mp_str)
clear(); clear();
@@ -57,7 +57,7 @@ const char* cString::c_str() const
return mp_str; return mp_str;
} }
const char* cString::copy_str(const char* copy) const char* cString::copy_str( const char* copy )
{ {
if (copy) { if (copy) {
size_t len = strnlen(copy, __cString__MAX_LEN); size_t len = strnlen(copy, __cString__MAX_LEN);
@@ -87,7 +87,7 @@ size_t cString::size() const
} }
/// string format /// string format
cString& cString::format(const char* format, ...) cString& cString::format( const char* format, ... )
{ {
char * buffer; char * buffer;
@@ -165,18 +165,18 @@ const char& cString::last_char() const
} }
/// non-destructive split /// non-destructive split
const std::vector<cString> cString::split(const char match) const const std::vector<cString> cString::split( const char match ) const
{ {
const char match_s[2] = { match, 0 }; const char match_s[2] = { match, 0 };
return split(match_s, -1); return split(match_s, -1);
} }
const std::vector<cString> cString::split(const char* match) const const std::vector<cString> cString::split( const char* match ) const
{ {
return split(match, -1); return split(match, -1);
} }
const std::vector<cString> cString::split(const char* match, int max_split) const const std::vector<cString> cString::split( const char* match, int max_split ) const
{ {
std::vector<cString> rtn; std::vector<cString> rtn;
if (length() < 1) if (length() < 1)
@@ -206,7 +206,7 @@ const std::vector<cString> cString::split(const char* match, int max_split) cons
return rtn; return rtn;
} }
const cString& cString::char_repl(const char& match, const char& repl) const cString& cString::char_repl( const char& match, const char& repl )
{ {
for (size_t i = 0; mp_str[i]; ++i) { for (size_t i = 0; mp_str[i]; ++i) {
if (mp_str[i] == match) mp_str[i] = repl; if (mp_str[i] == match) mp_str[i] = repl;
@@ -214,7 +214,7 @@ const cString& cString::char_repl(const char& match, const char& repl)
return *this; return *this;
} }
long int cString::char_find(const char& match) const long int cString::char_find( const char& match ) const
{ {
for (size_t i = 0; mp_str[i]; ++i) { for (size_t i = 0; mp_str[i]; ++i) {
if (mp_str[i] == match) if (mp_str[i] == match)
@@ -223,7 +223,7 @@ long int cString::char_find(const char& match) const
return -1; return -1;
} }
cString cString::substr(size_t start, size_t length) const cString cString::substr( size_t start, size_t length ) const
{ {
cString rs; cString rs;
char * buf; char * buf;
@@ -242,7 +242,7 @@ cString cString::substr(size_t start, size_t length) const
return rs; return rs;
} }
long int cString::find(const cString& match) long int cString::find( const cString& match )
{ {
char * pos = strstr(mp_str, match.c_str()); char * pos = strstr(mp_str, match.c_str());
if (pos) if (pos)
@@ -251,7 +251,7 @@ long int cString::find(const cString& match)
return -1; return -1;
} }
const cString cString::replace(const cString& match, const cString& repl) const cString cString::replace( const cString& match, const cString& repl )
{ {
cString rs; cString rs;
long f1 = find(match); long f1 = find(match);
@@ -296,25 +296,25 @@ const long int cString::ToInt() const
return strtol(mp_str, NULL, 10); return strtol(mp_str, NULL, 10);
} }
cString& cString::operator = (const char* rhs) cString& cString::operator = ( const char* rhs )
{ {
copy_str(rhs); copy_str(rhs);
return *this; return *this;
} }
cString& cString::operator = (const cString& rhs) cString& cString::operator = ( const cString& rhs )
{ {
copy_str(rhs.c_str()); copy_str(rhs.c_str());
return *this; return *this;
} }
cString& cString::operator += (const char rhs) cString& cString::operator += ( const char rhs )
{ {
operator+=(&rhs); operator+=(&rhs);
return *this; return *this;
} }
cString& cString::operator += (const char* rhs) cString& cString::operator += ( const char* rhs )
{ {
if (rhs) { if (rhs) {
size_t newlen = m_len + strnlen(rhs, __cString__MAX_LEN); size_t newlen = m_len + strnlen(rhs, __cString__MAX_LEN);
@@ -335,13 +335,13 @@ cString& cString::operator += (const char* rhs)
return *this; return *this;
} }
cString& cString::operator += (const cString& rhs) cString& cString::operator += ( const cString& rhs )
{ {
operator+=(rhs.c_str()); operator+=(rhs.c_str());
return *this; return *this;
} }
bool cString::operator == (const char* rhs) const bool cString::operator == ( const char* rhs ) const
{ {
if (std::strncmp(this->c_str(), rhs, __cString__MAX_LEN) == 0) if (std::strncmp(this->c_str(), rhs, __cString__MAX_LEN) == 0)
return true; return true;
@@ -349,7 +349,7 @@ bool cString::operator == (const char* rhs) const
return false; return false;
} }
bool cString::operator == (const cString& rhs) const bool cString::operator == ( const cString& rhs ) const
{ {
if (std::strncmp(this->c_str(), rhs.c_str(), __cString__MAX_LEN) == 0) if (std::strncmp(this->c_str(), rhs.c_str(), __cString__MAX_LEN) == 0)
return true; return true;
@@ -357,7 +357,7 @@ bool cString::operator == (const cString& rhs) const
return false; return false;
} }
bool cString::operator != (const char* rhs) const bool cString::operator != ( const char* rhs ) const
{ {
if (std::strncmp(this->c_str(), rhs, __cString__MAX_LEN) != 0) if (std::strncmp(this->c_str(), rhs, __cString__MAX_LEN) != 0)
return true; return true;
@@ -365,7 +365,7 @@ bool cString::operator != (const char* rhs) const
return false; return false;
} }
bool cString::operator != (const cString& rhs) const bool cString::operator != ( const cString& rhs ) const
{ {
if (std::strncmp(this->c_str(), rhs.c_str(), __cString__MAX_LEN) != 0) if (std::strncmp(this->c_str(), rhs.c_str(), __cString__MAX_LEN) != 0)
return true; return true;
@@ -373,7 +373,7 @@ bool cString::operator != (const cString& rhs) const
return false; return false;
} }
bool cString::operator > (const cString& rhs) const bool cString::operator > ( const cString& rhs ) const
{ {
if (std::strncmp(this->c_str(), rhs.c_str(), __cString__MAX_LEN) > 0) if (std::strncmp(this->c_str(), rhs.c_str(), __cString__MAX_LEN) > 0)
return true; return true;
@@ -381,7 +381,7 @@ bool cString::operator > (const cString& rhs) const
return false; return false;
} }
bool cString::operator < (const cString& rhs) const bool cString::operator < ( const cString& rhs ) const
{ {
if (std::strncmp(this->c_str(), rhs.c_str(), __cString__MAX_LEN) < 0) if (std::strncmp(this->c_str(), rhs.c_str(), __cString__MAX_LEN) < 0)
return true; return true;
@@ -389,7 +389,7 @@ bool cString::operator < (const cString& rhs) const
return false; return false;
} }
bool cString::operator >= (const cString& rhs) const bool cString::operator >= ( const cString& rhs ) const
{ {
if (std::strncmp(this->c_str(), rhs.c_str(), __cString__MAX_LEN) >= 0) if (std::strncmp(this->c_str(), rhs.c_str(), __cString__MAX_LEN) >= 0)
return true; return true;
@@ -397,7 +397,7 @@ bool cString::operator >= (const cString& rhs) const
return false; return false;
} }
bool cString::operator <= (const cString& rhs) const bool cString::operator <= ( const cString& rhs ) const
{ {
if (std::strncmp(this->c_str(), rhs.c_str(), __cString__MAX_LEN) <= 0) if (std::strncmp(this->c_str(), rhs.c_str(), __cString__MAX_LEN) <= 0)
return true; return true;
@@ -414,7 +414,7 @@ cString::operator std::string () const
return std::string(c_str()); return std::string(c_str());
} }
cString operator + (const cString& lhs, const cString& rhs) cString operator + ( const cString& lhs, const cString& rhs )
{ {
cString rs = lhs; cString rs = lhs;
rs += rhs; rs += rhs;
@@ -23,52 +23,52 @@ namespace UtilityEngine {
{ {
public: public:
cString(); /// default constructor cString(); /// default constructor
cString(const char* s); cString( const char* s );
cString(const cString& copy); /// copy constructor cString( const cString& copy ); /// copy constructor
~cString(); ~cString();
const char* alloc_str(size_t sz); /// smart alloc string const char* alloc_str( size_t sz ); /// smart alloc string
void clear(); /// frees the string void clear(); /// frees the string
const char* c_str() const; /// getter const char* c_str() const; /// getter
const char* copy_str(const char* copy); /// alloc & copy const char* copy_str( const char* copy ); /// alloc & copy
/// utility methods /// utility methods
bool have_value() const; bool have_value() const;
size_t length() const; size_t length() const;
size_t size() const; size_t size() const;
cString& format(const char* format, ...); cString& format( const char* format, ... );
cString& trim(); cString& trim();
cString lower() const; cString lower() const;
cString upper() const; cString upper() const;
const char& first_char() const; const char& first_char() const;
const char& last_char() const; const char& last_char() const;
const std::vector<cString> split(const char match) const; const std::vector<cString> split( const char match ) const;
const std::vector<cString> split(const char* match) const; const std::vector<cString> split( const char* match ) const;
const std::vector<cString> split(const char* match, int max_split) const; const std::vector<cString> split( const char* match, int max_split ) const;
long int char_find(const char& match) const; long int char_find( const char& match ) const;
const cString& char_repl(const char& match, const char& repl); const cString& char_repl( const char& match, const char& repl );
cString substr(size_t start, size_t length) const; cString substr( size_t start, size_t length ) const;
long int find(const cString& match); long int find( const cString& match );
const cString replace(const cString& match, const cString& repl); const cString replace( const cString& match, const cString& repl );
const bool IsInt() const; const bool IsInt() const;
const long int ToInt() const; const long int ToInt() const;
/// operators /// operators
cString& operator = (const char* rhs); /// assignment operator cString& operator = ( const char* rhs ); /// assignment operator
cString& operator = (const cString& rhs); /// assignment operator cString& operator = ( const cString& rhs ); /// assignment operator
cString& operator += (const char rhs); cString& operator += ( const char rhs );
cString& operator += (const char* rhs); /// concatenation operator cString& operator += ( const char* rhs ); /// concatenation operator
cString& operator += (const cString& rhs); /// concatenation operator cString& operator += ( const cString& rhs ); /// concatenation operator
bool operator == (const char* rhs) const; /// comparisons bool operator == ( const char* rhs ) const; /// comparisons
bool operator == (const cString& rhs) const; bool operator == ( const cString& rhs ) const;
bool operator != (const char* rhs) const; bool operator != ( const char* rhs ) const;
bool operator != (const cString& rhs) const; bool operator != ( const cString& rhs ) const;
bool operator > (const cString& rhs) const; bool operator > ( const cString& rhs ) const;
bool operator < (const cString& rhs) const; bool operator < ( const cString& rhs ) const;
bool operator >= (const cString& rhs) const; bool operator >= ( const cString& rhs ) const;
bool operator <= (const cString& rhs) const; bool operator <= ( const cString& rhs ) const;
/// conversion operators /// conversion operators
operator const char* () const; /// c-string type operator const char* () const; /// c-string type
@@ -81,5 +81,5 @@ namespace UtilityEngine {
};/// END CLASS DEFINITION cString };/// END CLASS DEFINITION cString
}/// END NAMESPACE DEFINITION UtilityEngine }/// END NAMESPACE DEFINITION UtilityEngine
/// function overloads /// function overloads
UtilityEngine::cString operator + (const UtilityEngine::cString& lhs, const UtilityEngine::cString& rhs); UtilityEngine::cString operator + ( const UtilityEngine::cString& lhs, const UtilityEngine::cString& rhs );
#endif/// END IFNDEF _CSTRING_HPP_ #endif/// END IFNDEF _CSTRING_HPP_
@@ -4,14 +4,14 @@ using VideoEngine::cAnimatedSprite;
cAnimatedSprite::cAnimatedSprite( const unsigned long int x /*= 0*/, const unsigned long int y /*= 0*/, cAnimatedSprite::cAnimatedSprite( const unsigned long int x /*= 0*/, const unsigned long int y /*= 0*/,
const unsigned long int fps /*= 16*/ ) const unsigned long int fps /*= 16*/ )
: m_nextTime(0), m_RATE(0) : m_nextTime(0), m_RATE(0)
{ {
setFPS(fps); setFPS(fps);
setIncrement(x, y); setIncrement(x, y);
} }
cAnimatedSprite::cAnimatedSprite( const cAnimatedSprite& copy ) cAnimatedSprite::cAnimatedSprite( const cAnimatedSprite& copy )
: m_nextTime(0), m_RATE(0) : m_nextTime(0), m_RATE(0)
{ {
setFPS(copy.getFPS()); setFPS(copy.getFPS());
setIncrement(copy.getXIncrement(), copy.getYIncrement()); setIncrement(copy.getXIncrement(), copy.getYIncrement());
@@ -9,7 +9,7 @@ using UtilityEngine::cUtility;
cCamera::cCamera( const signed long int xPos /*= 0*/, const signed long int yPos /*= 0*/, cCamera::cCamera( const signed long int xPos /*= 0*/, const signed long int yPos /*= 0*/,
const unsigned long int reswidth /*= 640*/, const unsigned long int reshight /*= 480*/ ) const unsigned long int reswidth /*= 640*/, const unsigned long int reshight /*= 480*/ )
: mp_texture(nullptr) : mp_texture(nullptr)
{ {
m_position.x = Sint16(xPos); m_position.x = Sint16(xPos);
m_position.y = Sint16(yPos); m_position.y = Sint16(yPos);
@@ -9,27 +9,27 @@ using UtilityEngine::cUtility;
cImage::cImage( const bool transparent /*= false*/, const unsigned char red /*= 0*/, const unsigned char blue /*= 0*/, const unsigned char green /*= 255*/, cImage::cImage( const bool transparent /*= false*/, const unsigned char red /*= 0*/, const unsigned char blue /*= 0*/, const unsigned char green /*= 255*/,
const unsigned char translevel /*= 255*/, const bool isSurface /*= false*/ ) const unsigned char translevel /*= 255*/, const bool isSurface /*= false*/ )
: mp_texture(nullptr), mp_surface(nullptr), m_transparent(transparent), : mp_texture(nullptr), mp_surface(nullptr), m_transparent(transparent),
m_transRed(red), m_transBlue(blue), m_transGreen(green), m_transLevel(translevel), m_isSurface(isSurface) m_transRed(red), m_transBlue(blue), m_transGreen(green), m_transLevel(translevel), m_isSurface(isSurface)
{} {}
cImage::cImage( SDL_Surface* surface ) cImage::cImage( SDL_Surface* surface )
: mp_texture(nullptr), mp_surface(nullptr), m_transparent(false), : mp_texture(nullptr), mp_surface(nullptr), m_transparent(false),
m_transRed(0), m_transBlue(0), m_transGreen(255), m_transLevel(255) m_transRed(0), m_transBlue(0), m_transGreen(255), m_transLevel(255)
{ {
setImage(surface); setImage(surface);
} }
cImage::cImage( SDL_Texture* texture ) cImage::cImage( SDL_Texture* texture )
: mp_texture(nullptr), mp_surface(nullptr), m_transparent(false), : mp_texture(nullptr), mp_surface(nullptr), m_transparent(false),
m_transRed(0), m_transBlue(0), m_transGreen(255), m_transLevel(255) m_transRed(0), m_transBlue(0), m_transGreen(255), m_transLevel(255)
{ {
setImage(texture); setImage(texture);
} }
cImage::cImage( const cImage& copy, const bool surfaceCopy /*= true*/) cImage::cImage( const cImage& copy, const bool surfaceCopy /*= true*/)
: mp_texture(nullptr), mp_surface(nullptr), m_transparent(copy.getTransparent()), m_transRed(copy.getRedTrans()), : mp_texture(nullptr), mp_surface(nullptr), m_transparent(copy.getTransparent()), m_transRed(copy.getRedTrans()),
m_transBlue(copy.getBlueTrans()), m_transGreen(copy.getGreenTrans()), m_transLevel(copy.getLevelTrans()) m_transBlue(copy.getBlueTrans()), m_transGreen(copy.getGreenTrans()), m_transLevel(copy.getLevelTrans())
{ {
if (surfaceCopy == true) if (surfaceCopy == true)
mp_texture = copy.getImage(); mp_texture = copy.getImage();
@@ -47,7 +47,7 @@ namespace VideoEngine {
SDL_Texture* SurfaceToTexture( SDL_Surface* surface ); SDL_Texture* SurfaceToTexture( SDL_Surface* surface );
SDL_Surface* TextureToSurface( SDL_Texture* texture ); SDL_Surface* TextureToSurface( SDL_Texture* texture );
void CopyTexture( SDL_Texture* src, SDL_Texture* dst, bool software = false); void CopyTexture( SDL_Texture* src, SDL_Texture* dst, bool software = false );
SDL_Surface* CopySurface( SDL_Surface* src ); SDL_Surface* CopySurface( SDL_Surface* src );
@@ -7,19 +7,8 @@ using VideoEngine::cSprite;
using MathEngine::iVector2; using MathEngine::iVector2;
using MathEngine::iVector4; using MathEngine::iVector4;
cSprite::cSprite( const signed long int xpos /*= 0*/, const signed long int ypos /*= 0*/, const signed long int xarea /*= 0*/,
const signed long int yarea /*= 0*/, const unsigned long int warea /*= 0*/, const unsigned long int harea /*= 0*/,
VideoEngine::cImage** image /*= nullptr*/, VideoEngine::cCamera** camera /*= nullptr*/ )
: mpp_image(image), mpp_camera(camera)
{
setPosition(Sint16(xpos), Sint16(ypos));
setStartImageArea(Sint16(xarea), Sint16(yarea));
setEndImageArea(Uint16(warea), Uint16(harea));
}
cSprite::cSprite( VideoEngine::cImage** image, VideoEngine::cCamera** camera /*= nullptr*/ ) cSprite::cSprite( VideoEngine::cImage** image, VideoEngine::cCamera** camera /*= nullptr*/ )
: mpp_image(image), mpp_camera(camera) : mpp_image(image), mpp_camera(camera)
{ {
setPosition(0, 0); setPosition(0, 0);
@@ -27,6 +16,17 @@ cSprite::cSprite( VideoEngine::cImage** image, VideoEngine::cCamera** camera /*=
setEndImageArea(Uint16((*mpp_image)->getWidth()), Uint16((*mpp_image)->getHeight())); setEndImageArea(Uint16((*mpp_image)->getWidth()), Uint16((*mpp_image)->getHeight()));
} }
cSprite::cSprite( const signed long int xpos /*= 0*/, const signed long int ypos /*= 0*/, const signed long int xarea /*= 0*/,
const signed long int yarea /*= 0*/, const unsigned long int warea /*= 0*/, const unsigned long int harea /*= 0*/,
VideoEngine::cImage** image /*= nullptr*/, VideoEngine::cCamera** camera /*= nullptr*/ )
: mpp_image(image), mpp_camera(camera)
{
setPosition(Sint16(xpos), Sint16(ypos));
setStartImageArea(Sint16(xarea), Sint16(yarea));
setEndImageArea(Uint16(warea), Uint16(harea));
}
cSprite::cSprite( const cSprite& copy ) cSprite::cSprite( const cSprite& copy )
{ {
Copy(copy); Copy(copy);
@@ -156,7 +156,7 @@ void cSprite::setPosition( const MathEngine::iVector2& position /*= MathEngine::
setPosition(position.x, position.y); setPosition(position.x, position.y);
} }
void cSprite::setImageArea( const MathEngine::iVector4& area /*= MathEngine::iVector4(0,0,0,0)*/) void cSprite::setImageArea( const MathEngine::iVector4& area /*= MathEngine::iVector4(0,0,0,0)*/ )
{ {
if (area == iVector4(0,0,0,0)) { if (area == iVector4(0,0,0,0)) {
setStartImageArea(0,0); setStartImageArea(0,0);
@@ -189,6 +189,11 @@ void cSprite::setImage( VideoEngine::cImage** image )
mpp_image = image; mpp_image = image;
} }
void cSprite::setImage(VideoEngine::cImageFile** image)
{
setImage((VideoEngine::cImage**) image);
}
void cSprite::setCamera( VideoEngine::cCamera** camera ) void cSprite::setCamera( VideoEngine::cCamera** camera )
{ {
mpp_camera = camera; mpp_camera = camera;
@@ -6,6 +6,7 @@
/*** Custom Header Files ***/ /*** Custom Header Files ***/
#include "cImage.hpp" #include "cImage.hpp"
#include "cImageFile.hpp"
#include "cCamera.hpp" #include "cCamera.hpp"
#include "../TextTypeEngine/cText.hpp" #include "../TextTypeEngine/cText.hpp"
@@ -27,13 +28,13 @@ namespace VideoEngine {
cSprite( const signed long int xpos = 0, const signed long int ypos = 0, const signed long int xarea = 0, cSprite( const signed long int xpos = 0, const signed long int ypos = 0, const signed long int xarea = 0,
const signed long int yarea = 0, const unsigned long int warea = 0, const unsigned long int harea = 0, const signed long int yarea = 0, const unsigned long int warea = 0, const unsigned long int harea = 0,
VideoEngine::cImage** image = nullptr, VideoEngine::cCamera** camera = nullptr ); VideoEngine::cImage** image = nullptr, VideoEngine::cCamera** camera = nullptr );
cSprite( const cSprite& copy ); cSprite( const cSprite& copy );
cSprite& operator=( const cSprite& copy ); cSprite& operator=( const cSprite& copy );
~cSprite(); ~cSprite();
/// Functions /// Functions
cSprite& Copy(const cSprite& copy); cSprite& Copy( const cSprite& copy );
/* Draws the sprite to the video buffer */ /* Draws the sprite to the video buffer */
void Draw(); void Draw();
/* Draws the sprite to the camera */ /* Draws the sprite to the camera */
@@ -67,6 +68,7 @@ namespace VideoEngine {
/* Sets the pointer to a pointer for the image that the sprite will use */ /* Sets the pointer to a pointer for the image that the sprite will use */
void setImage( VideoEngine::cImage** image ); void setImage( VideoEngine::cImage** image );
void setImage( VideoEngine::cImageFile** image );
/* Sets the pointer to a pointer for the camera the sprite will be draw on */ /* Sets the pointer to a pointer for the camera the sprite will be draw on */
void setCamera( VideoEngine::cCamera** camera ); void setCamera( VideoEngine::cCamera** camera );
+2 -2
View File
@@ -126,7 +126,7 @@
<ClInclude Include="TrooperEngine\EventEngine\cEvent.hpp" /> <ClInclude Include="TrooperEngine\EventEngine\cEvent.hpp" />
<ClInclude Include="TrooperEngine\EventEngine\cEventControl.hpp" /> <ClInclude Include="TrooperEngine\EventEngine\cEventControl.hpp" />
<ClInclude Include="TrooperEngine\FXEngine\cGFX.hpp" /> <ClInclude Include="TrooperEngine\FXEngine\cGFX.hpp" />
<ClInclude Include="TrooperEngine\GUIEngine\cBoxSizer.hpp" /> <ClInclude Include="TrooperEngine\GUIEngine\cSizer.hpp" />
<ClInclude Include="TrooperEngine\GUIEngine\cButton.hpp" /> <ClInclude Include="TrooperEngine\GUIEngine\cButton.hpp" />
<ClInclude Include="TrooperEngine\GUIEngine\cGUI.hpp" /> <ClInclude Include="TrooperEngine\GUIEngine\cGUI.hpp" />
<ClInclude Include="TrooperEngine\GUIEngine\cLayout.hpp" /> <ClInclude Include="TrooperEngine\GUIEngine\cLayout.hpp" />
@@ -178,7 +178,7 @@
<ClCompile Include="TrooperEngine\EventEngine\cEvent.cpp" /> <ClCompile Include="TrooperEngine\EventEngine\cEvent.cpp" />
<ClCompile Include="TrooperEngine\EventEngine\cEventControl.cpp" /> <ClCompile Include="TrooperEngine\EventEngine\cEventControl.cpp" />
<ClCompile Include="TrooperEngine\FXEngine\cGFX.cpp" /> <ClCompile Include="TrooperEngine\FXEngine\cGFX.cpp" />
<ClCompile Include="TrooperEngine\GUIEngine\cBoxSizer.cpp" /> <ClCompile Include="TrooperEngine\GUIEngine\cSizer.cpp" />
<ClCompile Include="TrooperEngine\GUIEngine\cButton.cpp" /> <ClCompile Include="TrooperEngine\GUIEngine\cButton.cpp" />
<ClCompile Include="TrooperEngine\GUIEngine\cGUI.cpp" /> <ClCompile Include="TrooperEngine\GUIEngine\cGUI.cpp" />
<ClCompile Include="TrooperEngine\GUIEngine\cLayout.cpp" /> <ClCompile Include="TrooperEngine\GUIEngine\cLayout.cpp" />
@@ -150,9 +150,6 @@
<ClInclude Include="TrooperEngine\GUIEngine\cGUI.hpp"> <ClInclude Include="TrooperEngine\GUIEngine\cGUI.hpp">
<Filter>TrooperEngine\GUIEngine</Filter> <Filter>TrooperEngine\GUIEngine</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="TrooperEngine\GUIEngine\cBoxSizer.hpp">
<Filter>TrooperEngine\GUIEngine</Filter>
</ClInclude>
<ClInclude Include="TrooperEngine\MathEngine\iVector\iVector4.hpp"> <ClInclude Include="TrooperEngine\MathEngine\iVector\iVector4.hpp">
<Filter>TrooperEngine\MathEngine\iVector</Filter> <Filter>TrooperEngine\MathEngine\iVector</Filter>
</ClInclude> </ClInclude>
@@ -219,6 +216,9 @@
<ClInclude Include="TrooperEngine\TextTypeEngine\TextTypeHelpers\cFontHolder.hpp"> <ClInclude Include="TrooperEngine\TextTypeEngine\TextTypeHelpers\cFontHolder.hpp">
<Filter>TrooperEngine\TextTypeEngine\TextTypeHelpers</Filter> <Filter>TrooperEngine\TextTypeEngine\TextTypeHelpers</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="TrooperEngine\GUIEngine\cSizer.hpp">
<Filter>TrooperEngine\GUIEngine</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="TrooperEngine\AudioEngine\cAudio.cpp"> <ClCompile Include="TrooperEngine\AudioEngine\cAudio.cpp">
@@ -332,9 +332,6 @@
<ClCompile Include="TrooperEngine\UtilityEngine\cString.cpp"> <ClCompile Include="TrooperEngine\UtilityEngine\cString.cpp">
<Filter>TrooperEngine\UtilityEngine</Filter> <Filter>TrooperEngine\UtilityEngine</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="TrooperEngine\GUIEngine\cBoxSizer.cpp">
<Filter>TrooperEngine\GUIEngine</Filter>
</ClCompile>
<ClCompile Include="TrooperEngine\UtilityEngine\MSUNIX\msunix.cpp"> <ClCompile Include="TrooperEngine\UtilityEngine\MSUNIX\msunix.cpp">
<Filter>TrooperEngine\UtilityEngine\MSUNIX</Filter> <Filter>TrooperEngine\UtilityEngine\MSUNIX</Filter>
</ClCompile> </ClCompile>
@@ -368,5 +365,8 @@
<ClCompile Include="TrooperEngine\TextTypeEngine\TextTypeHelpers\cFontHolder.cpp"> <ClCompile Include="TrooperEngine\TextTypeEngine\TextTypeHelpers\cFontHolder.cpp">
<Filter>TrooperEngine\TextTypeEngine\TextTypeHelpers</Filter> <Filter>TrooperEngine\TextTypeEngine\TextTypeHelpers</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="TrooperEngine\GUIEngine\cSizer.cpp">
<Filter>TrooperEngine\GUIEngine</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
</Project> </Project>
@@ -70,7 +70,7 @@
#include "../TrooperEngine/GUIEngine/cLabel.hpp" #include "../TrooperEngine/GUIEngine/cLabel.hpp"
#include "../TrooperEngine/GUIEngine/cButton.hpp" #include "../TrooperEngine/GUIEngine/cButton.hpp"
#include "../TrooperEngine/GUIEngine/cTextButton.hpp" #include "../TrooperEngine/GUIEngine/cTextButton.hpp"
#include "../TrooperEngine/GUIEngine/cBoxSizer.hpp" #include "../TrooperEngine/GUIEngine/cSizer.hpp"
/*** GUIHelper ***/ /*** GUIHelper ***/
#include "../TrooperEngine/GUIEngine/GUIHelpers/GUIUtility.hpp" #include "../TrooperEngine/GUIEngine/GUIHelpers/GUIUtility.hpp"
@@ -27,7 +27,7 @@ void GUIXMLTest()
// align = leftRight; // align = leftRight;
// } // }
GUIXMLBoxSizerTest(); GUIXMLSizerTest();
} }
void GUIXMLDefaultTest() void GUIXMLDefaultTest()
@@ -270,11 +270,11 @@ void GUIXMLAlignTest( const GUIHelpers::eAlign one /*= GUIHelpers::eAlign::DEFAU
GUIEngine::cGUI::Inst().Delete(); GUIEngine::cGUI::Inst().Delete();
} }
void GUIXMLBoxSizerTest() void GUIXMLSizerTest()
{ {
UTest u("GUI XML BoxSizer"); UTest u("GUI XML BoxSizer");
LoadFile("GUIXMLBoxSizerTest.xml", true); LoadFile("GUIXMLSizerTest.xml", true);
std::vector<GUIEngine::cWindow*> objects = GUIEngine::cGUI::Inst().GetObjects(); std::vector<GUIEngine::cWindow*> objects = GUIEngine::cGUI::Inst().GetObjects();
@@ -297,7 +297,7 @@ void GUIXMLBoxSizerTest()
cWindowTest("Layout", u, layout, sets); cWindowTest("Layout", u, layout, sets);
GUIEngine::cBoxSizer* boxsizer = (GUIEngine::cBoxSizer*)layout->getChildren()[0]; GUIEngine::cSizer* boxsizer = (GUIEngine::cSizer*)layout->getChildren()[0];
sets.pos = { 51, 15 }; sets.pos = { 51, 15 };
sets.size = { 172, 5 }; sets.size = { 172, 5 };
@@ -25,7 +25,7 @@ void GUIXMLPositionTest();
void GUIXMLAlignTest( const GUIHelpers::eAlign one = GUIHelpers::eAlign::DEFAULT_ALIGN, const GUIHelpers::eAlign two = GUIHelpers::eAlign::DEFAULT_ALIGN, void GUIXMLAlignTest( const GUIHelpers::eAlign one = GUIHelpers::eAlign::DEFAULT_ALIGN, const GUIHelpers::eAlign two = GUIHelpers::eAlign::DEFAULT_ALIGN,
const GUIHelpers::eAlign three = GUIHelpers::eAlign::DEFAULT_ALIGN, const GUIHelpers::eOrientation orientation = GUIHelpers::eOrientation::DEFAULT_ORIENTATION); const GUIHelpers::eAlign three = GUIHelpers::eAlign::DEFAULT_ALIGN, const GUIHelpers::eOrientation orientation = GUIHelpers::eOrientation::DEFAULT_ORIENTATION);
void GUIXMLBoxSizerTest(); void GUIXMLSizerTest();
void LoadFile( const cString& filename, const bool show = false ); void LoadFile( const cString& filename, const bool show = false );
+1 -1
View File
@@ -170,7 +170,7 @@
<ItemGroup> <ItemGroup>
<Xml Include="xml\GUI.xml" /> <Xml Include="xml\GUI.xml" />
<Xml Include="xml\GUIXMLAlignTest.xml" /> <Xml Include="xml\GUIXMLAlignTest.xml" />
<Xml Include="xml\GUIXMLBoxSizerTest.xml" /> <Xml Include="xml\GUIXMLSizerTest.xml" />
<Xml Include="xml\GUIXMLDefaultTest.xml"> <Xml Include="xml\GUIXMLDefaultTest.xml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Xml> </Xml>
@@ -95,7 +95,7 @@
<Xml Include="xml\GUIXMLAlignTest.xml"> <Xml Include="xml\GUIXMLAlignTest.xml">
<Filter>xml</Filter> <Filter>xml</Filter>
</Xml> </Xml>
<Xml Include="xml\GUIXMLBoxSizerTest.xml"> <Xml Include="xml\GUIXMLSizerTest.xml">
<Filter>xml</Filter> <Filter>xml</Filter>
</Xml> </Xml>
</ItemGroup> </ItemGroup>
+3 -3
View File
@@ -2,8 +2,8 @@
<Panel size="400,400"> <Panel size="400,400">
<debug/> <debug/>
<Layout> <Layout>
<Label align="left" text="Hello world Left" /> <Label align="left">Hello world Left</Label>
<Label align="center" text="Hello world Center" /> <Label align="center">Hello world Center</Label>
<Label align="right" text="Hello world Right" /> <Label align="right">Hello world Right</Label>
</Layout> </Layout>
</Panel> </Panel>
@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Panel size="200,200">
<debug />
<Layout>
<Boxsizer />
<Label text="Box Sizer" />
<Boxsizer />
</Layout>
</Panel>
+1 -1
View File
@@ -2,7 +2,7 @@
<Panel size="200,200"> <Panel size="200,200">
<debug/> <debug/>
<Layout> <Layout>
<Label text="Hello world" /> <Label>Hello world</Label>
<Include dir ="xml/" filename="include.xml"/> <Include dir ="xml/" filename="include.xml"/>
</Layout> </Layout>
</Panel> </Panel>
+11
View File
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Panel size="200,200">
<debug />
<Layout>
<!--<Include dir ="xml/" filename="include.xml"/>-->
<Sizer />
<Label>Sizer</Label>
<Sizer />
<Sizer />
</Layout>
</Panel>
+2 -2
View File
@@ -1,3 +1,3 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<Boxsizer /> <Sizer />
<Label text="Box Sizer" /> <Label>Sizer</Label>