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;
|
backgroundTexture_ = NULL;
|
||||||
menuScrollReload_ = false;
|
menuScrollReload_ = false;
|
||||||
freeGraphicsMemory();
|
freeGraphicsMemory();
|
||||||
|
id_ = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Component::Component(const Component ©)
|
Component::Component(const Component ©)
|
||||||
@ -116,12 +117,17 @@ void Component::setPlaylist(std::string name)
|
|||||||
|
|
||||||
void Component::setNewItemSelected()
|
void Component::setNewItemSelected()
|
||||||
{
|
{
|
||||||
newItemSelected = true;
|
newItemSelected = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Component::setNewScrollItemSelected()
|
void Component::setNewScrollItemSelected()
|
||||||
{
|
{
|
||||||
newScrollItemSelected = true;
|
newScrollItemSelected = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Component::setId( int id )
|
||||||
|
{
|
||||||
|
id_ = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Component::isIdle()
|
bool Component::isIdle()
|
||||||
@ -417,3 +423,8 @@ bool Component::getMenuScrollReload()
|
|||||||
{
|
{
|
||||||
return menuScrollReload_;
|
return menuScrollReload_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Component::getId( )
|
||||||
|
{
|
||||||
|
return id_;
|
||||||
|
}
|
||||||
|
|||||||
@ -41,6 +41,7 @@ public:
|
|||||||
bool isMenuScrolling();
|
bool isMenuScrolling();
|
||||||
bool newItemSelected;
|
bool newItemSelected;
|
||||||
bool newScrollItemSelected;
|
bool newScrollItemSelected;
|
||||||
|
void setId( int id );
|
||||||
|
|
||||||
virtual void update(float dt);
|
virtual void update(float dt);
|
||||||
virtual void draw();
|
virtual void draw();
|
||||||
@ -50,12 +51,15 @@ public:
|
|||||||
std::string collectionName;
|
std::string collectionName;
|
||||||
void setMenuScrollReload(bool menuScrollReload);
|
void setMenuScrollReload(bool menuScrollReload);
|
||||||
bool getMenuScrollReload();
|
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:
|
protected:
|
||||||
Page &page;
|
Page &page;
|
||||||
|
|
||||||
std::string playlistName;
|
std::string playlistName;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
bool animate();
|
bool animate();
|
||||||
@ -74,4 +78,5 @@ private:
|
|||||||
bool animationRequested_;
|
bool animationRequested_;
|
||||||
bool menuScrollReload_;
|
bool menuScrollReload_;
|
||||||
int menuIndex_;
|
int menuIndex_;
|
||||||
|
int id_;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -22,13 +22,12 @@
|
|||||||
#include <sstream>
|
#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)
|
: Component(p)
|
||||||
, textData_(text)
|
, textData_(text)
|
||||||
, fontInst_(font)
|
, fontInst_(font)
|
||||||
, scaleX_(scaleX)
|
, scaleX_(scaleX)
|
||||||
, scaleY_(scaleY)
|
, scaleY_(scaleY)
|
||||||
, input_(input)
|
|
||||||
{
|
{
|
||||||
allocateGraphicsMemory( );
|
allocateGraphicsMemory( );
|
||||||
}
|
}
|
||||||
@ -58,14 +57,9 @@ void Text::initializeFonts( )
|
|||||||
fontInst_->initialize( );
|
fontInst_->initialize( );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Text::setText( std::string text )
|
void Text::setText( std::string text, int id )
|
||||||
{
|
{
|
||||||
textData_ = text;
|
if ( getId( ) == id )
|
||||||
}
|
|
||||||
|
|
||||||
void Text::setInput( std::string text )
|
|
||||||
{
|
|
||||||
if ( input_ )
|
|
||||||
textData_ = text;
|
textData_ = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -29,10 +29,9 @@ class Text : public Component
|
|||||||
{
|
{
|
||||||
|
|
||||||
public:
|
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( );
|
virtual ~Text( );
|
||||||
void setText( std::string text );
|
void setText( std::string text, int id = -1 );
|
||||||
void setInput( std::string text );
|
|
||||||
void allocateGraphicsMemory( );
|
void allocateGraphicsMemory( );
|
||||||
void freeGraphicsMemory( );
|
void freeGraphicsMemory( );
|
||||||
void deInitializeFonts( );
|
void deInitializeFonts( );
|
||||||
@ -44,5 +43,4 @@ private:
|
|||||||
Font *fontInst_;
|
Font *fontInst_;
|
||||||
float scaleX_;
|
float scaleX_;
|
||||||
float scaleY_;
|
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)
|
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)
|
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 menuScroll();
|
||||||
void highlightEnter();
|
void highlightEnter();
|
||||||
void highlightExit();
|
void highlightExit();
|
||||||
void menuAction( std::string action );
|
void triggerEvent( std::string action );
|
||||||
void menuInput( std::string text );
|
void setText( std::string text, int id );
|
||||||
void addPlaylist();
|
void addPlaylist();
|
||||||
void removePlaylist();
|
void removePlaylist();
|
||||||
void reallocateMenuSpritePoints();
|
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"))
|
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)
|
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()));
|
altImagePath = Utils::combinePath(Configuration::absolutePath, "layouts", layoutName, std::string(src->value()));
|
||||||
|
|
||||||
Image *c = new Image(imagePath, altImagePath, *page, scaleX_, scaleY_);
|
Image *c = new Image(imagePath, altImagePath, *page, scaleX_, scaleY_);
|
||||||
|
c->setId( id );
|
||||||
xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload");
|
xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload");
|
||||||
if (menuScrollReload &&
|
if (menuScrollReload &&
|
||||||
(Utils::toLower(menuScrollReload->value()) == "true" ||
|
(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<> *srcXml = componentXml->first_attribute("src");
|
||||||
xml_attribute<> *numLoopsXml = componentXml->first_attribute("numLoops");
|
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)
|
if (!srcXml)
|
||||||
{
|
{
|
||||||
@ -438,6 +453,7 @@ bool PageBuilder::buildComponents(xml_node<> *layout, Page *page)
|
|||||||
int numLoops = numLoopsXml ? Utils::convertInt(numLoopsXml->value()) : 1;
|
int numLoops = numLoopsXml ? Utils::convertInt(numLoopsXml->value()) : 1;
|
||||||
|
|
||||||
Video *c = new Video(videoPath, altVideoPath, numLoops, *page, scaleX_, scaleY_);
|
Video *c = new Video(videoPath, altVideoPath, numLoops, *page, scaleX_, scaleY_);
|
||||||
|
c->setId( id );
|
||||||
xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload");
|
xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload");
|
||||||
if (menuScrollReload &&
|
if (menuScrollReload &&
|
||||||
(Utils::toLower(menuScrollReload->value()) == "true" ||
|
(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"))
|
for(xml_node<> *componentXml = layout->first_node("text"); componentXml; componentXml = componentXml->next_sibling("text"))
|
||||||
{
|
{
|
||||||
xml_attribute<> *value = componentXml->first_attribute("value");
|
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)
|
if (!value)
|
||||||
{
|
{
|
||||||
@ -464,6 +487,7 @@ bool PageBuilder::buildComponents(xml_node<> *layout, Page *page)
|
|||||||
{
|
{
|
||||||
Font *font = addFont(componentXml, NULL);
|
Font *font = addFont(componentXml, NULL);
|
||||||
Text *c = new Text(value->value(), *page, font, scaleX_, scaleY_);
|
Text *c = new Text(value->value(), *page, font, scaleX_, scaleY_);
|
||||||
|
c->setId( id );
|
||||||
xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload");
|
xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload");
|
||||||
if (menuScrollReload &&
|
if (menuScrollReload &&
|
||||||
(Utils::toLower(menuScrollReload->value()) == "true" ||
|
(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<> *startTimeXml = componentXml->first_attribute("startTime");
|
||||||
xml_attribute<> *endTimeXml = componentXml->first_attribute("endTime");
|
xml_attribute<> *endTimeXml = componentXml->first_attribute("endTime");
|
||||||
xml_attribute<> *alignmentXml = componentXml->first_attribute("alignment");
|
xml_attribute<> *alignmentXml = componentXml->first_attribute("alignment");
|
||||||
|
xml_attribute<> *idXml = componentXml->first_attribute("id");
|
||||||
bool systemMode = false;
|
bool systemMode = false;
|
||||||
bool layoutMode = false;
|
bool layoutMode = false;
|
||||||
bool commonMode = false;
|
bool commonMode = false;
|
||||||
bool menuMode = false;
|
bool menuMode = false;
|
||||||
int selectedOffset = 0;
|
int selectedOffset = 0;
|
||||||
|
|
||||||
|
int id = -1;
|
||||||
|
if (idXml)
|
||||||
|
{
|
||||||
|
id = Utils::convertInt(idXml->value());
|
||||||
|
}
|
||||||
|
|
||||||
if(tagName == "reloadableVideo")
|
if(tagName == "reloadableVideo")
|
||||||
{
|
{
|
||||||
type = componentXml->first_attribute("imageType");
|
type = componentXml->first_attribute("imageType");
|
||||||
@ -627,6 +659,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, scaleX_, scaleY_);
|
||||||
|
c->setId( id );
|
||||||
xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload");
|
xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload");
|
||||||
if (menuScrollReload &&
|
if (menuScrollReload &&
|
||||||
(Utils::toLower(menuScrollReload->value()) == "true" ||
|
(Utils::toLower(menuScrollReload->value()) == "true" ||
|
||||||
@ -676,6 +709,7 @@ void PageBuilder::loadReloadableImages(xml_node<> *layout, std::string tagName,
|
|||||||
{
|
{
|
||||||
alignment = alignmentXml->value();
|
alignment = alignmentXml->value();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string singlePrefix = "";
|
std::string singlePrefix = "";
|
||||||
if (singlePrefixXml)
|
if (singlePrefixXml)
|
||||||
{
|
{
|
||||||
@ -697,6 +731,7 @@ void PageBuilder::loadReloadableImages(xml_node<> *layout, std::string tagName,
|
|||||||
pluralPostfix = pluralPostfixXml->value();
|
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 = 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");
|
xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload");
|
||||||
if (menuScrollReload &&
|
if (menuScrollReload &&
|
||||||
(Utils::toLower(menuScrollReload->value()) == "true" ||
|
(Utils::toLower(menuScrollReload->value()) == "true" ||
|
||||||
@ -710,6 +745,7 @@ void PageBuilder::loadReloadableImages(xml_node<> *layout, std::string tagName,
|
|||||||
{
|
{
|
||||||
Font *font = addFont(componentXml, NULL);
|
Font *font = addFont(componentXml, NULL);
|
||||||
c = new ReloadableMedia(config_, systemMode, layoutMode, commonMode, menuMode, type->value(), *page, selectedOffset, (tagName == "reloadableVideo"), font, scaleX_, scaleY_);
|
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");
|
xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload");
|
||||||
if (menuScrollReload &&
|
if (menuScrollReload &&
|
||||||
(Utils::toLower(menuScrollReload->value()) == "true" ||
|
(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 )
|
if ( retVal && Mix_OpenAudio( audioRate, audioFormat, audioChannels, audioBuffers ) == -1 )
|
||||||
{
|
{
|
||||||
std::string error = Mix_GetError( );
|
std::string error = Mix_GetError( );
|
||||||
Logger::write( Logger::ZONE_ERROR, "SDL", "Audio initialize failed: " + error );
|
Logger::write( Logger::ZONE_WARNING, "SDL", "Audio initialize failed: " + error );
|
||||||
retVal = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return retVal;
|
return retVal;
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
std::string retrofe_version_major = "0";
|
std::string retrofe_version_major = "0";
|
||||||
std::string retrofe_version_minor = "8";
|
std::string retrofe_version_minor = "8";
|
||||||
std::string retrofe_version_build = "15b3";
|
std::string retrofe_version_build = "15b4";
|
||||||
|
|
||||||
|
|
||||||
std::string Version::getString( )
|
std::string Version::getString( )
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user