mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2025-12-12 09:48:51 +01:00
Changed lack of SDL audio from error to warning.
Additional updates for the menu structure; still WIP.
This commit is contained in:
parent
92c4e28cf5
commit
1659a3d067
@ -27,6 +27,7 @@ Component::Component(Page &p)
|
||||
backgroundTexture_ = NULL;
|
||||
menuScrollReload_ = false;
|
||||
freeGraphicsMemory();
|
||||
id_ = -1;
|
||||
}
|
||||
|
||||
Component::Component(const Component ©)
|
||||
@ -116,12 +117,17 @@ void Component::setPlaylist(std::string name)
|
||||
|
||||
void Component::setNewItemSelected()
|
||||
{
|
||||
newItemSelected = true;
|
||||
newItemSelected = true;
|
||||
}
|
||||
|
||||
void Component::setNewScrollItemSelected()
|
||||
{
|
||||
newScrollItemSelected = true;
|
||||
newScrollItemSelected = true;
|
||||
}
|
||||
|
||||
void Component::setId( int id )
|
||||
{
|
||||
id_ = id;
|
||||
}
|
||||
|
||||
bool Component::isIdle()
|
||||
@ -417,3 +423,8 @@ bool Component::getMenuScrollReload()
|
||||
{
|
||||
return menuScrollReload_;
|
||||
}
|
||||
|
||||
int Component::getId( )
|
||||
{
|
||||
return id_;
|
||||
}
|
||||
|
||||
@ -41,6 +41,7 @@ public:
|
||||
bool isMenuScrolling();
|
||||
bool newItemSelected;
|
||||
bool newScrollItemSelected;
|
||||
void setId( int id );
|
||||
|
||||
virtual void update(float dt);
|
||||
virtual void draw();
|
||||
@ -50,12 +51,15 @@ public:
|
||||
std::string collectionName;
|
||||
void setMenuScrollReload(bool menuScrollReload);
|
||||
bool getMenuScrollReload();
|
||||
virtual void setInput(std::string text) {};
|
||||
virtual void setText(std::string text, int id = -1) {};
|
||||
virtual void setImage(std::string filePath, int id = -1) {};
|
||||
int getId( );
|
||||
|
||||
protected:
|
||||
Page &page;
|
||||
|
||||
std::string playlistName;
|
||||
|
||||
private:
|
||||
|
||||
bool animate();
|
||||
@ -74,4 +78,5 @@ private:
|
||||
bool animationRequested_;
|
||||
bool menuScrollReload_;
|
||||
int menuIndex_;
|
||||
int id_;
|
||||
};
|
||||
|
||||
@ -22,13 +22,12 @@
|
||||
#include <sstream>
|
||||
|
||||
|
||||
Text::Text( std::string text, Page &p, Font *font, float scaleX, float scaleY, bool input )
|
||||
Text::Text( std::string text, Page &p, Font *font, float scaleX, float scaleY )
|
||||
: Component(p)
|
||||
, textData_(text)
|
||||
, fontInst_(font)
|
||||
, scaleX_(scaleX)
|
||||
, scaleY_(scaleY)
|
||||
, input_(input)
|
||||
{
|
||||
allocateGraphicsMemory( );
|
||||
}
|
||||
@ -58,14 +57,9 @@ void Text::initializeFonts( )
|
||||
fontInst_->initialize( );
|
||||
}
|
||||
|
||||
void Text::setText( std::string text )
|
||||
void Text::setText( std::string text, int id )
|
||||
{
|
||||
textData_ = text;
|
||||
}
|
||||
|
||||
void Text::setInput( std::string text )
|
||||
{
|
||||
if ( input_ )
|
||||
if ( getId( ) == id )
|
||||
textData_ = text;
|
||||
}
|
||||
|
||||
|
||||
@ -29,10 +29,9 @@ class Text : public Component
|
||||
{
|
||||
|
||||
public:
|
||||
Text( std::string text, Page &p, Font *font, float scaleX, float scaleY, bool input = false );
|
||||
Text( std::string text, Page &p, Font *font, float scaleX, float scaleY );
|
||||
virtual ~Text( );
|
||||
void setText( std::string text );
|
||||
void setInput( std::string text );
|
||||
void setText( std::string text, int id = -1 );
|
||||
void allocateGraphicsMemory( );
|
||||
void freeGraphicsMemory( );
|
||||
void deInitializeFonts( );
|
||||
@ -44,5 +43,4 @@ private:
|
||||
Font *fontInst_;
|
||||
float scaleX_;
|
||||
float scaleY_;
|
||||
bool input_;
|
||||
};
|
||||
|
||||
@ -483,7 +483,7 @@ void Page::highlightExit()
|
||||
}
|
||||
|
||||
|
||||
void Page::menuAction( std::string action )
|
||||
void Page::triggerEvent( std::string action )
|
||||
{
|
||||
for(std::vector<Component *>::iterator it = LayerComponents.begin(); it != LayerComponents.end(); ++it)
|
||||
{
|
||||
@ -492,11 +492,11 @@ void Page::menuAction( std::string action )
|
||||
}
|
||||
|
||||
|
||||
void Page::menuInput( std::string text )
|
||||
void Page::setText( std::string text, int id )
|
||||
{
|
||||
for(std::vector<Component *>::iterator it = LayerComponents.begin(); it != LayerComponents.end(); ++it)
|
||||
{
|
||||
(*it)->setInput( text );
|
||||
(*it)->setText( text, id );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -98,8 +98,8 @@ public:
|
||||
void menuScroll();
|
||||
void highlightEnter();
|
||||
void highlightExit();
|
||||
void menuAction( std::string action );
|
||||
void menuInput( std::string text );
|
||||
void triggerEvent( std::string action );
|
||||
void setText( std::string text, int id );
|
||||
void addPlaylist();
|
||||
void removePlaylist();
|
||||
void reallocateMenuSpritePoints();
|
||||
|
||||
@ -388,7 +388,14 @@ bool PageBuilder::buildComponents(xml_node<> *layout, Page *page)
|
||||
|
||||
for(xml_node<> *componentXml = layout->first_node("image"); componentXml; componentXml = componentXml->next_sibling("image"))
|
||||
{
|
||||
xml_attribute<> *src = componentXml->first_attribute("src");
|
||||
xml_attribute<> *src = componentXml->first_attribute("src");
|
||||
xml_attribute<> *idXml = componentXml->first_attribute("id");
|
||||
|
||||
int id = -1;
|
||||
if (idXml)
|
||||
{
|
||||
id = Utils::convertInt(idXml->value());
|
||||
}
|
||||
|
||||
if (!src)
|
||||
{
|
||||
@ -404,6 +411,7 @@ bool PageBuilder::buildComponents(xml_node<> *layout, Page *page)
|
||||
altImagePath = Utils::combinePath(Configuration::absolutePath, "layouts", layoutName, std::string(src->value()));
|
||||
|
||||
Image *c = new Image(imagePath, altImagePath, *page, scaleX_, scaleY_);
|
||||
c->setId( id );
|
||||
xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload");
|
||||
if (menuScrollReload &&
|
||||
(Utils::toLower(menuScrollReload->value()) == "true" ||
|
||||
@ -422,6 +430,13 @@ bool PageBuilder::buildComponents(xml_node<> *layout, Page *page)
|
||||
{
|
||||
xml_attribute<> *srcXml = componentXml->first_attribute("src");
|
||||
xml_attribute<> *numLoopsXml = componentXml->first_attribute("numLoops");
|
||||
xml_attribute<> *idXml = componentXml->first_attribute("id");
|
||||
|
||||
int id = -1;
|
||||
if (idXml)
|
||||
{
|
||||
id = Utils::convertInt(idXml->value());
|
||||
}
|
||||
|
||||
if (!srcXml)
|
||||
{
|
||||
@ -438,6 +453,7 @@ bool PageBuilder::buildComponents(xml_node<> *layout, Page *page)
|
||||
int numLoops = numLoopsXml ? Utils::convertInt(numLoopsXml->value()) : 1;
|
||||
|
||||
Video *c = new Video(videoPath, altVideoPath, numLoops, *page, scaleX_, scaleY_);
|
||||
c->setId( id );
|
||||
xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload");
|
||||
if (menuScrollReload &&
|
||||
(Utils::toLower(menuScrollReload->value()) == "true" ||
|
||||
@ -455,6 +471,13 @@ bool PageBuilder::buildComponents(xml_node<> *layout, Page *page)
|
||||
for(xml_node<> *componentXml = layout->first_node("text"); componentXml; componentXml = componentXml->next_sibling("text"))
|
||||
{
|
||||
xml_attribute<> *value = componentXml->first_attribute("value");
|
||||
xml_attribute<> *idXml = componentXml->first_attribute("id");
|
||||
|
||||
int id = -1;
|
||||
if (idXml)
|
||||
{
|
||||
id = Utils::convertInt(idXml->value());
|
||||
}
|
||||
|
||||
if (!value)
|
||||
{
|
||||
@ -464,6 +487,7 @@ bool PageBuilder::buildComponents(xml_node<> *layout, Page *page)
|
||||
{
|
||||
Font *font = addFont(componentXml, NULL);
|
||||
Text *c = new Text(value->value(), *page, font, scaleX_, scaleY_);
|
||||
c->setId( id );
|
||||
xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload");
|
||||
if (menuScrollReload &&
|
||||
(Utils::toLower(menuScrollReload->value()) == "true" ||
|
||||
@ -525,11 +549,19 @@ void PageBuilder::loadReloadableImages(xml_node<> *layout, std::string tagName,
|
||||
xml_attribute<> *startTimeXml = componentXml->first_attribute("startTime");
|
||||
xml_attribute<> *endTimeXml = componentXml->first_attribute("endTime");
|
||||
xml_attribute<> *alignmentXml = componentXml->first_attribute("alignment");
|
||||
xml_attribute<> *idXml = componentXml->first_attribute("id");
|
||||
bool systemMode = false;
|
||||
bool layoutMode = false;
|
||||
bool commonMode = false;
|
||||
bool menuMode = false;
|
||||
int selectedOffset = 0;
|
||||
|
||||
int id = -1;
|
||||
if (idXml)
|
||||
{
|
||||
id = Utils::convertInt(idXml->value());
|
||||
}
|
||||
|
||||
if(tagName == "reloadableVideo")
|
||||
{
|
||||
type = componentXml->first_attribute("imageType");
|
||||
@ -627,6 +659,7 @@ void PageBuilder::loadReloadableImages(xml_node<> *layout, std::string tagName,
|
||||
pluralPostfix = pluralPostfixXml->value();
|
||||
}
|
||||
c = new ReloadableText(type->value(), *page, config_, font, layoutKey, timeFormat, textFormat, singlePrefix, singlePostfix, pluralPrefix, pluralPostfix, scaleX_, scaleY_);
|
||||
c->setId( id );
|
||||
xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload");
|
||||
if (menuScrollReload &&
|
||||
(Utils::toLower(menuScrollReload->value()) == "true" ||
|
||||
@ -676,6 +709,7 @@ void PageBuilder::loadReloadableImages(xml_node<> *layout, std::string tagName,
|
||||
{
|
||||
alignment = alignmentXml->value();
|
||||
}
|
||||
|
||||
std::string singlePrefix = "";
|
||||
if (singlePrefixXml)
|
||||
{
|
||||
@ -697,6 +731,7 @@ void PageBuilder::loadReloadableImages(xml_node<> *layout, std::string tagName,
|
||||
pluralPostfix = pluralPostfixXml->value();
|
||||
}
|
||||
c = new ReloadableScrollingText(config_, systemMode, layoutMode, menuMode, type->value(), singlePrefix, singlePostfix, pluralPrefix, pluralPostfix, textFormat, alignment, *page, selectedOffset, font, scaleX_, scaleY_, direction, scrollingSpeed, startPosition, startTime, endTime);
|
||||
c->setId( id );
|
||||
xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload");
|
||||
if (menuScrollReload &&
|
||||
(Utils::toLower(menuScrollReload->value()) == "true" ||
|
||||
@ -710,6 +745,7 @@ void PageBuilder::loadReloadableImages(xml_node<> *layout, std::string tagName,
|
||||
{
|
||||
Font *font = addFont(componentXml, NULL);
|
||||
c = new ReloadableMedia(config_, systemMode, layoutMode, commonMode, menuMode, type->value(), *page, selectedOffset, (tagName == "reloadableVideo"), font, scaleX_, scaleY_);
|
||||
c->setId( id );
|
||||
xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload");
|
||||
if (menuScrollReload &&
|
||||
(Utils::toLower(menuScrollReload->value()) == "true" ||
|
||||
|
||||
@ -205,12 +205,10 @@ bool SDL::initialize( Configuration &config )
|
||||
}
|
||||
}
|
||||
|
||||
//todo: specify in configuration file
|
||||
if ( retVal && Mix_OpenAudio( audioRate, audioFormat, audioChannels, audioBuffers ) == -1 )
|
||||
{
|
||||
std::string error = Mix_GetError( );
|
||||
Logger::write( Logger::ZONE_ERROR, "SDL", "Audio initialize failed: " + error );
|
||||
retVal = false;
|
||||
Logger::write( Logger::ZONE_WARNING, "SDL", "Audio initialize failed: " + error );
|
||||
}
|
||||
|
||||
return retVal;
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
std::string retrofe_version_major = "0";
|
||||
std::string retrofe_version_minor = "8";
|
||||
std::string retrofe_version_build = "15b3";
|
||||
std::string retrofe_version_build = "15b4";
|
||||
|
||||
|
||||
std::string Version::getString( )
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user