mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2025-12-13 02:08:52 +01:00
add new tween tye yshitmenudirection, new event onMenuFastScroll, handing of reloadable medias following menus so that we can create lists following any menu
Signed-off-by: Vincent-FK <vincent.buso@funkey-project.com>
This commit is contained in:
parent
37e0a0a31d
commit
fe18b0329f
@ -29,6 +29,7 @@ Tween::Tween(TweenProperty property, TweenAlgorithm type, double start, double e
|
|||||||
, type(type)
|
, type(type)
|
||||||
, start(start)
|
, start(start)
|
||||||
, end(end)
|
, end(end)
|
||||||
|
, endOriginal(end)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,6 +50,7 @@ bool Tween::getTweenProperty(std::string name, TweenProperty &property)
|
|||||||
tweenPropertyMap_["yorigin"] = TWEEN_PROPERTY_Y_ORIGIN;
|
tweenPropertyMap_["yorigin"] = TWEEN_PROPERTY_Y_ORIGIN;
|
||||||
tweenPropertyMap_["xoffset"] = TWEEN_PROPERTY_X_OFFSET;
|
tweenPropertyMap_["xoffset"] = TWEEN_PROPERTY_X_OFFSET;
|
||||||
tweenPropertyMap_["yoffset"] = TWEEN_PROPERTY_Y_OFFSET;
|
tweenPropertyMap_["yoffset"] = TWEEN_PROPERTY_Y_OFFSET;
|
||||||
|
tweenPropertyMap_["yshiftmenudirection"] = TWEEN_PROPERTY_Y_SHIFT_MENU_DIRECTION;
|
||||||
tweenPropertyMap_["fontSize"] = TWEEN_PROPERTY_FONT_SIZE;
|
tweenPropertyMap_["fontSize"] = TWEEN_PROPERTY_FONT_SIZE;
|
||||||
tweenPropertyMap_["backgroundalpha"] = TWEEN_PROPERTY_BACKGROUND_ALPHA;
|
tweenPropertyMap_["backgroundalpha"] = TWEEN_PROPERTY_BACKGROUND_ALPHA;
|
||||||
tweenPropertyMap_["maxwidth"] = TWEEN_PROPERTY_MAX_WIDTH;
|
tweenPropertyMap_["maxwidth"] = TWEEN_PROPERTY_MAX_WIDTH;
|
||||||
@ -113,6 +115,17 @@ TweenAlgorithm Tween::getTweenType(std::string name)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double Tween::getStart( ){
|
||||||
|
return start;
|
||||||
|
}
|
||||||
|
|
||||||
|
double Tween::getOriginalEnd( ){
|
||||||
|
return endOriginal;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Tween::setEnd(double value){
|
||||||
|
end = value;
|
||||||
|
}
|
||||||
|
|
||||||
float Tween::animate(double elapsedTime)
|
float Tween::animate(double elapsedTime)
|
||||||
{
|
{
|
||||||
@ -124,6 +137,11 @@ float Tween::animate(double elapsedTime, double startValue)
|
|||||||
return animateSingle(type, startValue, end, duration, elapsedTime);
|
return animateSingle(type, startValue, end, duration, elapsedTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float Tween::animate(double elapsedTime, double startValue, double endValue, double durationValue)
|
||||||
|
{
|
||||||
|
return animateSingle(type, startValue, endValue, durationValue, elapsedTime);
|
||||||
|
}
|
||||||
|
|
||||||
//todo: SDL likes floats, consider having casting being performed elsewhere
|
//todo: SDL likes floats, consider having casting being performed elsewhere
|
||||||
float Tween::animateSingle(TweenAlgorithm type, double start, double end, double duration, double elapsedTime)
|
float Tween::animateSingle(TweenAlgorithm type, double start, double end, double duration, double elapsedTime)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -28,12 +28,16 @@ public:
|
|||||||
Tween(TweenProperty name, TweenAlgorithm type, double start, double end, double duration);
|
Tween(TweenProperty name, TweenAlgorithm type, double start, double end, double duration);
|
||||||
float animate(double elapsedTime);
|
float animate(double elapsedTime);
|
||||||
float animate(double elapsedTime, double startValue);
|
float animate(double elapsedTime, double startValue);
|
||||||
|
float animate(double elapsedTime, double startValue, double endValue, double durationValue);
|
||||||
static float animateSingle(TweenAlgorithm type, double start, double end, double duration, double elapsedTime);
|
static float animateSingle(TweenAlgorithm type, double start, double end, double duration, double elapsedTime);
|
||||||
static TweenAlgorithm getTweenType(std::string name);
|
static TweenAlgorithm getTweenType(std::string name);
|
||||||
static bool getTweenProperty(std::string name, TweenProperty &property);
|
static bool getTweenProperty(std::string name, TweenProperty &property);
|
||||||
TweenProperty property;
|
TweenProperty property;
|
||||||
double duration;
|
double duration;
|
||||||
bool startDefined;
|
bool startDefined;
|
||||||
|
void setEnd(double value);
|
||||||
|
double getStart( );
|
||||||
|
double getOriginalEnd( );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static double easeInQuadratic(double elapsedTime, double duration, double b, double c);
|
static double easeInQuadratic(double elapsedTime, double duration, double b, double c);
|
||||||
@ -64,4 +68,5 @@ private:
|
|||||||
TweenAlgorithm type;
|
TweenAlgorithm type;
|
||||||
double start;
|
double start;
|
||||||
double end;
|
double end;
|
||||||
|
double endOriginal;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -53,6 +53,7 @@ enum TweenProperty
|
|||||||
TWEEN_PROPERTY_Y_ORIGIN,
|
TWEEN_PROPERTY_Y_ORIGIN,
|
||||||
TWEEN_PROPERTY_X_OFFSET,
|
TWEEN_PROPERTY_X_OFFSET,
|
||||||
TWEEN_PROPERTY_Y_OFFSET,
|
TWEEN_PROPERTY_Y_OFFSET,
|
||||||
|
TWEEN_PROPERTY_Y_SHIFT_MENU_DIRECTION,
|
||||||
TWEEN_PROPERTY_FONT_SIZE,
|
TWEEN_PROPERTY_FONT_SIZE,
|
||||||
TWEEN_PROPERTY_BACKGROUND_ALPHA,
|
TWEEN_PROPERTY_BACKGROUND_ALPHA,
|
||||||
TWEEN_PROPERTY_MAX_WIDTH,
|
TWEEN_PROPERTY_MAX_WIDTH,
|
||||||
|
|||||||
@ -256,16 +256,22 @@ bool Component::animate()
|
|||||||
bool currentDone = true;
|
bool currentDone = true;
|
||||||
TweenSet *tweens = currentTweens_->tweenSet(currentTweenIndex_);
|
TweenSet *tweens = currentTweens_->tweenSet(currentTweenIndex_);
|
||||||
|
|
||||||
|
|
||||||
for(unsigned int i = 0; i < tweens->size(); i++)
|
for(unsigned int i = 0; i < tweens->size(); i++)
|
||||||
{
|
{
|
||||||
Tween *tween = tweens->tweens()->at(i);
|
Tween *tween = tweens->tweens()->at(i);
|
||||||
double elapsedTime = elapsedTweenTime_;
|
double elapsedTime = elapsedTweenTime_;
|
||||||
|
|
||||||
|
/* Special case get menu scroll duration if duration specified is 0 */
|
||||||
|
double duration = tween->duration ? tween->duration : page.getScrollPeriod();
|
||||||
|
|
||||||
//todo: too many levels of nesting
|
//todo: too many levels of nesting
|
||||||
if ( elapsedTime < tween->duration )
|
if ( elapsedTime < duration ){
|
||||||
currentDone = false;
|
currentDone = false;
|
||||||
else
|
}
|
||||||
elapsedTime = static_cast<float>(tween->duration);
|
else{
|
||||||
|
elapsedTime = static_cast<float>(duration);
|
||||||
|
}
|
||||||
|
|
||||||
switch(tween->property)
|
switch(tween->property)
|
||||||
{
|
{
|
||||||
@ -339,6 +345,38 @@ bool Component::animate()
|
|||||||
baseViewInfo.YOffset = tween->animate(elapsedTime, storeViewInfo_.YOffset);
|
baseViewInfo.YOffset = tween->animate(elapsedTime, storeViewInfo_.YOffset);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case TWEEN_PROPERTY_Y_SHIFT_MENU_DIRECTION:
|
||||||
|
if (tween->startDefined){
|
||||||
|
/*printf("storeViewInfo_.YOffset = %f, tween->start() = %f, page.isMenuScrollForward()=%d, tween->getEnd()=%f, newEnd=%f\n",
|
||||||
|
storeViewInfo_.YOffset, tween->getStart(), page.isMenuScrollForward(), tween->getOriginalEnd(),
|
||||||
|
tween->getStart() + tween->getOriginalEnd()* (static_cast<double>(page.isMenuScrollForward()?-1.0f:1.0f)) );*/
|
||||||
|
/*printf("y_shift_animation, elapsedTime = %f\n", elapsedTime);
|
||||||
|
printf("page.getScrollPeriod() = %f\n", page.getScrollPeriod());*/
|
||||||
|
|
||||||
|
/*tween->setEnd( tween->getStart() + tween->getOriginalEnd()* (static_cast<double>(page.isMenuScrollForward()?-1.0f:1.0f)) );
|
||||||
|
baseViewInfo.YOffset = tween->animate(elapsedTime);*/
|
||||||
|
|
||||||
|
baseViewInfo.YOffset = tween->animate(elapsedTime,
|
||||||
|
tween->getStart(),
|
||||||
|
tween->getStart() + tween->getOriginalEnd()* (static_cast<double>(page.isMenuScrollForward()?-1.0f:1.0f)),
|
||||||
|
duration);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
/*printf("storeViewInfo_.YOffset = %f, page.isMenuScrollForward()=%d, tween->getEnd()=%f, newEnd=%f\n",
|
||||||
|
storeViewInfo_.YOffset, page.isMenuScrollForward(), tween->getOriginalEnd(),
|
||||||
|
static_cast<double>(storeViewInfo_.YOffset) + tween->getOriginalEnd()* (static_cast<double>(page.isMenuScrollForward()?-1.0f:1.0f)) );
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*tween->setEnd( static_cast<double>(storeViewInfo_.YOffset) + tween->getOriginalEnd()* (static_cast<double>(page.isMenuScrollForward()?-1.0f:1.0f)) );
|
||||||
|
baseViewInfo.YOffset = tween->animate(elapsedTime, storeViewInfo_.YOffset);*/
|
||||||
|
|
||||||
|
baseViewInfo.YOffset = tween->animate(elapsedTime,
|
||||||
|
static_cast<double>(storeViewInfo_.YOffset),
|
||||||
|
static_cast<double>(storeViewInfo_.YOffset) + tween->getOriginalEnd()* (static_cast<double>(page.isMenuScrollForward()?-1.0f:1.0f)),
|
||||||
|
duration);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case TWEEN_PROPERTY_FONT_SIZE:
|
case TWEEN_PROPERTY_FONT_SIZE:
|
||||||
if (tween->startDefined)
|
if (tween->startDefined)
|
||||||
baseViewInfo.FontSize = tween->animate(elapsedTime);
|
baseViewInfo.FontSize = tween->animate(elapsedTime);
|
||||||
|
|||||||
@ -33,6 +33,7 @@ Image * ImageBuilder::CreateImage(std::string path, Page &p, std::string name, f
|
|||||||
std::string prefix = Utils::combinePath(path, name);
|
std::string prefix = Utils::combinePath(path, name);
|
||||||
std::string file;
|
std::string file;
|
||||||
|
|
||||||
|
//printf(" findMatchingFile, prefix = %s, file = %s\n", prefix.c_str(), file.c_str());
|
||||||
if(Utils::findMatchingFile(prefix, extensions, file))
|
if(Utils::findMatchingFile(prefix, extensions, file))
|
||||||
{
|
{
|
||||||
image = new Image(file, "", p, scaleX, scaleY);
|
image = new Image(file, "", p, scaleX, scaleY);
|
||||||
|
|||||||
@ -40,6 +40,9 @@ ReloadableMedia::ReloadableMedia(Configuration &config, bool systemMode, bool la
|
|||||||
, isVideo_(isVideo)
|
, isVideo_(isVideo)
|
||||||
, FfntInst_(font)
|
, FfntInst_(font)
|
||||||
, textFallback_(false)
|
, textFallback_(false)
|
||||||
|
, imageFallback_(false)
|
||||||
|
, imageAndTextPadding_(0)
|
||||||
|
, imageAndText_(false)
|
||||||
, type_(type)
|
, type_(type)
|
||||||
, scaleX_(scaleX)
|
, scaleX_(scaleX)
|
||||||
, scaleY_(scaleY)
|
, scaleY_(scaleY)
|
||||||
@ -57,17 +60,36 @@ ReloadableMedia::~ReloadableMedia()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ReloadableMedia::enableImageAndText_(bool value)
|
||||||
|
{
|
||||||
|
imageAndText_ = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ReloadableMedia::setImageAndTextPadding_(float value)
|
||||||
|
{
|
||||||
|
imageAndTextPadding_ = value;
|
||||||
|
}
|
||||||
|
|
||||||
void ReloadableMedia::enableTextFallback_(bool value)
|
void ReloadableMedia::enableTextFallback_(bool value)
|
||||||
{
|
{
|
||||||
textFallback_ = value;
|
textFallback_ = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ReloadableMedia::enableImageFallback_(bool value)
|
||||||
|
{
|
||||||
|
imageFallback_ = value;
|
||||||
|
}
|
||||||
|
|
||||||
void ReloadableMedia::update(float dt)
|
void ReloadableMedia::update(float dt)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// needs to be ran at the end to prevent the NewItemSelected flag from being detected
|
||||||
|
Component::update(dt);
|
||||||
|
|
||||||
|
// Reload media
|
||||||
if (newItemSelected ||
|
if (newItemSelected ||
|
||||||
(newScrollItemSelected && getMenuScrollReload()))
|
(newScrollItemSelected && getMenuScrollReload()))
|
||||||
{
|
{
|
||||||
|
|
||||||
reloadTexture();
|
reloadTexture();
|
||||||
newItemSelected = false;
|
newItemSelected = false;
|
||||||
newScrollItemSelected = false;
|
newScrollItemSelected = false;
|
||||||
@ -86,9 +108,6 @@ void ReloadableMedia::update(float dt)
|
|||||||
loadedComponent_->update(dt);
|
loadedComponent_->update(dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
// needs to be ran at the end to prevent the NewItemSelected flag from being detected
|
|
||||||
Component::update(dt);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReloadableMedia::allocateGraphicsMemory()
|
void ReloadableMedia::allocateGraphicsMemory()
|
||||||
@ -379,6 +398,20 @@ void ReloadableMedia::reloadTexture()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if image and artwork was not specified, fall back to displaying text
|
||||||
|
if(!loadedComponent_ && imageFallback_)
|
||||||
|
{
|
||||||
|
//loadedComponent_ = new Text(selectedItem->fullTitle, page, FfntInst_, scaleX_, scaleY_);
|
||||||
|
/*baseViewInfo.ImageWidth = loadedComponent_->baseViewInfo.ImageWidth;
|
||||||
|
baseViewInfo.ImageHeight = loadedComponent_->baseViewInfo.ImageHeight;*/
|
||||||
|
|
||||||
|
std::string imagePath;
|
||||||
|
ImageBuilder imageBuild;
|
||||||
|
imagePath = Utils::combinePath(Configuration::absolutePath, "collections", collectionName );
|
||||||
|
imagePath = Utils::combinePath( imagePath, "system_artwork" );
|
||||||
|
loadedComponent_ = imageBuild.CreateImage( imagePath, page, std::string("fallback"), scaleX_, scaleY_ );
|
||||||
|
}
|
||||||
|
|
||||||
// if image and artwork was not specified, fall back to displaying text
|
// if image and artwork was not specified, fall back to displaying text
|
||||||
if(!loadedComponent_ && textFallback_)
|
if(!loadedComponent_ && textFallback_)
|
||||||
{
|
{
|
||||||
@ -386,6 +419,12 @@ void ReloadableMedia::reloadTexture()
|
|||||||
baseViewInfo.ImageWidth = loadedComponent_->baseViewInfo.ImageWidth;
|
baseViewInfo.ImageWidth = loadedComponent_->baseViewInfo.ImageWidth;
|
||||||
baseViewInfo.ImageHeight = loadedComponent_->baseViewInfo.ImageHeight;
|
baseViewInfo.ImageHeight = loadedComponent_->baseViewInfo.ImageHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*if(imageAndText_){
|
||||||
|
loadedComponent_ = new Text(selectedItem->fullTitle, page, FfntInst_, scaleX_, scaleY_);
|
||||||
|
baseViewInfo.ImageWidth = loadedComponent_->baseViewInfo.ImageWidth;
|
||||||
|
baseViewInfo.ImageHeight = loadedComponent_->baseViewInfo.ImageHeight;
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -35,7 +35,10 @@ public:
|
|||||||
void allocateGraphicsMemory();
|
void allocateGraphicsMemory();
|
||||||
Component *findComponent(std::string collection, std::string type, std::string basename, std::string filepath, bool systemMode);
|
Component *findComponent(std::string collection, std::string type, std::string basename, std::string filepath, bool systemMode);
|
||||||
|
|
||||||
|
void enableImageAndText_(bool value);
|
||||||
|
void setImageAndTextPadding_(float value);
|
||||||
void enableTextFallback_(bool value);
|
void enableTextFallback_(bool value);
|
||||||
|
void enableImageFallback_(bool value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void reloadTexture();
|
void reloadTexture();
|
||||||
@ -48,7 +51,10 @@ private:
|
|||||||
IVideo *videoInst_;
|
IVideo *videoInst_;
|
||||||
bool isVideo_;
|
bool isVideo_;
|
||||||
Font *FfntInst_;
|
Font *FfntInst_;
|
||||||
|
bool imageAndText_;
|
||||||
|
float imageAndTextPadding_;
|
||||||
bool textFallback_;
|
bool textFallback_;
|
||||||
|
bool imageFallback_;
|
||||||
std::string type_;
|
std::string type_;
|
||||||
float scaleX_;
|
float scaleX_;
|
||||||
float scaleY_;
|
float scaleY_;
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
ReloadableText::ReloadableText(std::string type, Page &page, Configuration &config, Font *font, std::string layoutKey, std::string timeFormat, std::string textFormat, std::string singlePrefix, std::string singlePostfix, std::string pluralPrefix, std::string pluralPostfix, float scaleX, float scaleY)
|
ReloadableText::ReloadableText(std::string type, Page &page, Configuration &config, Font *font, std::string layoutKey, std::string timeFormat, std::string textFormat, std::string singlePrefix, std::string singlePostfix, std::string pluralPrefix, std::string pluralPostfix, int displayOffset, float scaleX, float scaleY)
|
||||||
: Component(page)
|
: Component(page)
|
||||||
, config_(config)
|
, config_(config)
|
||||||
, imageInst_(NULL)
|
, imageInst_(NULL)
|
||||||
@ -38,6 +38,7 @@ ReloadableText::ReloadableText(std::string type, Page &page, Configuration &conf
|
|||||||
, singlePostfix_(singlePostfix)
|
, singlePostfix_(singlePostfix)
|
||||||
, pluralPrefix_(pluralPrefix)
|
, pluralPrefix_(pluralPrefix)
|
||||||
, pluralPostfix_(pluralPostfix)
|
, pluralPostfix_(pluralPostfix)
|
||||||
|
, displayOffset_(displayOffset)
|
||||||
, scaleX_(scaleX)
|
, scaleX_(scaleX)
|
||||||
, scaleY_(scaleY)
|
, scaleY_(scaleY)
|
||||||
{
|
{
|
||||||
@ -110,7 +111,7 @@ void ReloadableText::ReloadTexture()
|
|||||||
imageInst_ = NULL;
|
imageInst_ = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Item *selectedItem = page.getSelectedItem();
|
Item *selectedItem = page.getSelectedItem( displayOffset_ );
|
||||||
|
|
||||||
if (selectedItem != NULL)
|
if (selectedItem != NULL)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
class ReloadableText : public Component
|
class ReloadableText : public Component
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ReloadableText(std::string type, Page &page, Configuration &config, Font *font, std::string layoutKey, std::string timeFormat, std::string textFormat, std::string singlePrefix, std::string singlePostfix, std::string pluralPrefix, std::string pluralPostfix, float scaleX, float scaleY);
|
ReloadableText(std::string type, Page &page, Configuration &config, Font *font, std::string layoutKey, std::string timeFormat, std::string textFormat, std::string singlePrefix, std::string singlePostfix, std::string pluralPrefix, std::string pluralPostfix, int displayOffset, float scaleX, float scaleY);
|
||||||
virtual ~ReloadableText();
|
virtual ~ReloadableText();
|
||||||
void update(float dt);
|
void update(float dt);
|
||||||
void draw();
|
void draw();
|
||||||
@ -48,6 +48,7 @@ private:
|
|||||||
std::string singlePostfix_;
|
std::string singlePostfix_;
|
||||||
std::string pluralPrefix_;
|
std::string pluralPrefix_;
|
||||||
std::string pluralPostfix_;
|
std::string pluralPostfix_;
|
||||||
|
int displayOffset_;
|
||||||
|
|
||||||
float scaleX_;
|
float scaleX_;
|
||||||
float scaleY_;
|
float scaleY_;
|
||||||
|
|||||||
@ -60,7 +60,9 @@ ScrollingList::ScrollingList( Configuration &c,
|
|||||||
, selectedOffsetIndex_( 0 )
|
, selectedOffsetIndex_( 0 )
|
||||||
, scrollAcceleration_( 0 )
|
, scrollAcceleration_( 0 )
|
||||||
, startScrollTime_( 0.500 )
|
, startScrollTime_( 0.500 )
|
||||||
|
, scrollDirectionForward_( false )
|
||||||
, scrollPeriod_( 0 )
|
, scrollPeriod_( 0 )
|
||||||
|
, scrollAccelerationIdx_( 0 )
|
||||||
, config_( c )
|
, config_( c )
|
||||||
, scaleX_( scaleX )
|
, scaleX_( scaleX )
|
||||||
, scaleY_( scaleY )
|
, scaleY_( scaleY )
|
||||||
@ -125,7 +127,7 @@ unsigned int ScrollingList::loopIncrement( unsigned int offset, unsigned int i,
|
|||||||
unsigned int ScrollingList::loopDecrement( unsigned int offset, unsigned int i, unsigned int size )
|
unsigned int ScrollingList::loopDecrement( unsigned int offset, unsigned int i, unsigned int size )
|
||||||
{
|
{
|
||||||
if ( size == 0 ) return 0;
|
if ( size == 0 ) return 0;
|
||||||
return ((offset % size ) - (i % size ) + size ) % size;
|
return ((offset % size ) - (i % size ) + size ) % size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -247,7 +249,7 @@ Item *ScrollingList::getItemByOffset( int offset )
|
|||||||
{
|
{
|
||||||
index = loopDecrement( index, offset*-1, items_->size( ) );
|
index = loopDecrement( index, offset*-1, items_->size( ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
return items_->at( index );
|
return items_->at( index );
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -359,7 +361,7 @@ void ScrollingList::freeGraphicsMemory( )
|
|||||||
{
|
{
|
||||||
Component::freeGraphicsMemory( );
|
Component::freeGraphicsMemory( );
|
||||||
scrollPeriod_ = 0;
|
scrollPeriod_ = 0;
|
||||||
|
|
||||||
deallocateSpritePoints( );
|
deallocateSpritePoints( );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -620,6 +622,7 @@ bool ScrollingList::allocateTexture( unsigned int index, Item *item )
|
|||||||
imagePath = Utils::combinePath(Configuration::absolutePath, "layouts", layoutName, "collections", "_common");
|
imagePath = Utils::combinePath(Configuration::absolutePath, "layouts", layoutName, "collections", "_common");
|
||||||
else
|
else
|
||||||
imagePath = Utils::combinePath( Configuration::absolutePath, "layouts", layoutName, "collections", collectionName );
|
imagePath = Utils::combinePath( Configuration::absolutePath, "layouts", layoutName, "collections", collectionName );
|
||||||
|
|
||||||
imagePath = Utils::combinePath( imagePath, "medium_artwork", imageType_ );
|
imagePath = Utils::combinePath( imagePath, "medium_artwork", imageType_ );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -633,6 +636,7 @@ bool ScrollingList::allocateTexture( unsigned int index, Item *item )
|
|||||||
config_.getMediaPropertyAbsolutePath( collectionName, imageType_, false, imagePath );
|
config_.getMediaPropertyAbsolutePath( collectionName, imageType_, false, imagePath );
|
||||||
}
|
}
|
||||||
t = imageBuild.CreateImage( imagePath, page, names[n], scaleX_, scaleY_ );
|
t = imageBuild.CreateImage( imagePath, page, names[n], scaleX_, scaleY_ );
|
||||||
|
|
||||||
// check sub-collection path for art
|
// check sub-collection path for art
|
||||||
if ( !t && !commonMode_ )
|
if ( !t && !commonMode_ )
|
||||||
{
|
{
|
||||||
@ -654,10 +658,12 @@ bool ScrollingList::allocateTexture( unsigned int index, Item *item )
|
|||||||
{
|
{
|
||||||
if ( layoutMode_ )
|
if ( layoutMode_ )
|
||||||
{
|
{
|
||||||
if ( commonMode_ )
|
if ( commonMode_ ){
|
||||||
imagePath = Utils::combinePath(Configuration::absolutePath, "layouts", layoutName, "collections", "_common");
|
imagePath = Utils::combinePath(Configuration::absolutePath, "layouts", layoutName, "collections", "_common");
|
||||||
else
|
}
|
||||||
|
else{
|
||||||
imagePath = Utils::combinePath( Configuration::absolutePath, "layouts", layoutName, "collections", item->name );
|
imagePath = Utils::combinePath( Configuration::absolutePath, "layouts", layoutName, "collections", item->name );
|
||||||
|
}
|
||||||
imagePath = Utils::combinePath( imagePath, "system_artwork" );
|
imagePath = Utils::combinePath( imagePath, "system_artwork" );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -667,15 +673,24 @@ bool ScrollingList::allocateTexture( unsigned int index, Item *item )
|
|||||||
imagePath = Utils::combinePath(Configuration::absolutePath, "collections", "_common" );
|
imagePath = Utils::combinePath(Configuration::absolutePath, "collections", "_common" );
|
||||||
imagePath = Utils::combinePath( imagePath, "system_artwork" );
|
imagePath = Utils::combinePath( imagePath, "system_artwork" );
|
||||||
}
|
}
|
||||||
else
|
else{
|
||||||
config_.getMediaPropertyAbsolutePath( item->name, imageType_, true, imagePath );
|
config_.getMediaPropertyAbsolutePath( item->name, imageType_, true, imagePath );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
t = imageBuild.CreateImage( imagePath, page, imageType_, scaleX_, scaleY_ );
|
t = imageBuild.CreateImage( imagePath, page, imageType_, scaleX_, scaleY_ );
|
||||||
}
|
}
|
||||||
|
|
||||||
// check rom directory path for art
|
// check rom directory path for art
|
||||||
if ( !t )
|
if ( !t ){
|
||||||
t = imageBuild.CreateImage( item->filepath, page, imageType_, scaleX_, scaleY_ );
|
t = imageBuild.CreateImage( item->filepath, page, imageType_, scaleX_, scaleY_ );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Image fallback
|
||||||
|
if ( !t && imageType_.compare(std::string("null"))){
|
||||||
|
imagePath = Utils::combinePath(Configuration::absolutePath, "collections", collectionName );
|
||||||
|
imagePath = Utils::combinePath( imagePath, "system_artwork" );
|
||||||
|
t = imageBuild.CreateImage( imagePath, page, std::string("fallback"), scaleX_, scaleY_ );
|
||||||
|
}
|
||||||
|
|
||||||
if ( !t )
|
if ( !t )
|
||||||
{
|
{
|
||||||
@ -712,7 +727,7 @@ void ScrollingList::draw( )
|
|||||||
|
|
||||||
void ScrollingList::draw( unsigned int layer )
|
void ScrollingList::draw( unsigned int layer )
|
||||||
{
|
{
|
||||||
|
|
||||||
if ( components_.size( ) == 0 ) return;
|
if ( components_.size( ) == 0 ) return;
|
||||||
|
|
||||||
for ( unsigned int i = 0; i < components_.size( ); ++i )
|
for ( unsigned int i = 0; i < components_.size( ); ++i )
|
||||||
@ -737,8 +752,21 @@ bool ScrollingList::isIdle( )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool ScrollingList::getScrollDirectionForward( )
|
||||||
|
{
|
||||||
|
return scrollDirectionForward_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
float ScrollingList::getScrollPeriod( )
|
||||||
|
{
|
||||||
|
return scrollPeriod_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void ScrollingList::resetScrollPeriod( )
|
void ScrollingList::resetScrollPeriod( )
|
||||||
{
|
{
|
||||||
|
scrollAccelerationIdx_ = 0;
|
||||||
scrollPeriod_ = startScrollTime_;
|
scrollPeriod_ = startScrollTime_;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -746,11 +774,40 @@ void ScrollingList::resetScrollPeriod( )
|
|||||||
|
|
||||||
void ScrollingList::updateScrollPeriod( )
|
void ScrollingList::updateScrollPeriod( )
|
||||||
{
|
{
|
||||||
|
//printf("update Scroll Period: %d\n", scrollAccelerationIdx_);
|
||||||
scrollPeriod_ -= scrollAcceleration_;
|
scrollPeriod_ -= scrollAcceleration_;
|
||||||
if ( scrollPeriod_ < scrollAcceleration_ )
|
if ( scrollPeriod_ < scrollAcceleration_ )
|
||||||
{
|
{
|
||||||
|
//printf(" Very fast scroll\n");
|
||||||
scrollPeriod_ = scrollAcceleration_;
|
scrollPeriod_ = scrollAcceleration_;
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
scrollAccelerationIdx_++;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
/* Send fast scroll event if long press detected */
|
||||||
|
if(scrollAccelerationIdx_ >= 2){
|
||||||
|
for ( unsigned int i = 0; i < scrollPoints_->size( ); i++ )
|
||||||
|
{
|
||||||
|
unsigned int nextI;
|
||||||
|
if ( scrollDirectionForward_ )
|
||||||
|
{
|
||||||
|
nextI = loopDecrement( i, 1, scrollPoints_->size( ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nextI = loopIncrement( i, 1, scrollPoints_->size( ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
Component *c = components_.at( i );
|
||||||
|
|
||||||
|
resetTweens( c, tweenPoints_->at( nextI ), scrollPoints_->at( i ), scrollPoints_->at( nextI ), scrollPeriod_ );
|
||||||
|
c->baseViewInfo.font = scrollPoints_->at( nextI )->font; // Use the font settings of the next index
|
||||||
|
c->triggerEvent( "menuFastScroll" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -763,6 +820,7 @@ void ScrollingList::scroll( bool forward )
|
|||||||
// Replace the item that's scrolled out
|
// Replace the item that's scrolled out
|
||||||
if ( forward )
|
if ( forward )
|
||||||
{
|
{
|
||||||
|
scrollDirectionForward_ = true;
|
||||||
Item *i = items_->at( loopIncrement( itemIndex_, scrollPoints_->size( ), items_->size( ) ) );
|
Item *i = items_->at( loopIncrement( itemIndex_, scrollPoints_->size( ), items_->size( ) ) );
|
||||||
itemIndex_ = loopIncrement( itemIndex_, 1, items_->size( ) );
|
itemIndex_ = loopIncrement( itemIndex_, 1, items_->size( ) );
|
||||||
deallocateTexture( 0 );
|
deallocateTexture( 0 );
|
||||||
@ -770,6 +828,7 @@ void ScrollingList::scroll( bool forward )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
scrollDirectionForward_ = false;
|
||||||
Item *i = items_->at( loopDecrement( itemIndex_, 1, items_->size( ) ) );
|
Item *i = items_->at( loopDecrement( itemIndex_, 1, items_->size( ) ) );
|
||||||
itemIndex_ = loopDecrement( itemIndex_, 1, items_->size( ) );
|
itemIndex_ = loopDecrement( itemIndex_, 1, items_->size( ) );
|
||||||
deallocateTexture( loopDecrement( 0, 1, components_.size( ) ) );
|
deallocateTexture( loopDecrement( 0, 1, components_.size( ) ) );
|
||||||
@ -806,7 +865,7 @@ void ScrollingList::scroll( bool forward )
|
|||||||
Component *store = components_.at( prevI );
|
Component *store = components_.at( prevI );
|
||||||
components_[prevI] = c;
|
components_[prevI] = c;
|
||||||
c = store;
|
c = store;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -817,7 +876,7 @@ void ScrollingList::scroll( bool forward )
|
|||||||
Component *store = components_.at( nextI );
|
Component *store = components_.at( nextI );
|
||||||
components_[nextI] = c;
|
components_[nextI] = c;
|
||||||
c = store;
|
c = store;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -73,6 +73,8 @@ public:
|
|||||||
void letterChange( bool increment );
|
void letterChange( bool increment );
|
||||||
void random( );
|
void random( );
|
||||||
bool isIdle( );
|
bool isIdle( );
|
||||||
|
bool getScrollDirectionForward( );
|
||||||
|
float getScrollPeriod( );
|
||||||
unsigned int getScrollOffsetIndex( );
|
unsigned int getScrollOffsetIndex( );
|
||||||
void setScrollOffsetIndex( unsigned int index );
|
void setScrollOffsetIndex( unsigned int index );
|
||||||
void setSelectedIndex( int selectedIndex );
|
void setSelectedIndex( int selectedIndex );
|
||||||
@ -110,6 +112,7 @@ private:
|
|||||||
float scrollAcceleration_;
|
float scrollAcceleration_;
|
||||||
float startScrollTime_;
|
float startScrollTime_;
|
||||||
float scrollPeriod_;
|
float scrollPeriod_;
|
||||||
|
int scrollAccelerationIdx_;
|
||||||
|
|
||||||
Configuration &config_;
|
Configuration &config_;
|
||||||
float scaleX_;
|
float scaleX_;
|
||||||
@ -121,4 +124,5 @@ private:
|
|||||||
std::vector<Item *> *items_;
|
std::vector<Item *> *items_;
|
||||||
std::vector<Component *> components_;
|
std::vector<Component *> components_;
|
||||||
|
|
||||||
|
bool scrollDirectionForward_;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -107,18 +107,22 @@ void Text::draw( )
|
|||||||
Font::GlyphInfo glyph;
|
Font::GlyphInfo glyph;
|
||||||
if ( font->getRect( textData_[i], glyph ) )
|
if ( font->getRect( textData_[i], glyph ) )
|
||||||
{
|
{
|
||||||
|
SDL_Rect charRect = glyph.rect;
|
||||||
|
//charRect.w = static_cast<int>( glyph.advance );
|
||||||
|
charRect.w = static_cast<int>( glyph.rect.w?glyph.rect.w:glyph.advance );
|
||||||
|
|
||||||
if ( glyph.minX < 0 )
|
if ( glyph.minX < 0 )
|
||||||
{
|
{
|
||||||
imageWidth += glyph.minX;
|
imageWidth += glyph.minX;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (imageWidth + glyph.advance)*scale > imageMaxWidth )
|
if ( (imageWidth + charRect.w)*scale > imageMaxWidth )
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
textIndexMax = i;
|
textIndexMax = i;
|
||||||
imageWidth += glyph.advance;
|
imageWidth += charRect.w;
|
||||||
|
|
||||||
/*printf("textData_[%d]=%c, glyph.advance= %f - %d\n", i, textData_[i], glyph.advance, glyph.advance);
|
/*printf("textData_[%d]=%c, glyph.advance= %f - %d\n", i, textData_[i], glyph.advance, glyph.advance);
|
||||||
printf("imageWidth=%f \n", imageWidth);*/
|
printf("imageWidth=%f \n", imageWidth);*/
|
||||||
@ -163,7 +167,7 @@ void Text::draw( )
|
|||||||
{
|
{
|
||||||
SDL_Rect charRect = glyph.rect;
|
SDL_Rect charRect = glyph.rect;
|
||||||
float h = static_cast<float>( charRect.h * scale );
|
float h = static_cast<float>( charRect.h * scale );
|
||||||
float w = static_cast<float>( charRect.w * scale );
|
float w = static_cast<float>( (charRect.w?charRect.w:glyph.advance) * scale );
|
||||||
rect.h = static_cast<int>( h );
|
rect.h = static_cast<int>( h );
|
||||||
rect.w = static_cast<int>( w );
|
rect.w = static_cast<int>( w );
|
||||||
rect.y = static_cast<int>( yOrigin );
|
rect.y = static_cast<int>( yOrigin );
|
||||||
@ -182,8 +186,7 @@ void Text::draw( )
|
|||||||
|
|
||||||
SDL::renderCopy( t, baseViewInfo.Alpha, &charRect, &rect, baseViewInfo );
|
SDL::renderCopy( t, baseViewInfo.Alpha, &charRect, &rect, baseViewInfo );
|
||||||
|
|
||||||
rect.x += static_cast<int>( glyph.advance * scale );
|
rect.x += rect.w;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,7 +32,9 @@ Page::Page(Configuration &config)
|
|||||||
: config_(config)
|
: config_(config)
|
||||||
, menuDepth_(0)
|
, menuDepth_(0)
|
||||||
, scrollActive_(false)
|
, scrollActive_(false)
|
||||||
|
, scrollDirectionForward_(false)
|
||||||
, selectedItem_(NULL)
|
, selectedItem_(NULL)
|
||||||
|
, selectNextItemAfterScroll_(false)
|
||||||
, textStatusComponent_(NULL)
|
, textStatusComponent_(NULL)
|
||||||
, loadSoundChunk_(NULL)
|
, loadSoundChunk_(NULL)
|
||||||
, unloadSoundChunk_(NULL)
|
, unloadSoundChunk_(NULL)
|
||||||
@ -166,14 +168,17 @@ void Page::onNewItemSelected()
|
|||||||
|
|
||||||
void Page::onNewScrollItemSelected()
|
void Page::onNewScrollItemSelected()
|
||||||
{
|
{
|
||||||
if(!(activeMenu_.size() > 0 && activeMenu_[0])) return;
|
if(selectNextItemAfterScroll_){
|
||||||
selectedItem_ = activeMenu_[0]->getSelectedItem();
|
if(!(activeMenu_.size() > 0 && activeMenu_[0])) return;
|
||||||
|
selectedItem_ = activeMenu_[0]->getSelectedItem();
|
||||||
|
|
||||||
for(std::vector<Component *>::iterator it = LayerComponents.begin(); it != LayerComponents.end(); ++it)
|
for(std::vector<Component *>::iterator it = LayerComponents.begin(); it != LayerComponents.end(); ++it)
|
||||||
{
|
{
|
||||||
(*it)->setNewScrollItemSelected();
|
(*it)->setNewScrollItemSelected();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
selectNextItemAfterScroll_ = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -434,6 +439,19 @@ void Page::menuScroll()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Page::menuFastScroll()
|
||||||
|
{
|
||||||
|
Item *item = selectedItem_;
|
||||||
|
|
||||||
|
if(!item) return;
|
||||||
|
|
||||||
|
for(std::vector<Component *>::iterator it = LayerComponents.begin(); it != LayerComponents.end(); ++it)
|
||||||
|
{
|
||||||
|
(*it)->triggerEvent( "menuFastScroll", menuDepth_ - 1 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Page::highlightEnter()
|
void Page::highlightEnter()
|
||||||
{
|
{
|
||||||
Item *item = selectedItem_;
|
Item *item = selectedItem_;
|
||||||
@ -647,14 +665,22 @@ void Page::setScrolling(ScrollDirection direction)
|
|||||||
{
|
{
|
||||||
menuScroll();
|
menuScroll();
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
menuFastScroll();
|
||||||
|
}
|
||||||
scrollActive_ = true;
|
scrollActive_ = true;
|
||||||
|
scrollDirectionForward_=true;
|
||||||
break;
|
break;
|
||||||
case ScrollDirectionBack:
|
case ScrollDirectionBack:
|
||||||
if(!scrollActive_)
|
if(!scrollActive_)
|
||||||
{
|
{
|
||||||
menuScroll();
|
menuScroll();
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
menuFastScroll();
|
||||||
|
}
|
||||||
scrollActive_ = true;
|
scrollActive_ = true;
|
||||||
|
scrollDirectionForward_=false;
|
||||||
break;
|
break;
|
||||||
case ScrollDirectionIdle:
|
case ScrollDirectionIdle:
|
||||||
default:
|
default:
|
||||||
@ -1293,6 +1319,11 @@ bool Page::isMenuScrolling()
|
|||||||
return scrollActive_;
|
return scrollActive_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Page::isMenuScrollForward()
|
||||||
|
{
|
||||||
|
return scrollDirectionForward_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Page::isPlaying()
|
bool Page::isPlaying()
|
||||||
{
|
{
|
||||||
@ -1320,6 +1351,17 @@ void Page::resetScrollPeriod()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
float Page::getScrollPeriod()
|
||||||
|
{
|
||||||
|
for(std::vector<ScrollingList *>::iterator it = activeMenu_.begin(); it != activeMenu_.end(); it++)
|
||||||
|
{
|
||||||
|
ScrollingList *menu = *it;
|
||||||
|
if(menu) return menu->getScrollPeriod();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Page::updateScrollPeriod()
|
void Page::updateScrollPeriod()
|
||||||
{
|
{
|
||||||
for(std::vector<ScrollingList *>::iterator it = activeMenu_.begin(); it != activeMenu_.end(); it++)
|
for(std::vector<ScrollingList *>::iterator it = activeMenu_.begin(); it != activeMenu_.end(); it++)
|
||||||
@ -1333,6 +1375,14 @@ void Page::updateScrollPeriod()
|
|||||||
|
|
||||||
void Page::scroll(bool forward)
|
void Page::scroll(bool forward)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// Select next item
|
||||||
|
onNewScrollItemSelected();
|
||||||
|
|
||||||
|
// Set flag for notifying a new selected item after next update()
|
||||||
|
selectNextItemAfterScroll_ = true;
|
||||||
|
|
||||||
|
// Change scroll index
|
||||||
for(std::vector<ScrollingList *>::iterator it = activeMenu_.begin(); it != activeMenu_.end(); it++)
|
for(std::vector<ScrollingList *>::iterator it = activeMenu_.begin(); it != activeMenu_.end(); it++)
|
||||||
{
|
{
|
||||||
ScrollingList *menu = *it;
|
ScrollingList *menu = *it;
|
||||||
@ -1341,7 +1391,7 @@ void Page::scroll(bool forward)
|
|||||||
menu->scroll(forward);
|
menu->scroll(forward);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onNewScrollItemSelected();
|
|
||||||
if(highlightSoundChunk_)
|
if(highlightSoundChunk_)
|
||||||
{
|
{
|
||||||
highlightSoundChunk_->play();
|
highlightSoundChunk_->play();
|
||||||
|
|||||||
@ -97,6 +97,7 @@ public:
|
|||||||
void setMinShowTime(float value);
|
void setMinShowTime(float value);
|
||||||
float getMinShowTime();
|
float getMinShowTime();
|
||||||
void menuScroll();
|
void menuScroll();
|
||||||
|
void menuFastScroll();
|
||||||
void highlightEnter();
|
void highlightEnter();
|
||||||
void highlightExit();
|
void highlightExit();
|
||||||
void playlistEnter();
|
void playlistEnter();
|
||||||
@ -109,8 +110,10 @@ public:
|
|||||||
void removePlaylist();
|
void removePlaylist();
|
||||||
void reallocateMenuSpritePoints();
|
void reallocateMenuSpritePoints();
|
||||||
bool isMenuScrolling();
|
bool isMenuScrolling();
|
||||||
|
bool isMenuScrollForward();
|
||||||
bool isPlaying();
|
bool isPlaying();
|
||||||
void resetScrollPeriod();
|
void resetScrollPeriod();
|
||||||
|
float getScrollPeriod();
|
||||||
void updateScrollPeriod();
|
void updateScrollPeriod();
|
||||||
void scroll(bool forward);
|
void scroll(bool forward);
|
||||||
|
|
||||||
@ -141,6 +144,8 @@ private:
|
|||||||
std::list<CollectionInfo *> deleteCollectionList_;
|
std::list<CollectionInfo *> deleteCollectionList_;
|
||||||
|
|
||||||
bool scrollActive_;
|
bool scrollActive_;
|
||||||
|
bool scrollDirectionForward_;
|
||||||
|
bool selectNextItemAfterScroll_;
|
||||||
|
|
||||||
Item *selectedItem_;
|
Item *selectedItem_;
|
||||||
Text *textStatusComponent_;
|
Text *textStatusComponent_;
|
||||||
|
|||||||
@ -351,7 +351,9 @@ float PageBuilder::getVerticalAlignment(xml_attribute<> *attribute, float valueI
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
//printf(" Utils::convertFloat(str)=%f, scaleY_=%f\n", Utils::convertFloat(str), scaleY_);
|
||||||
value = Utils::convertFloat(str) * scaleY_;
|
value = Utils::convertFloat(str) * scaleY_;
|
||||||
|
//printf(" value=%f\n", value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
@ -658,7 +660,7 @@ void PageBuilder::loadReloadableImages(xml_node<> *layout, std::string tagName,
|
|||||||
{
|
{
|
||||||
pluralPostfix = pluralPostfixXml->value();
|
pluralPostfix = pluralPostfixXml->value();
|
||||||
}
|
}
|
||||||
c = new ReloadableText(type->value(), *page, config_, font, layoutKey, timeFormat, textFormat, singlePrefix, singlePostfix, pluralPrefix, pluralPostfix, scaleX_, scaleY_);
|
c = new ReloadableText(type->value(), *page, config_, font, layoutKey, timeFormat, textFormat, singlePrefix, singlePostfix, pluralPrefix, pluralPostfix, selectedOffset, scaleX_, scaleY_);
|
||||||
c->setId( id );
|
c->setId( id );
|
||||||
xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload");
|
xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload");
|
||||||
if (menuScrollReload &&
|
if (menuScrollReload &&
|
||||||
@ -739,7 +741,6 @@ void PageBuilder::loadReloadableImages(xml_node<> *layout, std::string tagName,
|
|||||||
{
|
{
|
||||||
c->setMenuScrollReload(true);
|
c->setMenuScrollReload(true);
|
||||||
}
|
}
|
||||||
c->allocateGraphicsMemory( );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -754,6 +755,24 @@ void PageBuilder::loadReloadableImages(xml_node<> *layout, std::string tagName,
|
|||||||
{
|
{
|
||||||
c->setMenuScrollReload(true);
|
c->setMenuScrollReload(true);
|
||||||
}
|
}
|
||||||
|
xml_attribute<> *imageAndText = componentXml->first_attribute("imageAndText");
|
||||||
|
if(imageAndText && Utils::toLower(imageAndText->value()) == "true")
|
||||||
|
{
|
||||||
|
static_cast<ReloadableMedia *>(c)->enableImageAndText_(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
static_cast<ReloadableMedia *>(c)->enableImageAndText_(false);
|
||||||
|
}
|
||||||
|
xml_attribute<> *imageAndTextPadding = componentXml->first_attribute("imageAndTextPadding");
|
||||||
|
if(imageAndTextPadding)
|
||||||
|
{
|
||||||
|
static_cast<ReloadableMedia *>(c)->setImageAndTextPadding_( Utils::convertFloat(imageAndTextPadding->value()) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
static_cast<ReloadableMedia *>(c)->enableImageAndText_(false);
|
||||||
|
}
|
||||||
xml_attribute<> *textFallback = componentXml->first_attribute("textFallback");
|
xml_attribute<> *textFallback = componentXml->first_attribute("textFallback");
|
||||||
if(textFallback && Utils::toLower(textFallback->value()) == "true")
|
if(textFallback && Utils::toLower(textFallback->value()) == "true")
|
||||||
{
|
{
|
||||||
@ -763,6 +782,15 @@ void PageBuilder::loadReloadableImages(xml_node<> *layout, std::string tagName,
|
|||||||
{
|
{
|
||||||
static_cast<ReloadableMedia *>(c)->enableTextFallback_(false);
|
static_cast<ReloadableMedia *>(c)->enableTextFallback_(false);
|
||||||
}
|
}
|
||||||
|
xml_attribute<> *imageFallback = componentXml->first_attribute("imageFallback");
|
||||||
|
if(imageFallback && Utils::toLower(imageFallback->value()) == "true")
|
||||||
|
{
|
||||||
|
static_cast<ReloadableMedia *>(c)->enableImageFallback_(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
static_cast<ReloadableMedia *>(c)->enableImageFallback_(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(c)
|
if(c)
|
||||||
@ -852,6 +880,7 @@ AnimationEvents *PageBuilder::createTweenInstance(xml_node<> *componentXml)
|
|||||||
buildTweenSet(tweens, componentXml, "onIdle", "idle");
|
buildTweenSet(tweens, componentXml, "onIdle", "idle");
|
||||||
buildTweenSet(tweens, componentXml, "onMenuIdle", "menuIdle");
|
buildTweenSet(tweens, componentXml, "onMenuIdle", "menuIdle");
|
||||||
buildTweenSet(tweens, componentXml, "onMenuScroll", "menuScroll");
|
buildTweenSet(tweens, componentXml, "onMenuScroll", "menuScroll");
|
||||||
|
buildTweenSet(tweens, componentXml, "onMenuFastScroll", "menuFastScroll");
|
||||||
buildTweenSet(tweens, componentXml, "onHighlightEnter", "highlightEnter");
|
buildTweenSet(tweens, componentXml, "onHighlightEnter", "highlightEnter");
|
||||||
buildTweenSet(tweens, componentXml, "onHighlightExit", "highlightExit");
|
buildTweenSet(tweens, componentXml, "onHighlightExit", "highlightExit");
|
||||||
buildTweenSet(tweens, componentXml, "onMenuEnter", "menuEnter");
|
buildTweenSet(tweens, componentXml, "onMenuEnter", "menuEnter");
|
||||||
@ -1385,7 +1414,8 @@ void PageBuilder::getAnimationEvents(xml_node<> *node, TweenSet &tweens)
|
|||||||
{
|
{
|
||||||
toValue = Utils::convertFloat(to->value());
|
toValue = Utils::convertFloat(to->value());
|
||||||
}
|
}
|
||||||
float durationValue = Utils::convertFloat(durationXml->value());
|
float durationValue = 0;
|
||||||
|
durationValue = Utils::convertFloat(durationXml->value());
|
||||||
|
|
||||||
TweenAlgorithm algorithm = LINEAR;
|
TweenAlgorithm algorithm = LINEAR;
|
||||||
TweenProperty property;
|
TweenProperty property;
|
||||||
@ -1425,6 +1455,11 @@ void PageBuilder::getAnimationEvents(xml_node<> *node, TweenSet &tweens)
|
|||||||
toValue = getVerticalAlignment(to, 0);
|
toValue = getVerticalAlignment(to, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case TWEEN_PROPERTY_Y_SHIFT_MENU_DIRECTION:
|
||||||
|
fromValue = getVerticalAlignment(from, 0);
|
||||||
|
toValue = getVerticalAlignment(to, 0);
|
||||||
|
break;
|
||||||
|
|
||||||
// y origin gets translated to a percent
|
// y origin gets translated to a percent
|
||||||
case TWEEN_PROPERTY_Y_ORIGIN:
|
case TWEEN_PROPERTY_Y_ORIGIN:
|
||||||
fromValue = getVerticalAlignment(from, 0) / screenHeight_;
|
fromValue = getVerticalAlignment(from, 0) / screenHeight_;
|
||||||
@ -1433,8 +1468,9 @@ void PageBuilder::getAnimationEvents(xml_node<> *node, TweenSet &tweens)
|
|||||||
|
|
||||||
case TWEEN_PROPERTY_MAX_WIDTH:
|
case TWEEN_PROPERTY_MAX_WIDTH:
|
||||||
case TWEEN_PROPERTY_MAX_HEIGHT:
|
case TWEEN_PROPERTY_MAX_HEIGHT:
|
||||||
fromValue = getVerticalAlignment(from, FLT_MAX);
|
fromValue = getVerticalAlignment(from, FLT_MAX);
|
||||||
toValue = getVerticalAlignment(to, FLT_MAX);
|
toValue = getVerticalAlignment(to, FLT_MAX);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -625,6 +625,7 @@ void RetroFE::run( )
|
|||||||
// Start onHighlightEnter animation
|
// Start onHighlightEnter animation
|
||||||
case RETROFE_HIGHLIGHT_LOAD_ART:
|
case RETROFE_HIGHLIGHT_LOAD_ART:
|
||||||
currentPage_->highlightEnter( );
|
currentPage_->highlightEnter( );
|
||||||
|
currentPage_->onNewScrollItemSelected( );
|
||||||
state = RETROFE_HIGHLIGHT_ENTER;
|
state = RETROFE_HIGHLIGHT_ENTER;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user