mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2026-01-28 10:44:49 +01:00
Added selectedOffset tag to support preloading and rendering of items not selected
This commit is contained in:
parent
a5ef2bdcbc
commit
6ff4acbd30
@ -19,10 +19,10 @@
|
||||
#include "../../Utility/Log.h"
|
||||
#include "../../SDL.h"
|
||||
|
||||
Component::Component()
|
||||
Component::Component(Page &p)
|
||||
: page(p)
|
||||
{
|
||||
tweens_ = NULL;
|
||||
selectedItem_ = NULL;
|
||||
newItemSelectedSinceEnter = false;
|
||||
backgroundTexture_ = NULL;
|
||||
freeGraphicsMemory();
|
||||
@ -30,9 +30,9 @@ Component::Component()
|
||||
}
|
||||
|
||||
Component::Component(const Component ©)
|
||||
: page(copy.page)
|
||||
{
|
||||
tweens_ = NULL;
|
||||
selectedItem_ = NULL;
|
||||
newItemSelectedSinceEnter = false;
|
||||
backgroundTexture_ = NULL;
|
||||
freeGraphicsMemory();
|
||||
@ -98,11 +98,6 @@ void Component::allocateGraphicsMemory()
|
||||
}
|
||||
}
|
||||
|
||||
Item *Component::getSelectedItem()
|
||||
{
|
||||
return selectedItem_;
|
||||
}
|
||||
|
||||
void Component::triggerEnterEvent()
|
||||
{
|
||||
enterRequested = true;
|
||||
@ -132,10 +127,9 @@ void Component::triggerMenuExitEvent(int menuIndex)
|
||||
menuExitRequested = true;
|
||||
menuExitIndex = menuIndex;
|
||||
}
|
||||
void Component::triggerHighlightEvent(Item *selectedItem)
|
||||
void Component::triggerHighlightEvent()
|
||||
{
|
||||
newItemSelected = true;
|
||||
this->selectedItem_ = selectedItem;
|
||||
}
|
||||
|
||||
void Component::triggerPlaylistChangeEvent(std::string name)
|
||||
|
||||
@ -19,15 +19,15 @@
|
||||
|
||||
#include "../../SDL.h"
|
||||
#include "../MenuNotifierInterface.h"
|
||||
#include "../Page.h"
|
||||
#include "../ViewInfo.h"
|
||||
#include "../Animate/Tween.h"
|
||||
#include "../Animate/AnimationEvents.h"
|
||||
#include "../../Collection/Item.h"
|
||||
|
||||
class Component
|
||||
{
|
||||
public:
|
||||
Component();
|
||||
Component(Page &p);
|
||||
Component(const Component ©);
|
||||
virtual ~Component();
|
||||
virtual void freeGraphicsMemory();
|
||||
@ -39,7 +39,7 @@ public:
|
||||
void triggerMenuEnterEvent(int menuIndex = -1);
|
||||
void triggerMenuExitEvent(int menuIndex = -1);
|
||||
void triggerMenuScrollEvent();
|
||||
void triggerHighlightEvent(Item *selectedItem);
|
||||
void triggerHighlightEvent();
|
||||
void triggerPlaylistChangeEvent(std::string name);
|
||||
bool isIdle();
|
||||
bool isHidden();
|
||||
@ -55,7 +55,8 @@ public:
|
||||
bool scrollActive;
|
||||
|
||||
protected:
|
||||
Item *getSelectedItem();
|
||||
Page &page;
|
||||
|
||||
enum AnimationState
|
||||
{
|
||||
IDLE,
|
||||
@ -90,7 +91,6 @@ private:
|
||||
|
||||
AnimationEvents *tweens_;
|
||||
Animation *currentTweens_;
|
||||
Item *selectedItem_;
|
||||
SDL_Texture *backgroundTexture_;
|
||||
|
||||
unsigned int currentTweenIndex_;
|
||||
|
||||
@ -18,7 +18,8 @@
|
||||
#include "../ViewInfo.h"
|
||||
#include "../../SDL.h"
|
||||
|
||||
Container::Container()
|
||||
Container::Container(Page &p)
|
||||
: Component(p)
|
||||
{
|
||||
allocateGraphicsMemory();
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
class Container : public Component
|
||||
{
|
||||
public:
|
||||
Container();
|
||||
Container(Page &p);
|
||||
virtual ~Container();
|
||||
void freeGraphicsMemory();
|
||||
void allocateGraphicsMemory();
|
||||
|
||||
@ -19,8 +19,9 @@
|
||||
#include "../../Utility/Log.h"
|
||||
#include <SDL2/SDL_image.h>
|
||||
|
||||
Image::Image(std::string file, float scaleX, float scaleY)
|
||||
: texture_(NULL)
|
||||
Image::Image(std::string file, Page &p, float scaleX, float scaleY)
|
||||
: Component(p)
|
||||
, texture_(NULL)
|
||||
, file_(file)
|
||||
, scaleX_(scaleX)
|
||||
, scaleY_(scaleY)
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
class Image : public Component
|
||||
{
|
||||
public:
|
||||
Image(std::string file, float scaleX, float scaleY);
|
||||
Image(std::string file, Page &p, float scaleX, float scaleY);
|
||||
virtual ~Image();
|
||||
void freeGraphicsMemory();
|
||||
void allocateGraphicsMemory();
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
#include "../../Utility/Log.h"
|
||||
#include <fstream>
|
||||
|
||||
Image * ImageBuilder::CreateImage(std::string path, std::string name, float scaleX, float scaleY)
|
||||
Image * ImageBuilder::CreateImage(std::string path, Page &p, std::string name, float scaleX, float scaleY)
|
||||
{
|
||||
Image *image = NULL;
|
||||
std::vector<std::string> extensions;
|
||||
@ -35,7 +35,7 @@ Image * ImageBuilder::CreateImage(std::string path, std::string name, float scal
|
||||
|
||||
if(Utils::findMatchingFile(prefix, extensions, file))
|
||||
{
|
||||
image = new Image(file, scaleX, scaleY);
|
||||
image = new Image(file, p, scaleX, scaleY);
|
||||
}
|
||||
|
||||
return image;
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../Page.h"
|
||||
#include "Image.h"
|
||||
#include "VideoComponent.h"
|
||||
#include "../../Video/VideoFactory.h"
|
||||
@ -23,5 +24,5 @@
|
||||
class ImageBuilder
|
||||
{
|
||||
public:
|
||||
Image * CreateImage(std::string path, std::string name, float scaleX, float scaleY);
|
||||
Image * CreateImage(std::string path, Page &p, std::string name, float scaleX, float scaleY);
|
||||
};
|
||||
|
||||
@ -28,8 +28,9 @@
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
|
||||
ReloadableMedia::ReloadableMedia(Configuration &config, bool systemMode, std::string type, bool isVideo, Font *font, float scaleX, float scaleY)
|
||||
: config_(config)
|
||||
ReloadableMedia::ReloadableMedia(Configuration &config, bool systemMode, std::string type, Page &p, int displayOffset, bool isVideo, Font *font, float scaleX, float scaleY)
|
||||
: Component(p)
|
||||
, config_(config)
|
||||
, systemMode_(systemMode)
|
||||
, loadedComponent_(NULL)
|
||||
, reloadRequested_(false)
|
||||
@ -41,6 +42,8 @@ ReloadableMedia::ReloadableMedia(Configuration &config, bool systemMode, std::st
|
||||
, type_(type)
|
||||
, scaleX_(scaleX)
|
||||
, scaleY_(scaleY)
|
||||
, displayOffset_(displayOffset)
|
||||
|
||||
{
|
||||
allocateGraphicsMemory();
|
||||
}
|
||||
@ -145,7 +148,7 @@ void ReloadableMedia::reloadTexture()
|
||||
loadedComponent_ = NULL;
|
||||
}
|
||||
|
||||
Item *selectedItem = getSelectedItem();
|
||||
Item *selectedItem = page.getSelectedItem(displayOffset_);
|
||||
if(!selectedItem) return;
|
||||
|
||||
config_.getProperty("currentCollection", currentCollection_);
|
||||
@ -324,7 +327,7 @@ void ReloadableMedia::reloadTexture()
|
||||
// if image and artwork was not specified, fall back to displaying text
|
||||
if(!loadedComponent_ && textFallback_)
|
||||
{
|
||||
loadedComponent_ = new Text(selectedItem->fullTitle, FfntInst_, scaleX_, scaleY_);
|
||||
loadedComponent_ = new Text(selectedItem->fullTitle, page, FfntInst_, scaleX_, scaleY_);
|
||||
baseViewInfo.ImageWidth = loadedComponent_->baseViewInfo.ImageWidth;
|
||||
baseViewInfo.ImageHeight = loadedComponent_->baseViewInfo.ImageHeight;
|
||||
}
|
||||
@ -343,11 +346,11 @@ Component *ReloadableMedia::findComponent(std::string collection, std::string ty
|
||||
|
||||
if(type == "video")
|
||||
{
|
||||
component = videoBuild.createVideo(imagePath, basename, scaleX_, scaleY_);
|
||||
component = videoBuild.createVideo(imagePath, page, basename, scaleX_, scaleY_);
|
||||
}
|
||||
else
|
||||
{
|
||||
component = imageBuild.CreateImage(imagePath, basename, scaleX_, scaleY_);
|
||||
component = imageBuild.CreateImage(imagePath, page, basename, scaleX_, scaleY_);
|
||||
}
|
||||
|
||||
return component;
|
||||
|
||||
@ -27,7 +27,7 @@ class Image;
|
||||
class ReloadableMedia : public Component
|
||||
{
|
||||
public:
|
||||
ReloadableMedia(Configuration &config, bool systemMode, std::string type, bool isVideo, Font *font, float scaleX, float scaleY);
|
||||
ReloadableMedia(Configuration &config, bool systemMode, std::string type, Page &page, int displayOffset, bool isVideo, Font *font, float scaleX, float scaleY);
|
||||
virtual ~ReloadableMedia();
|
||||
void update(float dt);
|
||||
void draw();
|
||||
@ -54,4 +54,6 @@ private:
|
||||
float scaleX_;
|
||||
float scaleY_;
|
||||
std::string currentCollection_;
|
||||
Page *page_;
|
||||
int displayOffset_;
|
||||
};
|
||||
|
||||
@ -23,9 +23,9 @@
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
|
||||
ReloadableText::ReloadableText(std::string type, Page *page, Font *font, std::string layoutKey, float scaleX, float scaleY)
|
||||
: imageInst_(NULL)
|
||||
, page_(page)
|
||||
ReloadableText::ReloadableText(std::string type, Page &page, Font *font, std::string layoutKey, float scaleX, float scaleY)
|
||||
: Component(page)
|
||||
, imageInst_(NULL)
|
||||
, layoutKey_(layoutKey)
|
||||
, reloadRequested_(false)
|
||||
, firstLoad_(true)
|
||||
@ -145,7 +145,7 @@ void ReloadableText::ReloadTexture()
|
||||
imageInst_ = NULL;
|
||||
}
|
||||
|
||||
Item *selectedItem = getSelectedItem();
|
||||
Item *selectedItem = page.getSelectedItem();
|
||||
|
||||
if (selectedItem != NULL)
|
||||
{
|
||||
@ -175,26 +175,20 @@ void ReloadableText::ReloadTexture()
|
||||
ss << playlistName;
|
||||
break;
|
||||
case TextTypeCollectionName:
|
||||
if (page_ != NULL) {
|
||||
ss << page_->getCollectionName();
|
||||
}
|
||||
ss << page.getCollectionName();
|
||||
break;
|
||||
case TextTypeCollectionSize:
|
||||
if (page_ != NULL) {
|
||||
ss << page_->getCollectionSize();
|
||||
}
|
||||
ss << page.getCollectionSize();
|
||||
break;
|
||||
case TextTypeCollectionIndex:
|
||||
if (page_ != NULL) {
|
||||
ss << (1+page_->getSelectedIndex());
|
||||
}
|
||||
ss << (1+page.getSelectedIndex());
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
imageInst_ = new Text(ss.str(), fontInst_, scaleX_, scaleY_);
|
||||
imageInst_ = new Text(ss.str(), page, fontInst_, scaleX_, scaleY_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
class ReloadableText : public Component
|
||||
{
|
||||
public:
|
||||
ReloadableText(std::string type, Page *page, Font *font, std::string layoutKey, float scaleX, float scaleY);
|
||||
ReloadableText(std::string type, Page &page, Font *font, std::string layoutKey, float scaleX, float scaleY);
|
||||
virtual ~ReloadableText();
|
||||
void update(float dt);
|
||||
void draw();
|
||||
@ -54,7 +54,6 @@ private:
|
||||
|
||||
Text *imageInst_;
|
||||
TextType type_;
|
||||
Page *page_;
|
||||
std::string layoutKey_;
|
||||
bool reloadRequested_;
|
||||
bool firstLoad_;
|
||||
|
||||
@ -14,13 +14,13 @@
|
||||
* along with RetroFE. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ScrollingList.h"
|
||||
#include "../Animate/Tween.h"
|
||||
#include "../Animate/TweenSet.h"
|
||||
#include "../Animate/Animation.h"
|
||||
#include "../Animate/AnimationEvents.h"
|
||||
#include "../Animate/TweenTypes.h"
|
||||
#include "../Font.h"
|
||||
#include "ScrollingList.h"
|
||||
#include "ImageBuilder.h"
|
||||
#include "VideoBuilder.h"
|
||||
#include "VideoComponent.h"
|
||||
@ -40,12 +40,14 @@
|
||||
|
||||
//todo: remove coupling from configuration data (if possible)
|
||||
ScrollingList::ScrollingList(Configuration &c,
|
||||
Page &p,
|
||||
float scaleX,
|
||||
float scaleY,
|
||||
Font *font,
|
||||
std::string layoutKey,
|
||||
std::string imageType)
|
||||
: horizontalScroll(false)
|
||||
: Component(p)
|
||||
, horizontalScroll(false)
|
||||
, spriteList_(NULL)
|
||||
, scrollPoints_(NULL)
|
||||
, tweenPoints_(NULL)
|
||||
@ -226,6 +228,20 @@ void ScrollingList::setSelectedIndex(int selectedIndex)
|
||||
selectedOffsetIndex_ = selectedIndex;
|
||||
}
|
||||
|
||||
Item *ScrollingList::getItemByOffset(int offset)
|
||||
{
|
||||
if(!items_ || items_->size() == 0) return NULL;
|
||||
unsigned int index = getSelectedIndex();
|
||||
if(offset > 0) {
|
||||
index = loopIncrement(index, offset, items_->size());
|
||||
}
|
||||
else if(offset < 0) {
|
||||
index = loopDecrement(index, offset*-1, items_->size());
|
||||
}
|
||||
|
||||
return items_->at(index);
|
||||
}
|
||||
|
||||
void ScrollingList::click(double nextScrollTime)
|
||||
{
|
||||
if(currentScrollDirection_ == ScrollDirectionBack)
|
||||
@ -569,53 +585,53 @@ bool ScrollingList::allocateTexture(unsigned int index, Item *item)
|
||||
|
||||
// check collection path for art based on gamename
|
||||
config_.getMediaPropertyAbsolutePath(collectionName, imageType_, false, imagePath);
|
||||
t = imageBuild.CreateImage(imagePath, item->name, scaleX_, scaleY_);
|
||||
t = imageBuild.CreateImage(imagePath, page, item->name, scaleX_, scaleY_);
|
||||
|
||||
// check sub-collection path for art based on gamename
|
||||
if(!t)
|
||||
{
|
||||
config_.getMediaPropertyAbsolutePath(item->collectionInfo->name, imageType_, false, imagePath);
|
||||
t = imageBuild.CreateImage(imagePath, item->name, scaleX_, scaleY_);
|
||||
t = imageBuild.CreateImage(imagePath, page, item->name, scaleX_, scaleY_);
|
||||
}
|
||||
|
||||
// check collection path for art based on game name (full title)
|
||||
if(!t && item->title != item->fullTitle)
|
||||
{
|
||||
config_.getMediaPropertyAbsolutePath(collectionName, imageType_, false, imagePath);
|
||||
t = imageBuild.CreateImage(imagePath, item->fullTitle, scaleX_, scaleY_);
|
||||
t = imageBuild.CreateImage(imagePath, page, item->fullTitle, scaleX_, scaleY_);
|
||||
}
|
||||
|
||||
// check sub-collection path for art based on game name (full title)
|
||||
if(!t && item->title != item->fullTitle)
|
||||
{
|
||||
config_.getMediaPropertyAbsolutePath(item->collectionInfo->name, imageType_, false, imagePath);
|
||||
t = imageBuild.CreateImage(imagePath, item->fullTitle, scaleX_, scaleY_);
|
||||
t = imageBuild.CreateImage(imagePath, page, item->fullTitle, scaleX_, scaleY_);
|
||||
}
|
||||
|
||||
// check collection path for art based on parent game name
|
||||
if(!t && item->cloneof != "")
|
||||
{
|
||||
config_.getMediaPropertyAbsolutePath(collectionName, imageType_, false, imagePath);
|
||||
t = imageBuild.CreateImage(imagePath, item->cloneof, scaleX_, scaleY_);
|
||||
t = imageBuild.CreateImage(imagePath, page, item->cloneof, scaleX_, scaleY_);
|
||||
}
|
||||
|
||||
// check sub-collection path for art based on parent game name
|
||||
if(!t && item->cloneof != "")
|
||||
{
|
||||
config_.getMediaPropertyAbsolutePath(item->collectionInfo->name, imageType_, false, imagePath);
|
||||
t = imageBuild.CreateImage(imagePath, item->cloneof, scaleX_, scaleY_);
|
||||
t = imageBuild.CreateImage(imagePath, page, item->cloneof, scaleX_, scaleY_);
|
||||
}
|
||||
|
||||
// check collection path for art based on system name
|
||||
if(!t)
|
||||
{
|
||||
config_.getMediaPropertyAbsolutePath(item->name, imageType_, true, imagePath);
|
||||
t = imageBuild.CreateImage(imagePath, imageType_, scaleX_, scaleY_);
|
||||
t = imageBuild.CreateImage(imagePath, page, imageType_, scaleX_, scaleY_);
|
||||
}
|
||||
|
||||
if (!t)
|
||||
{
|
||||
t = new Text(item->title, fontInst_, scaleX_, scaleY_);
|
||||
t = new Text(item->title, page, fontInst_, scaleX_, scaleY_);
|
||||
}
|
||||
|
||||
if(t)
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
#include <vector>
|
||||
#include "Component.h"
|
||||
#include "../Animate/Tween.h"
|
||||
#include "../Page.h"
|
||||
#include "../MenuNotifierInterface.h"
|
||||
#include "../ViewInfo.h"
|
||||
#include "../../Database/Configuration.h"
|
||||
@ -43,6 +44,7 @@ public:
|
||||
};
|
||||
|
||||
ScrollingList(Configuration &c,
|
||||
Page &p,
|
||||
float scaleX,
|
||||
float scaleY,
|
||||
Font *font,
|
||||
@ -72,6 +74,7 @@ public:
|
||||
unsigned int getScrollOffsetIndex();
|
||||
void setScrollOffsetIndex(unsigned int index);
|
||||
void setSelectedIndex(int selectedIndex);
|
||||
Item *getItemByOffset(int offset);
|
||||
void addComponentForNotifications(MenuNotifierInterface *c);
|
||||
void removeComponentForNotifications(MenuNotifierInterface *c);
|
||||
void freeGraphicsMemory();
|
||||
|
||||
@ -20,8 +20,9 @@
|
||||
#include "../Font.h"
|
||||
#include <sstream>
|
||||
|
||||
Text::Text(std::string text, Font *font, float scaleX, float scaleY)
|
||||
: textData_(text)
|
||||
Text::Text(std::string text, Page &p, Font *font, float scaleX, float scaleY)
|
||||
: Component(p)
|
||||
, textData_(text)
|
||||
, fontInst_(font)
|
||||
, scaleX_(scaleX)
|
||||
, scaleY_(scaleY)
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "Component.h"
|
||||
|
||||
#include "../Page.h"
|
||||
#include <SDL2/SDL.h>
|
||||
#include <vector>
|
||||
|
||||
@ -26,7 +26,7 @@ class Text : public Component
|
||||
{
|
||||
public:
|
||||
//todo: should have a Font flass that references fontcache, pass that in as an argument
|
||||
Text(std::string text, Font *font, float scaleX, float scaleY);
|
||||
Text(std::string text, Page &p, Font *font, float scaleX, float scaleY);
|
||||
virtual ~Text();
|
||||
void setText(std::string text);
|
||||
void allocateGraphicsMemory();
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
#include <fstream>
|
||||
|
||||
|
||||
VideoComponent * VideoBuilder::createVideo(std::string path, std::string name, float scaleX, float scaleY)
|
||||
VideoComponent * VideoBuilder::createVideo(std::string path, Page &page, std::string name, float scaleX, float scaleY)
|
||||
{
|
||||
VideoComponent *component = NULL;
|
||||
std::vector<std::string> extensions;
|
||||
@ -40,7 +40,7 @@ VideoComponent * VideoBuilder::createVideo(std::string path, std::string name, f
|
||||
|
||||
if(video)
|
||||
{
|
||||
component = new VideoComponent(video, file, scaleX, scaleY);
|
||||
component = new VideoComponent(video, page, file, scaleX, scaleY);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -17,13 +17,14 @@
|
||||
|
||||
#include "Image.h"
|
||||
#include "VideoComponent.h"
|
||||
#include "../Page.h"
|
||||
#include "../../Video/VideoFactory.h"
|
||||
|
||||
//todo: this is more of a factory than a builder
|
||||
class VideoBuilder
|
||||
{
|
||||
public:
|
||||
VideoComponent * createVideo(std::string path, std::string name, float scaleX, float scaleY);
|
||||
VideoComponent * createVideo(std::string path, Page &page, std::string name, float scaleX, float scaleY);
|
||||
|
||||
private:
|
||||
VideoFactory factory_;
|
||||
|
||||
@ -20,8 +20,9 @@
|
||||
#include "../../Utility/Log.h"
|
||||
#include "../../SDL.h"
|
||||
|
||||
VideoComponent::VideoComponent(IVideo *videoInst, std::string videoFile, float scaleX, float scaleY)
|
||||
: videoFile_(videoFile)
|
||||
VideoComponent::VideoComponent(IVideo *videoInst, Page &p, std::string videoFile, float scaleX, float scaleY)
|
||||
: Component(p)
|
||||
, videoFile_(videoFile)
|
||||
, videoInst_(videoInst)
|
||||
, scaleX_(scaleX)
|
||||
, scaleY_(scaleY)
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
#pragma once
|
||||
#include "Component.h"
|
||||
#include "Image.h"
|
||||
#include "../Page.h"
|
||||
#include "../../Collection/Item.h"
|
||||
#include "../../Video/IVideo.h"
|
||||
#include <SDL2/SDL.h>
|
||||
@ -24,7 +25,7 @@
|
||||
class VideoComponent : public Component
|
||||
{
|
||||
public:
|
||||
VideoComponent(IVideo *videoInst, std::string videoFile, float scaleX, float scaleY);
|
||||
VideoComponent(IVideo *videoInst, Page &p, std::string videoFile, float scaleX, float scaleY);
|
||||
virtual ~VideoComponent();
|
||||
void update(float dt);
|
||||
void draw();
|
||||
|
||||
@ -44,6 +44,11 @@ Page::Page(Configuration &config)
|
||||
}
|
||||
|
||||
Page::~Page()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void Page::DeInitialize()
|
||||
{
|
||||
MenuVector_T::iterator it = menus_.begin();
|
||||
while(it != menus_.end())
|
||||
@ -292,6 +297,12 @@ Item *Page::getSelectedItem()
|
||||
return selectedItem_;
|
||||
}
|
||||
|
||||
Item *Page::getSelectedItem(int offset)
|
||||
{
|
||||
return activeMenu_->getItemByOffset(offset);
|
||||
}
|
||||
|
||||
|
||||
void Page::removeSelectedItem()
|
||||
{
|
||||
/*
|
||||
@ -352,7 +363,7 @@ void Page::highlight()
|
||||
if(!item) return;
|
||||
if(activeMenu_)
|
||||
{
|
||||
activeMenu_->triggerHighlightEvent(item);
|
||||
activeMenu_->triggerHighlightEvent();
|
||||
activeMenu_->scrollActive = scrollActive_;
|
||||
}
|
||||
|
||||
@ -360,7 +371,7 @@ void Page::highlight()
|
||||
{
|
||||
for(std::vector<Component *>::iterator it = LayerComponents[i].begin(); it != LayerComponents[i].end(); ++it)
|
||||
{
|
||||
(*it)->triggerHighlightEvent(item);
|
||||
(*it)->triggerHighlightEvent();
|
||||
(*it)->scrollActive = scrollActive_;
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,6 +43,7 @@ public:
|
||||
|
||||
Page(Configuration &c);
|
||||
virtual ~Page();
|
||||
void DeInitialize();
|
||||
virtual void onNewItemSelected(Item *);
|
||||
bool pushCollection(CollectionInfo *collection);
|
||||
bool popCollection();
|
||||
@ -66,6 +67,7 @@ public:
|
||||
bool isHorizontalScroll();
|
||||
unsigned int getMenuDepth();
|
||||
Item *getSelectedItem();
|
||||
Item *getSelectedItem(int offset);
|
||||
void removeSelectedItem();
|
||||
void setScrollOffsetIndex(unsigned int i);
|
||||
unsigned int getScrollOffsetIndex();
|
||||
|
||||
@ -320,13 +320,13 @@ bool PageBuilder::buildComponents(xml_node<> *layout, Page *page)
|
||||
{
|
||||
for(xml_node<> *componentXml = layout->first_node("menu"); componentXml; componentXml = componentXml->next_sibling("menu"))
|
||||
{
|
||||
ScrollingList *scrollingList = buildMenu(componentXml);
|
||||
ScrollingList *scrollingList = buildMenu(componentXml,*page);
|
||||
page->pushMenu(scrollingList);
|
||||
}
|
||||
|
||||
for(xml_node<> *componentXml = layout->first_node("container"); componentXml; componentXml = componentXml->next_sibling("container"))
|
||||
{
|
||||
Container *c = new Container();
|
||||
Container *c = new Container(*page);
|
||||
buildViewInfo(componentXml, c->baseViewInfo);
|
||||
loadTweens(c, componentXml);
|
||||
page->addComponent(c);
|
||||
@ -346,7 +346,7 @@ bool PageBuilder::buildComponents(xml_node<> *layout, Page *page)
|
||||
std::string imagePath;
|
||||
imagePath = Utils::combinePath(Configuration::convertToAbsolutePath(layoutPath, imagePath), std::string(src->value()));
|
||||
|
||||
Image *c = new Image(imagePath, scaleX_, scaleY_);
|
||||
Image *c = new Image(imagePath, *page, scaleX_, scaleY_);
|
||||
buildViewInfo(componentXml, c->baseViewInfo);
|
||||
loadTweens(c, componentXml);
|
||||
page->addComponent(c);
|
||||
@ -365,7 +365,7 @@ bool PageBuilder::buildComponents(xml_node<> *layout, Page *page)
|
||||
else
|
||||
{
|
||||
Font *font = addFont(componentXml, NULL);
|
||||
Text *c = new Text(value->value(), font, scaleX_, scaleY_);
|
||||
Text *c = new Text(value->value(), *page, font, scaleX_, scaleY_);
|
||||
|
||||
buildViewInfo(componentXml, c->baseViewInfo);
|
||||
|
||||
@ -377,7 +377,7 @@ bool PageBuilder::buildComponents(xml_node<> *layout, Page *page)
|
||||
for(xml_node<> *componentXml = layout->first_node("statusText"); componentXml; componentXml = componentXml->next_sibling("statusText"))
|
||||
{
|
||||
Font *font = addFont(componentXml, NULL);
|
||||
Text *c = new Text("", font, scaleX_, scaleY_);
|
||||
Text *c = new Text("", *page, font, scaleX_, scaleY_);
|
||||
|
||||
buildViewInfo(componentXml, c->baseViewInfo);
|
||||
|
||||
@ -403,8 +403,9 @@ void PageBuilder::loadReloadableImages(xml_node<> *layout, std::string tagName,
|
||||
std::string reloadableVideoPath;
|
||||
xml_attribute<> *type = componentXml->first_attribute("type");
|
||||
xml_attribute<> *mode = componentXml->first_attribute("mode");
|
||||
xml_attribute<> *selectedOffsetXml = componentXml->first_attribute("selectedOffset");
|
||||
bool systemMode = false;
|
||||
|
||||
int selectedOffset = 0;
|
||||
if(tagName == "reloadableVideo")
|
||||
{
|
||||
type = componentXml->first_attribute("imageType");
|
||||
@ -430,6 +431,13 @@ void PageBuilder::loadReloadableImages(xml_node<> *layout, std::string tagName,
|
||||
}
|
||||
}
|
||||
|
||||
if(selectedOffsetXml)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << selectedOffsetXml->value();
|
||||
ss >> selectedOffset;
|
||||
}
|
||||
|
||||
|
||||
Component *c = NULL;
|
||||
|
||||
@ -438,13 +446,13 @@ void PageBuilder::loadReloadableImages(xml_node<> *layout, std::string tagName,
|
||||
if(type)
|
||||
{
|
||||
Font *font = addFont(componentXml, NULL);
|
||||
c = new ReloadableText(type->value(), page, font, layoutKey, scaleX_, scaleY_);
|
||||
c = new ReloadableText(type->value(), *page, font, layoutKey, scaleX_, scaleY_);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Font *font = addFont(componentXml, NULL);
|
||||
c = new ReloadableMedia(config_, systemMode, type->value(), (tagName == "reloadableVideo"), font, scaleX_, scaleY_);
|
||||
c = new ReloadableMedia(config_, systemMode, type->value(), *page, selectedOffset, (tagName == "reloadableVideo"), font, scaleX_, scaleY_);
|
||||
xml_attribute<> *textFallback = componentXml->first_attribute("textFallback");
|
||||
|
||||
if(textFallback && Utils::toLower(textFallback->value()) == "true")
|
||||
@ -564,7 +572,7 @@ void PageBuilder::buildTweenSet(AnimationEvents *tweens, xml_node<> *componentXm
|
||||
}
|
||||
|
||||
|
||||
ScrollingList * PageBuilder::buildMenu(xml_node<> *menuXml)
|
||||
ScrollingList * PageBuilder::buildMenu(xml_node<> *menuXml, Page &page)
|
||||
{
|
||||
ScrollingList *menu = NULL;
|
||||
std::string menuType = "vertical";
|
||||
@ -596,7 +604,7 @@ ScrollingList * PageBuilder::buildMenu(xml_node<> *menuXml)
|
||||
// on default, text will be rendered to the menu. Preload it into cache.
|
||||
Font *font = addFont(itemDefaults, NULL);
|
||||
|
||||
menu = new ScrollingList(config_, scaleX_, scaleY_, font, layoutKey, imageType);
|
||||
menu = new ScrollingList(config_, page, scaleX_, scaleY_, font, layoutKey, imageType);
|
||||
|
||||
if(scrollTimeXml)
|
||||
{
|
||||
|
||||
@ -58,7 +58,7 @@ private:
|
||||
void loadTweens(Component *c, rapidxml::xml_node<> *componentXml);
|
||||
AnimationEvents *createTweenInstance(rapidxml::xml_node<> *componentXml);
|
||||
void buildTweenSet(AnimationEvents *tweens, rapidxml::xml_node<> *componentXml, std::string tagName, std::string tweenName);
|
||||
ScrollingList * buildMenu(rapidxml::xml_node<> *menuXml);
|
||||
ScrollingList * buildMenu(rapidxml::xml_node<> *menuXml, Page &p);
|
||||
void buildCustomMenu(ScrollingList *menu, rapidxml::xml_node<> *menuXml, rapidxml::xml_node<> *itemDefaults);
|
||||
void buildVerticalMenu(ScrollingList *menu, rapidxml::xml_node<> *menuXml, rapidxml::xml_node<> *itemDefaults);
|
||||
int parseMenuPosition(std::string strIndex);
|
||||
|
||||
@ -178,6 +178,7 @@ bool RetroFE::deInitialize()
|
||||
|
||||
if(currentPage_)
|
||||
{
|
||||
currentPage_->DeInitialize();
|
||||
delete currentPage_;
|
||||
currentPage_ = NULL;
|
||||
}
|
||||
@ -288,6 +289,7 @@ void RetroFE::run()
|
||||
}
|
||||
|
||||
// delete the splash screen and use the standard menu
|
||||
currentPage_->DeInitialize();
|
||||
delete currentPage_;
|
||||
|
||||
currentPage_ = loadPage();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user