2012-07-20 01:08:29 +00:00
|
|
|
#include "GuiList.h"
|
2012-07-20 16:14:09 +00:00
|
|
|
#include <SDL/SDL.h>
|
2012-07-20 01:08:29 +00:00
|
|
|
|
|
|
|
GuiList::GuiList()
|
|
|
|
{
|
|
|
|
mSelection = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void GuiList::onRender()
|
|
|
|
{
|
2012-07-20 16:14:09 +00:00
|
|
|
int y = 40;
|
|
|
|
SDL_Color color = {0, 0, 255};
|
|
|
|
for(unsigned int i = 0; i < mNameVector.size(); i++)
|
|
|
|
{
|
|
|
|
Renderer::drawCenteredText(mNameVector.at(i), y, color);
|
|
|
|
y += 35;
|
|
|
|
}
|
2012-07-20 01:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void GuiList::addObject(std::string name, void* obj)
|
|
|
|
{
|
|
|
|
mNameVector.push_back(name);
|
|
|
|
mPointerVector.push_back(obj);
|
|
|
|
}
|
|
|
|
|
2012-07-20 16:14:09 +00:00
|
|
|
void GuiList::clear()
|
2012-07-20 01:08:29 +00:00
|
|
|
{
|
|
|
|
mNameVector.clear();
|
|
|
|
mPointerVector.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string GuiList::getSelectedName()
|
|
|
|
{
|
|
|
|
return mNameVector.at(mSelection);
|
|
|
|
}
|
|
|
|
|
|
|
|
void* GuiList::getSelectedObject()
|
|
|
|
{
|
|
|
|
return mPointerVector.at(mSelection);
|
|
|
|
}
|