2012-07-19 01:14:17 +00:00
|
|
|
#include "Renderer.h"
|
2012-07-19 16:13:27 +00:00
|
|
|
#include "GuiComponent.h"
|
2012-07-19 01:14:17 +00:00
|
|
|
|
2012-07-19 03:18:50 +00:00
|
|
|
std::vector<GuiComponent*> renderVector;
|
|
|
|
|
2012-07-19 01:14:17 +00:00
|
|
|
void Renderer::registerComponent(GuiComponent* comp)
|
|
|
|
{
|
|
|
|
renderVector.push_back(comp);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Renderer::unregisterComponent(GuiComponent* comp)
|
|
|
|
{
|
|
|
|
for(unsigned int i = 0; i < renderVector.size(); i++)
|
|
|
|
{
|
|
|
|
if(renderVector.at(i) == comp)
|
|
|
|
{
|
|
|
|
renderVector.erase(renderVector.begin() + i);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-22 21:15:55 +00:00
|
|
|
void Renderer::deleteAll()
|
|
|
|
{
|
|
|
|
for(unsigned int i = 0; i < renderVector.size(); i++)
|
|
|
|
{
|
|
|
|
delete renderVector.at(i);
|
|
|
|
}
|
|
|
|
renderVector.clear();
|
|
|
|
}
|
|
|
|
|
2012-07-19 01:14:17 +00:00
|
|
|
void Renderer::render()
|
|
|
|
{
|
2012-08-02 01:43:55 +00:00
|
|
|
for(unsigned int i = 0; i < renderVector.size(); i++)
|
2012-07-19 01:14:17 +00:00
|
|
|
{
|
2012-08-02 01:43:55 +00:00
|
|
|
renderVector.at(i)->render();
|
2012-07-19 01:14:17 +00:00
|
|
|
}
|
|
|
|
}
|
2012-09-04 16:45:16 +00:00
|
|
|
|
|
|
|
void Renderer::onInit()
|
|
|
|
{
|
|
|
|
for(unsigned int i = 0; i < renderVector.size(); i++)
|
|
|
|
{
|
|
|
|
renderVector.at(i)->init();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Renderer::onDeinit()
|
|
|
|
{
|
|
|
|
for(unsigned int i = 0; i < renderVector.size(); i++)
|
|
|
|
{
|
|
|
|
renderVector.at(i)->deinit();
|
|
|
|
}
|
|
|
|
}
|