cButton Texture Generate

This commit is contained in:
2018-08-30 09:16:39 -04:00
parent 30416b0334
commit 335166ea00
24 changed files with 163 additions and 174 deletions
@@ -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;
@@ -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();
@@ -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;