diff --git a/TrooperEngineDLL/TrooperEngine/GUIEngine/GUIHelpers/GUIUtility.hpp b/TrooperEngineDLL/TrooperEngine/GUIEngine/GUIHelpers/GUIUtility.hpp index e56db8c..57c98c8 100644 --- a/TrooperEngineDLL/TrooperEngine/GUIEngine/GUIHelpers/GUIUtility.hpp +++ b/TrooperEngineDLL/TrooperEngine/GUIEngine/GUIHelpers/GUIUtility.hpp @@ -19,11 +19,12 @@ namespace GUIHelpers { typedef struct SDL_Rect Area; static const RGBA WHITE = { 255, 255, 255, 255 }; + static const RGBA GRAY = { 127, 127, 127, 255 }; static const RGBA BLACK = { 0, 0, 0, 255 }; static const RGBA RED = { 255, 0, 0, 255 }; - static const RGBA ORANGE = { 255, 128, 0, 255 }; + static const RGBA ORANGE = { 255, 127, 0, 255 }; static const RGBA YELLOW = { 255, 255, 0, 255 }; static const RGBA GREEN = { 0, 255, 0, 255 }; @@ -32,9 +33,9 @@ namespace GUIHelpers { static const RGBA BLUE = { 0, 0, 255, 255 }; - static const RGBA VIOLET = { 128, 0, 255, 255 }; + static const RGBA VIOLET = { 127, 0, 255, 255 }; static const RGBA MAGENTA = { 255, 0, 255, 255 }; - static const RGBA ROSE = { 255, 0, 128, 255 }; + static const RGBA ROSE = { 255, 0, 127, 255 }; static const RGBA DEFAULT = WHITE; diff --git a/TrooperEngineDLL/TrooperEngine/GUIEngine/GUIHelpers/cXMLoader.cpp b/TrooperEngineDLL/TrooperEngine/GUIEngine/GUIHelpers/cXMLoader.cpp index 9537d28..751551b 100644 --- a/TrooperEngineDLL/TrooperEngine/GUIEngine/GUIHelpers/cXMLoader.cpp +++ b/TrooperEngineDLL/TrooperEngine/GUIEngine/GUIHelpers/cXMLoader.cpp @@ -4,7 +4,6 @@ #include "../../UtilityEngine/cUtility.hpp" #include "../cGUI.hpp" -#include "../cLayout.hpp" using GUIHelpers::cXMLoader; @@ -66,6 +65,8 @@ void cXMLoader::GetElement( tinyxml2::XMLElement& element, GUIEngine::cWindow* p tmp = LabelBuild(element, parent); if (name == "sizer") tmp = SizerBuild(element, parent); + if (name == "button") + tmp = ButtonBuild(element, parent); tinyxml2::XMLElement* child = element.FirstChildElement(); if (child != nullptr) @@ -93,7 +94,7 @@ const cString cXMLoader::GetAttribute( const tinyxml2::XMLElement& element, cons return rtn; } -void cXMLoader::Include(const tinyxml2::XMLElement& element, GUIEngine::cWindow* parent) const +void cXMLoader::Include( const tinyxml2::XMLElement& element, GUIEngine::cWindow* parent ) const { cString dir = getDir(element); cString filename = getFileName(element); @@ -133,7 +134,7 @@ void cXMLoader::Debug(const tinyxml2::XMLElement& element) GUIEngine::cGUI::Inst().setDebugLevel(debug); } -GUIEngine::cPanel* cXMLoader::PanelBuild(const tinyxml2::XMLElement& element, GUIEngine::cWindow* parent) const +GUIEngine::cPanel* cXMLoader::PanelBuild( const tinyxml2::XMLElement& element, GUIEngine::cWindow* parent ) const { signed long int id = getID(element); GUIHelpers::eOrientation orientation = getOrientation(element); @@ -193,7 +194,7 @@ GUIEngine::cLabel* cXMLoader::LabelBuild( const tinyxml2::XMLElement& element, G return rtn; } -GUIEngine::cSizer* cXMLoader::SizerBuild(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); //GUIHelpers::eOrientation orientation = getOrientation(element); @@ -210,12 +211,30 @@ GUIEngine::cSizer* cXMLoader::SizerBuild(const tinyxml2::XMLElement& element, GU return rtn; } -const cString cXMLoader::getDir(const tinyxml2::XMLElement& element) const +GUIEngine::cButton * cXMLoader::ButtonBuild( const tinyxml2::XMLElement & element, GUIEngine::cWindow* parent ) const +{ + signed long int id = getID(element); + GUIHelpers::eOrientation orientation = getOrientation(element); + GUIHelpers::eAlign align = getAlign(element); + GUIHelpers::eLayout layout = getLayout(element); + GUIHelpers::Position pos = getPosition(element); + GUIHelpers::Size size = getSize(element); + GUIHelpers::Padding pad = getPadding(element); + + GUIEngine::cButton* rtn = new GUIEngine::cButton(parent, id, align, layout, pos, size, pad); + + if (parent == nullptr) + GUIEngine::cGUI::Inst().AddObject(rtn); + + return rtn; +} + +const cString cXMLoader::getDir( const tinyxml2::XMLElement& element ) const { return GetAttribute(element, "dir"); } -const cString cXMLoader::getFileName(const tinyxml2::XMLElement& element) const +const cString cXMLoader::getFileName( const tinyxml2::XMLElement& element ) const { return GetAttribute(element, "filename"); } @@ -240,7 +259,7 @@ const unsigned long int cXMLoader::getDebug( const tinyxml2::XMLElement& element return rtn; } -const bool cXMLoader::getDebugXML(const tinyxml2::XMLElement& element) const +const bool cXMLoader::getDebugXML( const tinyxml2::XMLElement& element ) const { bool rtn = false; cString str = GetAttribute(element, "xml").lower(); diff --git a/TrooperEngineDLL/TrooperEngine/GUIEngine/GUIHelpers/cXMLoader.hpp b/TrooperEngineDLL/TrooperEngine/GUIEngine/GUIHelpers/cXMLoader.hpp index 501ff5b..3f73a44 100644 --- a/TrooperEngineDLL/TrooperEngine/GUIEngine/GUIHelpers/cXMLoader.hpp +++ b/TrooperEngineDLL/TrooperEngine/GUIEngine/GUIHelpers/cXMLoader.hpp @@ -15,6 +15,7 @@ #include "../cLayout.hpp" #include "../cLabel.hpp" #include "../cSizer.hpp" +#include "../cButton.hpp" #include "../../UtilityEngine/cString.hpp" @@ -42,6 +43,7 @@ namespace GUIHelpers { GUIEngine::cLayout* LayoutBuild( const tinyxml2::XMLElement& element, GUIEngine::cWindow* parent ) const; GUIEngine::cLabel* LabelBuild( const tinyxml2::XMLElement& element, GUIEngine::cWindow* parent ) const; GUIEngine::cSizer* SizerBuild( const tinyxml2::XMLElement& element, GUIEngine::cWindow* parent ) const; + GUIEngine::cButton* ButtonBuild( const tinyxml2::XMLElement& element, GUIEngine::cWindow* parent ) const; const cString getDir( const tinyxml2::XMLElement& element ) const; const cString getFileName( const tinyxml2::XMLElement& element ) const; diff --git a/TrooperEngineDLL/TrooperEngine/GUIEngine/cButton.cpp b/TrooperEngineDLL/TrooperEngine/GUIEngine/cButton.cpp index b320361..e33dfd7 100644 --- a/TrooperEngineDLL/TrooperEngine/GUIEngine/cButton.cpp +++ b/TrooperEngineDLL/TrooperEngine/GUIEngine/cButton.cpp @@ -18,15 +18,14 @@ cButton::cButton() cButton::cButton( 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 cString& name /*= sNAME*/, VideoEngine::cImage** image /*= nullptr*/ ) - : cWindow(parent, id, sORIENTATION, align, layout, pos, size, padding, name) { - //Create(parent, id, align, layout, pos, size, padding, name, image); - mp_texture = nullptr; - mp_texturePress = nullptr; - - mpp_image = image; - - GenerateImage(); + Create(parent, id, align, layout, pos, size, padding, name, image); +// mp_texture = nullptr; +// mp_texturePress = nullptr; +// +// mpp_image = image; +// +// GenerateImage(); } /*virtual*/ cButton::~cButton() @@ -44,13 +43,22 @@ void cButton::Create( cWindow* parent, const signed int id, const GUIHelpers::eA const GUIHelpers::Position& pos /*= sPOSITION*/, const GUIHelpers::Size& size /*= sSIZE*/, const GUIHelpers::Padding& padding /*= sPADDING*/, const cString& name /*= sNAME*/, VideoEngine::cImage** image /*= nullptr*/ ) { - cWindow::Create(parent, id, sORIENTATION, align, layout, pos, size, padding, name); + cLayout::Create(parent, id, sORIENTATION, align, layout, pos, size, padding, name); + mp_texture = nullptr; mp_texturePress = nullptr; - mpp_image = image; + mpp_image = image; +} +void cButton::Display() +{ GenerateImage(); + + m_sprite.setPosition(cWindow::getPosition()); + m_sprite.Draw(); + m_sprite.SaveImage("test.bmp", "xml/"); + cWindow::Display(); } /*virtual*/ void cButton::Press() @@ -58,113 +66,47 @@ void cButton::Create( cWindow* parent, const signed int id, const GUIHelpers::eA mp_texture->SaveImage("hello.bmp"); } -// void cButton::setLabel( const cString& label ) -// { -// if (label.size() > 0) { -// if (mp_label == nullptr) -// mp_label = new TextTypeEngine::cText(label); -// else -// mp_label->setText(label); -// } -// } +/*virtual*/ void cButton::OnLButtonUp() +{ + +} /// Gets -// const cString cButton::getLabel() const -// { -// cString rtn = ""; -// if (mp_label != nullptr) -// rtn = mp_label->getText(); -// return rtn; -// } - /*virtual*/ const GUIHelpers::eType cButton::getType() const { return GUIHelpers::eType::CBUTTON; } +const GUIHelpers::RGBA& cButton::getDebugColour() const +{ + return GUIHelpers::ORANGE; +} /// private void cButton::GenerateImage() { + m_sprite.setImageArea(this->getSize(false)); GenerateTexture(); - //GenerateTexture( mp_texturePress ); - this->setImage((VideoEngine::cImage**)(&mp_texture)); + m_sprite.setImage((VideoEngine::cImage**)(&mp_texture)); - this->setImageArea(mp_texture->getWH()); + m_sprite.setImageArea(mp_texture->getWH()); } void cButton::GenerateTexture() { -// SDL_Rect t = { 0, 0, 0, 0 }; -// if (mp_label != nullptr) -// t = mp_label->getWH(); -// SDL_Rect centerText = { 0, 0, 0, 0 }; -// SDL_Rect centerButton = { 0, 0, 0, 0 }; -// SDL_Rect dim = this->getImageArea(); -// -// GUIHelpers::Padding TXTPADDING = PADDING; -// ///Find the min padding around the text. -// if (dim.w < (t.w + TXTPADDING.x + TXTPADDING.w) ) -// dim.w += (t.w + TXTPADDING.x + TXTPADDING.w); -// -// if (dim.h < (t.h + TXTPADDING.y + TXTPADDING.z) ) -// dim.h += (t.h + TXTPADDING.y + TXTPADDING.z); -// -// ///Find the center of the button -// centerButton.x = dim.w / 2; -// centerButton.y = dim.h / 2; -// -// ///Find the center of the text -// centerText.x = t.w / 2; -// centerText.y = t.h / 2; -// -// if (centerText.x < centerButton.x) -// t.x = centerButton.x - centerText.x; -// -// if (centerText.y < centerButton.y) -// t.y = centerButton.y - centerText.y; -// -// SDL_Texture* temptext = VideoEngine::cRenderer::Inst().NewTexture(dim.w, dim.h, SDL_TEXTUREACCESS_TARGET ); -// -// GUIHelpers::RBGA colour = { 100, 100, 100, 255 }; -// -// FXEngine::cGFX::Inst().RoundedRectangle(dim, 4, colour, temptext); -// -// -// if (mp_label != nullptr) -// VideoEngine::cRenderer::Inst().RenderToTexture(mp_label->getImage(), nullptr, temptext, &t); + GUIHelpers::RGBA colour = { 100, 100, 100, 255 }; - - //cRenderer::Inst().Render(temptext, nullptr, nullptr); + GUIHelpers::Size dim = this->getSize(false); - //cRenderer::Inst().RenderToTexture(temptext, nullptr, text->getImage(), nullptr); + SDL_Rect rect = { 0, 0, dim.x + 1, dim.y + 1 }; - /*SDL_Surface* tempsurface = SDL_CreateRGBSurface(cVideo::Inst().getVideoSettings(), dimensions.w, dimensions.h, cVideo::Inst().getColour(), - 0, 0, 0, 0); + SDL_Texture* tmptexture = VideoEngine::cRenderer::Inst().NewTexture(dim.x, dim.y); + SDL_Texture* tmptexture2 = VideoEngine::cRenderer::Inst().NewTexture(dim.x, dim.y); - SDL_FillRect(tempsurface, nullptr, SDL_MapRGB(tempsurface->format, 0, 255, 0)); + FXEngine::cGFX::Inst().RoundedBox(rect, 20, GUIHelpers::GRAY, tmptexture); + FXEngine::cGFX::Inst().RoundedBox(rect, 20, colour, tmptexture2); - /*if (roundedBoxRGBA(tempsurface, dimensions.x, dimensions.y, dimensions.w, dimensions.h, 10, 255, 255, 0, 255) != 0) - cerr << "Unable to generate GUI Texture." << endl << SDL_GetError() << endl;*/ - - - /*if (text != nullptr) { - SDL_Rect srcrect, dstrect = dimensions; - cVideo::Inst().Render(text->getImage(), &srcrect, temptext, &dstrect); - } - - this->setImage(temptext); - this->setTransparent();*/ - -// delete mp_texture; -// mp_texture = nullptr; -// -// mp_texture = new VideoEngine::cImage(temptext); -// -// GUIHelpers::Size size = { 0, 0 }; -// mp_texture->getWH((unsigned long&)size.x, (unsigned long&)size.y); -// cWindow::setSize(size); -// image->setImage(temptext); - //image->setImage(temptext); + mp_texture = new VideoEngine::cImage(tmptexture); + mp_texturePress = new VideoEngine::cImage(tmptexture2); } diff --git a/TrooperEngineDLL/TrooperEngine/GUIEngine/cButton.hpp b/TrooperEngineDLL/TrooperEngine/GUIEngine/cButton.hpp index fc21892..faabce4 100644 --- a/TrooperEngineDLL/TrooperEngine/GUIEngine/cButton.hpp +++ b/TrooperEngineDLL/TrooperEngine/GUIEngine/cButton.hpp @@ -13,18 +13,18 @@ #include "../VideoEngine/cImage.hpp" #include "../MathEngine/iVector/iVector2.hpp" -#include "cPanel.hpp" - /*** DLL Header File ***/ #include "dllExport.h" /*** Custom Header Files ***/ +#include "cLayout.hpp" #include "../UtilityEngine/cString.hpp" +#include "../EventEngine/cEvent.hpp" using UtilityEngine::cString; namespace GUIEngine { - class EXPORT_FROM_MYDLL cButton : public cWindow, public VideoEngine::cSprite + class EXPORT_FROM_MYDLL cButton : public cLayout, public EventEngine::cEvent { public: static const cString sNAME; /*= "button";*/ @@ -40,12 +40,17 @@ namespace GUIEngine { const GUIHelpers::Position& pos = sPOSITION, const GUIHelpers::Size& size = sSIZE, const GUIHelpers::Padding& padding = sPADDING, const cString& name = sNAME, VideoEngine::cImage** image = nullptr ); + virtual void Display(); + virtual void Press(); + virtual void OnLButtonUp(); + /// Sets /// Gets virtual const GUIHelpers::eType getType() const; + virtual const GUIHelpers::RGBA& getDebugColour() const; private: void CreateLabel(); @@ -54,10 +59,12 @@ namespace GUIEngine { private: /// Variables + VideoEngine::cSprite m_sprite; + VideoEngine::cImage* mp_texture;/// = nullptr VideoEngine::cImage* mp_texturePress;/// = nullptr - //Pointer to the image that will be displayed on the button. + /// Pointer to the image that will be displayed on the button. VideoEngine::cImage** mpp_image;/// = nullptr };/// END CLASS DEFINITION cButton }/// END NAMESPACE DEFINITION GUIEngine diff --git a/TrooperEngineDLL/TrooperEngine/GUIEngine/cGUI.cpp b/TrooperEngineDLL/TrooperEngine/GUIEngine/cGUI.cpp index 162f35a..230a9fc 100644 --- a/TrooperEngineDLL/TrooperEngine/GUIEngine/cGUI.cpp +++ b/TrooperEngineDLL/TrooperEngine/GUIEngine/cGUI.cpp @@ -35,7 +35,7 @@ cGUI::~cGUI() m_children.clear(); } -//public: +///public: ///Functions /*static*/ cGUI& cGUI::Inst() { @@ -104,7 +104,6 @@ std::vector& cGUI::GetObjects() void cGUI::Display() { - //m_obj->Display(); std::vector::iterator it; for (it = m_children.begin(); it < m_children.end(); it++) { diff --git a/TrooperEngineDLL/TrooperEngine/GUIEngine/cLabel.cpp b/TrooperEngineDLL/TrooperEngine/GUIEngine/cLabel.cpp index 7677f32..9695bf4 100644 --- a/TrooperEngineDLL/TrooperEngine/GUIEngine/cLabel.cpp +++ b/TrooperEngineDLL/TrooperEngine/GUIEngine/cLabel.cpp @@ -27,9 +27,6 @@ void cLabel::Create( cWindow* parent, const signed int id, const cString& label cWindow::Create(parent, id, sORIENTATION, align, layout, pos, size, padding, name); if (layout == GUIHelpers::eLayout::DEFAULT_LAYOUT) setLayout(sLAYOUT); - if (this->getParent() != nullptr) { - this->getParent()->AddChild(this); - } setText(label); } @@ -48,11 +45,6 @@ void cLabel::GenerateTexture() m_sprite.setImage((VideoEngine::cImage**)(&mp_text)); m_sprite.setImageArea(mp_text->getWH()); - - - - //this->setTransparent(); - //this->setPosition() } /// Sets diff --git a/TrooperEngineDLL/TrooperEngine/GUIEngine/cLayout.cpp b/TrooperEngineDLL/TrooperEngine/GUIEngine/cLayout.cpp index dc5d22a..3a1ba41 100644 --- a/TrooperEngineDLL/TrooperEngine/GUIEngine/cLayout.cpp +++ b/TrooperEngineDLL/TrooperEngine/GUIEngine/cLayout.cpp @@ -24,9 +24,6 @@ cLayout::cLayout( cWindow* parent, const signed int id, const GUIHelpers::eOrien if (ori == GUIHelpers::eOrientation::DEFAULT_ORIENTATION) ori = sORIENTATION; cWindow::Create(parent, id, ori, align, layout, pos, size, padding, name); - if (this->getParent() != nullptr) { - this->getParent()->AddChild(this); - } } /*virtual*/ void cLayout::Display() diff --git a/TrooperEngineDLL/TrooperEngine/GUIEngine/cSizer.cpp b/TrooperEngineDLL/TrooperEngine/GUIEngine/cSizer.cpp index 2febb6a..d98113f 100644 --- a/TrooperEngineDLL/TrooperEngine/GUIEngine/cSizer.cpp +++ b/TrooperEngineDLL/TrooperEngine/GUIEngine/cSizer.cpp @@ -24,9 +24,6 @@ void cSizer::Create( cWindow* parent, const signed int id, const GUIHelpers::eAl if (size.x < 0) sz = sSIZE; cWindow::Create(parent, id, sORIENTATION, align, layout, pos, sz, padding, name); - if (this->getParent() != nullptr) { - this->getParent()->AddChild(this); - } } /*virtual*/ const GUIHelpers::eType cSizer::getType() const diff --git a/TrooperEngineDLL/TrooperEngine/GUIEngine/cWindow.cpp b/TrooperEngineDLL/TrooperEngine/GUIEngine/cWindow.cpp index bb89dfa..5da4472 100644 --- a/TrooperEngineDLL/TrooperEngine/GUIEngine/cWindow.cpp +++ b/TrooperEngineDLL/TrooperEngine/GUIEngine/cWindow.cpp @@ -50,6 +50,10 @@ cWindow::cWindow( cWindow* parent /*= nullptr*/, const signed int id /*= -1*/, c setSize(size); setPadding(padding); m_name = name; + + if (this->getParent() != nullptr) { + this->getParent()->AddChild(this); + } } /*virtual*/ void cWindow::Display() { @@ -569,6 +573,9 @@ void cWindow::DebugDisplay() const typePos = { -10, -10, 0, 0 }; type = "Label"; break; + case GUIHelpers::eType::CBUTTON: + type = "Button"; + break; default: type = ""; } diff --git a/TrooperEngineDLL/TrooperEngine/GUIEngine/cWindow.hpp b/TrooperEngineDLL/TrooperEngine/GUIEngine/cWindow.hpp index 2ff8080..3d63dd5 100644 --- a/TrooperEngineDLL/TrooperEngine/GUIEngine/cWindow.hpp +++ b/TrooperEngineDLL/TrooperEngine/GUIEngine/cWindow.hpp @@ -91,9 +91,7 @@ namespace GUIEngine { const unsigned long int getFillParentSize(); - virtual const GUIHelpers::eType getType() const; - - + virtual const GUIHelpers::eType getType() const; virtual void Resize(); virtual void RebuildLayout( const GUIHelpers::eLayout& layout ); diff --git a/TrooperEngineDLL/TrooperEngine/VideoEngine/cImage.cpp b/TrooperEngineDLL/TrooperEngine/VideoEngine/cImage.cpp index 967706e..80f6061 100644 --- a/TrooperEngineDLL/TrooperEngine/VideoEngine/cImage.cpp +++ b/TrooperEngineDLL/TrooperEngine/VideoEngine/cImage.cpp @@ -13,16 +13,16 @@ cImage::cImage( const bool transparent /*= false*/, const unsigned char red /*= 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), - m_transRed(0), m_transBlue(0), m_transGreen(255), m_transLevel(255) + m_transRed(0), m_transBlue(0), m_transGreen(255), m_transLevel(255), m_isSurface(true) { setImage(surface); } -cImage::cImage( SDL_Texture* texture ) +cImage::cImage(SDL_Texture* texture) : 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), m_isSurface(false) { setImage(texture); } diff --git a/TrooperEngineDLL/dllExportFiles/TrooperEngine.hpp b/TrooperEngineDLL/dllExportFiles/TrooperEngine.hpp index 8f8940f..5ebd9dc 100644 --- a/TrooperEngineDLL/dllExportFiles/TrooperEngine.hpp +++ b/TrooperEngineDLL/dllExportFiles/TrooperEngine.hpp @@ -66,6 +66,7 @@ /*** GUIEngine ***/ #include "../TrooperEngine/GUIEngine/cGUI.hpp" #include "../TrooperEngine/GUIEngine/cWindow.hpp" +#include "../TrooperEngine/GUIEngine/cPanel.hpp" #include "../TrooperEngine/GUIEngine/cLayout.hpp" #include "../TrooperEngine/GUIEngine/cLabel.hpp" #include "../TrooperEngine/GUIEngine/cButton.hpp" diff --git a/TrooperEngineTest/GUI.cpp b/TrooperEngineTest/GUI.cpp new file mode 100644 index 0000000..c53bb8f --- /dev/null +++ b/TrooperEngineTest/GUI.cpp @@ -0,0 +1,8 @@ +#include "GUI.hpp" + +GUI::GUI() +{} + +GUI::~GUI() +{ +} diff --git a/TrooperEngineTest/GUI.hpp b/TrooperEngineTest/GUI.hpp new file mode 100644 index 0000000..8c31dd0 --- /dev/null +++ b/TrooperEngineTest/GUI.hpp @@ -0,0 +1,14 @@ +#ifndef __GUI__ +#define __GUI__ + +#include "dllExport.h" + +class GUI { +public: + GUI(); + ~GUI(); + +private: +}; + +#endif /// __GUI__ \ No newline at end of file diff --git a/TrooperEngineTest/GUIEngineTest/GUIXMLTest.cpp b/TrooperEngineTest/GUIEngineTest/GUIXMLTest.cpp index 069a1a0..a135578 100644 --- a/TrooperEngineTest/GUIEngineTest/GUIXMLTest.cpp +++ b/TrooperEngineTest/GUIEngineTest/GUIXMLTest.cpp @@ -26,44 +26,44 @@ void GUIXMLTest() // } // align = leftRight; // } - - GUIXMLSizerTest(); + GUIXMLDefaultTest(); + //GUIXMLSizerTest(); } void GUIXMLDefaultTest() { UTest u("GUI XML Default"); - LoadFile("GUIXMLDefaultTest.xml"); + LoadFile("GUIXMLDefaultTest.xml", true); - std::vector objects = GUIEngine::cGUI::Inst().GetObjects(); - - GUIEngine::cPanel* panel = (GUIEngine::cPanel*)objects[0]; - - Settings sets; - sets.pos = { 0, 0 }; - sets.size = { 200, 200 }; - sets.pad = { 0, 0, 0, 0 }; - sets.center = { 100, 100 }; - - cWindowTest("Panel", u, panel, sets); - - GUIEngine::cLayout* layout = (GUIEngine::cLayout*)panel->getChildren()[0]; - - sets.pos = { 5, 5 }; - sets.size = { 190, 190 }; - sets.pad = { 5, 5, 5, 5 }; - - - cWindowTest("Layout", u, layout, sets); - - GUIEngine::cLabel* label = (GUIEngine::cLabel*)layout->getChildren()[0]; - - - sets.pos = { 56, 96 }; - sets.size = { 88, 8 }; - - cWindowTest("Label", u, label, sets); +// std::vector objects = GUIEngine::cGUI::Inst().GetObjects(); +// +// GUIEngine::cPanel* panel = (GUIEngine::cPanel*)objects[0]; +// +// Settings sets; +// sets.pos = { 0, 0 }; +// sets.size = { 200, 200 }; +// sets.pad = { 0, 0, 0, 0 }; +// sets.center = { 100, 100 }; +// +// cWindowTest("Panel", u, panel, sets); +// +// GUIEngine::cLayout* layout = (GUIEngine::cLayout*)panel->getChildren()[0]; +// +// sets.pos = { 5, 5 }; +// sets.size = { 190, 190 }; +// sets.pad = { 5, 5, 5, 5 }; +// +// +// cWindowTest("Layout", u, layout, sets); +// +// GUIEngine::cLabel* label = (GUIEngine::cLabel*)layout->getChildren()[0]; +// +// +// sets.pos = { 56, 96 }; +// sets.size = { 88, 8 }; +// +// cWindowTest("Label", u, label, sets); u.report(); diff --git a/TrooperEngineTest/TrooperEngineTest.vcxproj b/TrooperEngineTest/TrooperEngineTest.vcxproj index e748ada..4c64b0d 100644 --- a/TrooperEngineTest/TrooperEngineTest.vcxproj +++ b/TrooperEngineTest/TrooperEngineTest.vcxproj @@ -146,6 +146,7 @@ + @@ -160,6 +161,7 @@ + diff --git a/TrooperEngineTest/TrooperEngineTest.vcxproj.filters b/TrooperEngineTest/TrooperEngineTest.vcxproj.filters index 4f1db0a..8833730 100644 --- a/TrooperEngineTest/TrooperEngineTest.vcxproj.filters +++ b/TrooperEngineTest/TrooperEngineTest.vcxproj.filters @@ -57,6 +57,7 @@ MathEngineTest + @@ -93,6 +94,7 @@ MathEngineTest + diff --git a/TrooperEngineTest/UTest/UTest.hpp b/TrooperEngineTest/UTest/UTest.hpp index eeea2d7..2032fdc 100644 --- a/TrooperEngineTest/UTest/UTest.hpp +++ b/TrooperEngineTest/UTest/UTest.hpp @@ -5,8 +5,8 @@ class UTest { private: - UTest( UTest & ); // no copy constructor - UTest operator = ( UTest & ); // no assignment operator + UTest( UTest & ); /// no copy constructor + UTest operator = ( UTest & ); /// no assignment operator UTest(){} public: static const char* version() { return __UTest_VERSION; } @@ -27,8 +27,8 @@ private: static const char* sp_pstr; /*= "pass";*/ static const char* sp_fstr; /*= "fail";*/ - static unsigned long int s_pass; //= 0 - static unsigned long int s_fail; //= 0 + static unsigned long int s_pass; ///= 0 + static unsigned long int s_fail; ///= 0 }; -#endif // __UTEST__ +#endif /// __UTEST__ diff --git a/TrooperEngineTest/main.cpp b/TrooperEngineTest/main.cpp index e46ee38..627f98c 100644 --- a/TrooperEngineTest/main.cpp +++ b/TrooperEngineTest/main.cpp @@ -55,7 +55,8 @@ int main(int argc, char *argv[]) MathEngineTest(); - //GUIXMLTest(); + GUIXMLTest(); + SDL_Rect rec = { 0, 0, 100, 20 }; //ImageTest(); diff --git a/TrooperEngineTest/xml/GUIXMLAlignTest.xml b/TrooperEngineTest/xml/GUIXMLAlignTest.xml index e9e14b2..248928a 100644 --- a/TrooperEngineTest/xml/GUIXMLAlignTest.xml +++ b/TrooperEngineTest/xml/GUIXMLAlignTest.xml @@ -1,6 +1,6 @@ - + diff --git a/TrooperEngineTest/xml/GUIXMLDefaultTest.xml b/TrooperEngineTest/xml/GUIXMLDefaultTest.xml index cc9a6bd..6d88af1 100644 --- a/TrooperEngineTest/xml/GUIXMLDefaultTest.xml +++ b/TrooperEngineTest/xml/GUIXMLDefaultTest.xml @@ -1,8 +1,8 @@ - + - +