BoxSizer to Sizer
This commit is contained in:
@@ -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_
|
||||||
@@ -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);
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
@@ -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,13 +55,14 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ namespace GUIEngine {
|
|||||||
MouseButton3,
|
MouseButton3,
|
||||||
Keyboard
|
Keyboard
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Functions
|
/// Functions
|
||||||
static cGUI& Inst();
|
static cGUI& Inst();
|
||||||
static void Delete();
|
static void Delete();
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ void cLabel::Create(cWindow* parent, const signed int id, const cString& label /
|
|||||||
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,8 +54,6 @@ namespace GUIEngine {
|
|||||||
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
|
||||||
|
|||||||
+10
-10
@@ -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;
|
||||||
}
|
}
|
||||||
+8
-8
@@ -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_
|
||||||
@@ -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 );
|
||||||
|
|
||||||
|
|||||||
@@ -21,14 +21,10 @@ namespace MathEngine {
|
|||||||
|
|
||||||
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
|
||||||
}/// END NAMESPACE DEFINITION MathEngine
|
}/// END NAMESPACE DEFINITION MathEngine
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|
||||||
|
|||||||
@@ -28,9 +28,6 @@ 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 SDL_Rect& other );
|
|
||||||
|
|
||||||
int x;
|
int x;
|
||||||
int y;
|
int y;
|
||||||
};/// END STRUCT DEFINITION iVector2
|
};/// END STRUCT DEFINITION iVector2
|
||||||
|
|||||||
@@ -7,6 +7,15 @@ using VideoEngine::cSprite;
|
|||||||
using MathEngine::iVector2;
|
using MathEngine::iVector2;
|
||||||
using MathEngine::iVector4;
|
using MathEngine::iVector4;
|
||||||
|
|
||||||
|
cSprite::cSprite( VideoEngine::cImage** image, VideoEngine::cCamera** camera /*= nullptr*/ )
|
||||||
|
: mpp_image(image), mpp_camera(camera)
|
||||||
|
{
|
||||||
|
setPosition(0, 0);
|
||||||
|
|
||||||
|
setStartImageArea(0, 0);
|
||||||
|
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*/,
|
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*/,
|
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*/ )
|
||||||
@@ -18,15 +27,6 @@ cSprite::cSprite( const signed long int xpos /*= 0*/, const signed long int ypos
|
|||||||
setEndImageArea(Uint16(warea), Uint16(harea));
|
setEndImageArea(Uint16(warea), Uint16(harea));
|
||||||
}
|
}
|
||||||
|
|
||||||
cSprite::cSprite( VideoEngine::cImage** image, VideoEngine::cCamera** camera /*= nullptr*/ )
|
|
||||||
: mpp_image(image), mpp_camera(camera)
|
|
||||||
{
|
|
||||||
setPosition(0, 0);
|
|
||||||
|
|
||||||
setStartImageArea(0, 0);
|
|
||||||
setEndImageArea(Uint16((*mpp_image)->getWidth()), Uint16((*mpp_image)->getHeight()));
|
|
||||||
}
|
|
||||||
|
|
||||||
cSprite::cSprite( const cSprite& copy )
|
cSprite::cSprite( const cSprite& copy )
|
||||||
{
|
{
|
||||||
Copy(copy);
|
Copy(copy);
|
||||||
@@ -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"
|
||||||
@@ -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 );
|
||||||
|
|
||||||
|
|||||||
@@ -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 );
|
||||||
|
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -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>
|
|
||||||
@@ -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>
|
||||||
|
|||||||
@@ -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>
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<Boxsizer />
|
<Sizer />
|
||||||
<Label text="Box Sizer" />
|
<Label>Sizer</Label>
|
||||||
Reference in New Issue
Block a user