Fixed positioning on game images with the new 50/50 split.

Game images and descriptions are no longer displayed while scrolling - this should provide a better framerate for nicer scrolling.
This commit is contained in:
Aloshi 2012-08-16 10:23:23 -05:00
parent 7b1c4374ae
commit 67e657391a
4 changed files with 25 additions and 8 deletions

View file

@ -13,6 +13,7 @@
const float GuiGameList::sInfoWidth = 0.5;
GuiGameList::GuiGameList(bool useDetail)
{
std::cout << "Creating GuiGameList\n";
@ -25,7 +26,7 @@ GuiGameList::GuiGameList(bool useDetail)
{
mList = new GuiList<FileData*>(Renderer::getScreenWidth() * sInfoWidth, Renderer::getFontHeight(Renderer::LARGE) + 2);
mScreenshot = new GuiImage(Renderer::getScreenWidth() * 0.2, Renderer::getFontHeight(Renderer::LARGE) + 2, "", Renderer::getScreenWidth() * 0.3);
mScreenshot = new GuiImage(Renderer::getScreenWidth() * sInfoWidth * 0.5, Renderer::getFontHeight(Renderer::LARGE) + 2, "", Renderer::getScreenWidth() * sInfoWidth * 0.7);
mScreenshot->setOrigin(0.5, 0.0);
mScreenshot->setAlpha(true); //slower, but requested
addChild(mScreenshot);
@ -110,8 +111,8 @@ void GuiGameList::onRender()
if(!mTheme->getDividersHidden())
Renderer::drawRect(Renderer::getScreenWidth() * sInfoWidth - 4, Renderer::getFontHeight(Renderer::LARGE) + 2, 8, Renderer::getScreenHeight(), 0x0000FF);
//if we have selected a non-folder
if(mList->getSelectedObject() && !mList->getSelectedObject()->isFolder())
//if we're not scrolling and we have selected a non-folder
if(!mList->isScrolling() && mList->getSelectedObject() && !mList->getSelectedObject()->isFolder())
{
GameData* game = (GameData*)mList->getSelectedObject();
@ -166,9 +167,12 @@ void GuiGameList::onInput(InputManager::InputButton button, bool keyDown)
if(mDetailed)
{
if(!keyDown && (button == InputManager::UP || button == InputManager::DOWN))
if(button == InputManager::UP || button == InputManager::DOWN)
{
updateDetailData();
if(!keyDown)
updateDetailData();
else
mScreenshot->setImage(""); //clear the image when we start scrolling
}
}
}

View file

@ -184,6 +184,12 @@ int GuiList<listType>::getSelection()
return mSelection;
}
template <typename listType>
bool GuiList<listType>::isScrolling()
{
return mScrolling;
}
template <typename listType>
void GuiList<listType>::onPause()
{

View file

@ -8,7 +8,7 @@
#include <string>
#define SCROLLDELAY 507
#define SCROLLTIME (57*6)
#define SCROLLTIME (57*5)
//this should really be a template
template <typename listType>
@ -31,6 +31,7 @@ public:
std::string getSelectedName();
listType getSelectedObject();
int getSelection();
bool isScrolling();
void setSelectorColor(int selectorColor);
void setCentered(bool centered);

View file

@ -9,7 +9,10 @@
bool PARSEGAMELISTONLY = false;
bool IGNOREGAMELIST = false;
float FRAMERATE = 0;
#ifdef DRAWFRAMERATE
float FRAMERATE = 0;
#endif
namespace fs = boost::filesystem;
@ -177,7 +180,10 @@ int main(int argc, char* argv[])
int deltaTime = curTime - lastTime;
lastTime = curTime;
FRAMERATE = 1/((float)deltaTime)*1000;
#ifdef DRAWFRAMERATE
FRAMERATE = 1/((float)deltaTime)*1000;
#endif
GuiComponent::processTicks(deltaTime);
Renderer::render();