ES-DE/src/Renderer.cpp
Aloshi b3fb58ebdb An input configuration GUI was added, which allows a user to map an SDL Joystick's buttons to InputManager buttons.
This config file is saved/loaded from ./input.cfg.
Coming soon - axis support!
2012-07-22 16:15:55 -05:00

48 lines
940 B
C++

#include "Renderer.h"
#include "GuiComponent.h"
std::vector<GuiComponent*> renderVector;
unsigned int Renderer::getScreenWidth() { return 1024; }
unsigned int Renderer::getScreenHeight() { return 768; }
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;
}
}
}
void Renderer::deleteAll()
{
for(unsigned int i = 0; i < renderVector.size(); i++)
{
delete renderVector.at(i);
}
renderVector.clear();
}
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();
}
}
}