From 85f3ebf1525b10820293156b05e95099794961b3 Mon Sep 17 00:00:00 2001 From: Aloshi Date: Fri, 21 Jun 2013 16:54:41 -0500 Subject: [PATCH 1/2] Fixed GuiGameList crashing on non-detailed view. --- src/components/GuiGameList.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/components/GuiGameList.cpp b/src/components/GuiGameList.cpp index 6d6986017..a65c94668 100644 --- a/src/components/GuiGameList.cpp +++ b/src/components/GuiGameList.cpp @@ -26,17 +26,15 @@ GuiGameList::GuiGameList(Window* window, bool useDetail) : GuiComponent(window), { mList = new TextListComponent(mWindow, (int)(Renderer::getScreenWidth() * mTheme->getFloat("listOffsetX")), Renderer::getDefaultFont(Renderer::LARGE)->getHeight() + 2, Renderer::getDefaultFont(Renderer::MEDIUM)); - mScreenshot = new ImageComponent(mWindow, getImagePos().x, getImagePos().y, "", (unsigned int)mTheme->getFloat("gameImageWidth"), (unsigned int)mTheme->getFloat("gameImageHeight"), false); - mScreenshot->setOrigin(mTheme->getFloat("gameImageOriginX"), mTheme->getFloat("gameImageOriginY")); - mImageAnimation = new AnimationComponent(); mImageAnimation->addChild(mScreenshot); }else{ mList = new TextListComponent(mWindow, 0, Renderer::getDefaultFont(Renderer::LARGE)->getHeight() + 2, Renderer::getDefaultFont(Renderer::MEDIUM)); - mScreenshot = NULL; - mImageAnimation = NULL; } + mScreenshot = new ImageComponent(mWindow, getImagePos().x, getImagePos().y, "", (unsigned int)mTheme->getFloat("gameImageWidth"), (unsigned int)mTheme->getFloat("gameImageHeight"), false); + mScreenshot->setOrigin(mTheme->getFloat("gameImageOriginX"), mTheme->getFloat("gameImageOriginY")); + mDescription.setOffset(Vector2i((int)(Renderer::getScreenWidth() * 0.03), mScreenshot->getOffset().y + mScreenshot->getSize().y + 12)); mDescription.setExtent(Vector2u((int)(Renderer::getScreenWidth() * (mTheme->getFloat("listOffsetX") - 0.03)), 0)); From 6f9ea15696ba5aa510a6c5751e8edd04770cdc0d Mon Sep 17 00:00:00 2001 From: Aloshi Date: Wed, 26 Jun 2013 20:32:51 -0500 Subject: [PATCH 2/2] Fixed GuiGameList screenshot crash. For real, this time, probably. --- src/components/GuiGameList.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/GuiGameList.cpp b/src/components/GuiGameList.cpp index a65c94668..c91d48ade 100644 --- a/src/components/GuiGameList.cpp +++ b/src/components/GuiGameList.cpp @@ -19,6 +19,8 @@ GuiGameList::GuiGameList(Window* window, bool useDetail) : GuiComponent(window), mTheme = new ThemeComponent(mWindow, mDetailed); + mScreenshot = new ImageComponent(mWindow, getImagePos().x, getImagePos().y, "", (unsigned int)mTheme->getFloat("gameImageWidth"), (unsigned int)mTheme->getFloat("gameImageHeight"), false); + //The GuiGameList can use the older, simple game list if so desired. //The old view only shows a list in the center of the screen; the new view can display an image and description. //Those with smaller displays may prefer the older view. @@ -32,7 +34,6 @@ GuiGameList::GuiGameList(Window* window, bool useDetail) : GuiComponent(window), mList = new TextListComponent(mWindow, 0, Renderer::getDefaultFont(Renderer::LARGE)->getHeight() + 2, Renderer::getDefaultFont(Renderer::MEDIUM)); } - mScreenshot = new ImageComponent(mWindow, getImagePos().x, getImagePos().y, "", (unsigned int)mTheme->getFloat("gameImageWidth"), (unsigned int)mTheme->getFloat("gameImageHeight"), false); mScreenshot->setOrigin(mTheme->getFloat("gameImageOriginX"), mTheme->getFloat("gameImageOriginY")); mDescription.setOffset(Vector2i((int)(Renderer::getScreenWidth() * 0.03), mScreenshot->getOffset().y + mScreenshot->getSize().y + 12)); @@ -56,11 +57,11 @@ GuiGameList::~GuiGameList() //undo the parenting hack because otherwise it's not really a child and will try to remove itself on delete mList->setParent(NULL); delete mList; + delete mScreenshot; if(mDetailed) { delete mImageAnimation; - delete mScreenshot; } delete mTheme;