2012-07-20 01:08:29 +00:00
|
|
|
#include "GuiGameList.h"
|
2012-07-20 16:14:09 +00:00
|
|
|
#include <iostream>
|
2012-07-20 01:08:29 +00:00
|
|
|
|
2012-07-20 16:14:09 +00:00
|
|
|
GuiGameList::GuiGameList(SystemData* system)
|
2012-07-20 01:08:29 +00:00
|
|
|
{
|
2012-07-20 16:14:09 +00:00
|
|
|
mSystem = system;
|
2012-07-20 01:08:29 +00:00
|
|
|
|
|
|
|
mList = new GuiList();
|
2012-07-20 16:14:09 +00:00
|
|
|
updateList();
|
2012-07-20 01:08:29 +00:00
|
|
|
|
|
|
|
addChild(mList);
|
2012-07-20 16:14:09 +00:00
|
|
|
|
|
|
|
Renderer::registerComponent(this);
|
2012-07-20 01:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void GuiGameList::onRender()
|
|
|
|
{
|
2012-07-20 16:14:09 +00:00
|
|
|
Renderer::drawRect(0, 0, 640, 480, 0xFFFFFF);
|
|
|
|
|
|
|
|
SDL_Color color = {0, 155, 100};
|
|
|
|
Renderer::drawCenteredText(mSystem->getName(), 2, color);
|
|
|
|
}
|
|
|
|
|
|
|
|
void GuiGameList::updateList()
|
|
|
|
{
|
|
|
|
mList->clear();
|
|
|
|
|
|
|
|
for(unsigned int i = 0; i < mSystem->getGameCount(); i++)
|
|
|
|
{
|
|
|
|
GameData* game = mSystem->getGame(i);
|
|
|
|
mList->addObject(game->getName(), game);
|
|
|
|
}
|
2012-07-20 01:08:29 +00:00
|
|
|
}
|