2012-07-19 01:14:17 +00:00
|
|
|
#include "GuiComponent.h"
|
|
|
|
#include "Renderer.h"
|
2012-07-19 16:13:27 +00:00
|
|
|
#include <iostream>
|
2012-07-19 01:14:17 +00:00
|
|
|
|
2012-07-19 16:13:27 +00:00
|
|
|
void GuiComponent::addChild(GuiComponent* comp)
|
2012-07-19 01:14:17 +00:00
|
|
|
{
|
2012-07-19 16:13:27 +00:00
|
|
|
mChildren.push_back(comp);
|
2012-07-19 01:14:17 +00:00
|
|
|
}
|
|
|
|
|
2012-07-19 16:13:27 +00:00
|
|
|
void GuiComponent::removeChild(GuiComponent* comp)
|
2012-07-19 01:14:17 +00:00
|
|
|
{
|
2012-07-19 16:13:27 +00:00
|
|
|
for(unsigned int i = 0; i < mChildren.size(); i++)
|
|
|
|
{
|
|
|
|
if(mChildren.at(i) == comp)
|
|
|
|
{
|
|
|
|
mChildren.erase(mChildren.begin() + i);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
std::cerr << "Error - tried to remove GuiComponent child, but couldn't find it!\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
void GuiComponent::render()
|
|
|
|
{
|
|
|
|
onRender();
|
|
|
|
|
|
|
|
for(unsigned int i = 0; i < mChildren.size(); i++)
|
|
|
|
{
|
|
|
|
mChildren.at(i)->render();
|
|
|
|
}
|
2012-07-19 01:14:17 +00:00
|
|
|
}
|