#include "ControlSuper.h"
#include "TouchControls.h"

using namespace touchcontrols;

ControlSuper::ControlSuper(std::string t,RectF pos)
{
	controlPos = pos;
	controlPos.left /= ScaleX;
	controlPos.right /= ScaleX;
	controlPos.top /= ScaleY;
	controlPos.bottom /= ScaleY;

	tag = t;
	enabled = true;
}

void ControlSuper::saveXML(TiXmlElement &root)
{
	root.SetAttribute("enabled",enabled);
	root.SetDoubleAttribute("left",controlPos.left);
	root.SetDoubleAttribute("right",controlPos.right);
	root.SetDoubleAttribute("top",controlPos.top);
	root.SetDoubleAttribute("bottom",controlPos.bottom);

}


void ControlSuper::loadXML(TiXmlElement &root)
{
	root.QueryBoolAttribute("enabled",&enabled);
	root.QueryFloatAttribute("left",  &controlPos.left);
	root.QueryFloatAttribute("right", &controlPos.right);
	root.QueryFloatAttribute("top",   &controlPos.top);
	root.QueryFloatAttribute("bottom",&controlPos.bottom);

}
