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-21 21:02:37 +00:00
|
|
|
unsigned int Renderer::getScreenWidth() { return 1024; }
|
|
|
|
unsigned int Renderer::getScreenHeight() { return 768; }
|
2012-07-20 01:08:29 +00:00
|
|
|
|
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()
|
|
|
|
{
|
|
|
|
for(unsigned int layer = 0; layer < LAYER_COUNT; layer++)
|
|
|
|
{
|
|
|
|
unsigned int layerBit = BIT(layer);
|
|
|
|
for(unsigned int i = 0; i < renderVector.size(); i++)
|
|
|
|
{
|
|
|
|
if(renderVector.at(i)->getLayer() & layerBit)
|
|
|
|
renderVector.at(i)->render();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-07-19 16:13:27 +00:00
|
|
|
|