mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 06:05:38 +00:00
Added <basicTheme> support.
This commit is contained in:
parent
2efca58869
commit
e59c430b89
|
@ -132,6 +132,11 @@ The switch `--ignore-gamelist` can be used to ignore the gamelist and use the no
|
|||
|
||||
**Making a gamelist.xml by hand sucks, so a cool guy named Pendor made a python script which automatically generates a gamelist.xml for you, with boxart automatically downloaded. It can be found here:** https://github.com/elpendor/ES-scraper
|
||||
|
||||
I found a bug!
|
||||
==============
|
||||
|
||||
The best way to report a bug is to post an issue on GitHub. Try to post the simplest steps possible to reproduce the bug. Include files you think might be related (except for ROMs, of course). If you haven't re-run ES since the crash, the log file `~/.emulationstation/es_log.txt` is also helpful.
|
||||
|
||||
Themes
|
||||
======
|
||||
|
||||
|
|
32
THEMES.md
32
THEMES.md
|
@ -16,7 +16,7 @@ Colors are hex values, either 6 or 8 characters, defined as RRGGBB or RRGGBBAA.
|
|||
Example
|
||||
=======
|
||||
|
||||
Here's a simple theme that defines some colors and displays a background:
|
||||
Here's a theme that defines some colors, displays a background, and displays a logo in the top left corner:
|
||||
```
|
||||
<theme>
|
||||
<listPrimaryColor>0000FF</listPrimaryColor>
|
||||
|
@ -29,10 +29,36 @@ Here's a simple theme that defines some colors and displays a background:
|
|||
<dim>1 1</dim>
|
||||
<origin>0 0</origin>
|
||||
</component>
|
||||
|
||||
<component>
|
||||
<type>image</type>
|
||||
<path>./theme/logo.png</path>
|
||||
<pos>0 0</pos>
|
||||
<dim>0.4 0</dim>
|
||||
<origin>0 0</origin>
|
||||
</component>
|
||||
</theme>
|
||||
|
||||
<!-- You can also optionally define a "basic" theme, which is used instead if ES is in the "basic" view (no box art) -->
|
||||
<basicTheme>
|
||||
<listPrimaryColor>0000FF</listPrimaryColor>
|
||||
<listSecondaryColor>00FF00</listSecondaryColor>
|
||||
|
||||
<component>
|
||||
<type>image</type>
|
||||
<path>./theme/background.png</path>
|
||||
<pos>0 0</pos>
|
||||
<dim>1 1</dim>
|
||||
<origin>0 0</origin>
|
||||
</component>
|
||||
|
||||
</basicTheme>
|
||||
```
|
||||
|
||||
All themes must be enclosed in a `<theme>` tag.
|
||||
Themes can be defined with two tags: `<theme>` and `<themeBasic>`.
|
||||
You can define both a normal and basic theme in the same file.
|
||||
|
||||
If EmulationStation is running in "basic" mode, it will try to use `<themeBasic>`. If that doesn't exist or ES is running in "detailed" mode (a gamelist.xml is present), `<theme>` will be used.
|
||||
|
||||
|
||||
Components
|
||||
|
@ -82,8 +108,6 @@ Display tags define some "meta" display attributes about your theme. Display tag
|
|||
|
||||
`<listTextOffsetX>` - the percentage to offset the text in the list by. Default is 0.005. Only works in combination with `<listLeftAlign />`.
|
||||
|
||||
~~`<gameImageOffsetY>` - the percentage to offset the displayed game image by. Default is the height of the header font.~~
|
||||
|
||||
|
||||
|
||||
**Game image attributes:**
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
January 6, 2012
|
||||
-Added <basicTheme> tag support.
|
||||
|
||||
December 20, 2012
|
||||
-Added --debug command-line option. Useful if you're having input config problems.
|
||||
-Changed things so you can finish configuring without a keyboard. You should no longer need a keyboard to set up ES; SSH access should be sufficient.
|
||||
|
|
|
@ -86,7 +86,7 @@ GameData* createGameFromPath(std::string gameAbsPath, SystemData* system)
|
|||
//if for some reason this function is broken, break out of this while instead of freezing
|
||||
if(loops > gamePath.length() * 2)
|
||||
{
|
||||
std::cerr << "breaking out of loop for path \"" << gamePath << "\"\n";
|
||||
LOG(LogError) << "createGameFromPath breaking out of loop for path \"" << gamePath << "\" to prevent infinite loop (please report this)";
|
||||
break;
|
||||
}
|
||||
loops++;
|
||||
|
@ -108,22 +108,21 @@ void parseGamelist(SystemData* system)
|
|||
if(xmlpath.empty())
|
||||
return;
|
||||
|
||||
std::cout << "Parsing XML file \"" << xmlpath << "\"...";
|
||||
LOG(LogInfo) << "Parsing XML file \"" << xmlpath << "\"...";
|
||||
|
||||
pugi::xml_document doc;
|
||||
pugi::xml_parse_result result = doc.load_file(xmlpath.c_str());
|
||||
|
||||
if(!result)
|
||||
{
|
||||
std::cerr << "Error parsing XML file \"" << xmlpath << "\"!\n";
|
||||
std::cerr << " " << result.description() << "\n";
|
||||
LOG(LogError) << "Error parsing XML file \"" << xmlpath << "\"!\n " << result.description();
|
||||
return;
|
||||
}
|
||||
|
||||
pugi::xml_node root = doc.child("gameList");
|
||||
if(!root)
|
||||
{
|
||||
std::cerr << "Error - could not find <gameList> node in XML document!\n";
|
||||
LOG(LogError) << "Could not find <gameList> node in gamelist \"" << xmlpath << "\"!";
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -132,8 +131,8 @@ void parseGamelist(SystemData* system)
|
|||
pugi::xml_node pathNode = gameNode.child("path");
|
||||
if(!pathNode)
|
||||
{
|
||||
std::cerr << "Error - <game> node contains no <path> child!\n";
|
||||
return;
|
||||
LOG(LogError) << "<game> node contains no <path> child!";
|
||||
continue;
|
||||
}
|
||||
|
||||
std::string path = pathNode.text().get();
|
||||
|
@ -179,9 +178,7 @@ void parseGamelist(SystemData* system)
|
|||
game->set(newName, newDesc, newImage);
|
||||
|
||||
}else{
|
||||
std::cerr << "Game at \"" << path << "\" does not exist!\n";
|
||||
LOG(LogWarning) << "Game at \"" << path << "\" does not exist!";
|
||||
}
|
||||
}
|
||||
|
||||
std::cout << "done.\n";
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ GuiGameList::GuiGameList(bool useDetail)
|
|||
{
|
||||
mDetailed = useDetail;
|
||||
|
||||
mTheme = new GuiTheme(); //not a child because it's rendered manually by GuiGameList::onRender (to make sure it's rendered first)
|
||||
mTheme = new GuiTheme(mDetailed); //not a child because it's rendered manually by GuiGameList::onRender (to make sure it's rendered first)
|
||||
|
||||
//The GuiGameList can use the older, simple game list if so desired.
|
||||
//The old view only shows a list in the center of the screen; the new view can display an image and description.
|
||||
|
|
|
@ -51,8 +51,10 @@ Font* GuiTheme::getDescriptionFont()
|
|||
return mDescFont;
|
||||
}
|
||||
|
||||
GuiTheme::GuiTheme(std::string path)
|
||||
GuiTheme::GuiTheme(bool detailed, std::string path)
|
||||
{
|
||||
mDetailed = detailed;
|
||||
|
||||
mSoundMap["menuScroll"] = new Sound();
|
||||
mSoundMap["menuSelect"] = new Sound();
|
||||
mSoundMap["menuBack"] = new Sound();
|
||||
|
@ -160,7 +162,24 @@ void GuiTheme::readXML(std::string path)
|
|||
return;
|
||||
}
|
||||
|
||||
pugi::xml_node root = doc.child("theme");
|
||||
pugi::xml_node root;
|
||||
|
||||
if(!mDetailed)
|
||||
{
|
||||
//if we're using the basic view, check if there's a basic version of the theme
|
||||
root = doc.child("basicTheme");
|
||||
}
|
||||
|
||||
if(!root)
|
||||
{
|
||||
root = doc.child("theme");
|
||||
}
|
||||
|
||||
if(!root)
|
||||
{
|
||||
LOG(LogError) << "No theme tag found in theme \"" << path << "\"!";
|
||||
return;
|
||||
}
|
||||
|
||||
//load non-component theme stuff
|
||||
mColorMap["primary"] = resolveColor(root.child("listPrimaryColor").text().get(), mColorMap["primary"]);
|
||||
|
@ -219,7 +238,7 @@ void GuiTheme::readXML(std::string path)
|
|||
//actually read the components
|
||||
createComponentChildren(root, this);
|
||||
|
||||
LOG(LogInfo) << "Loading complete.";
|
||||
LOG(LogInfo) << "Theme loading complete.";
|
||||
}
|
||||
|
||||
//recursively creates components (with proper parenting)
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
class GuiTheme : public GuiComponent
|
||||
{
|
||||
public:
|
||||
GuiTheme(std::string path = "");
|
||||
GuiTheme(bool detailed, std::string path = "");
|
||||
~GuiTheme();
|
||||
|
||||
void readXML(std::string path);
|
||||
|
@ -42,6 +42,7 @@ private:
|
|||
|
||||
std::vector<GuiComponent*> mComponentVector;
|
||||
std::string mPath;
|
||||
bool mDetailed;
|
||||
|
||||
std::map<std::string, unsigned int> mColorMap;
|
||||
std::map<std::string, bool> mBoolMap;
|
||||
|
|
|
@ -57,6 +57,7 @@ int main(int argc, char* argv[])
|
|||
}else if(strcmp(argv[i], "--debug") == 0)
|
||||
{
|
||||
DEBUG = true;
|
||||
Log::setReportingLevel(LogDebug);
|
||||
}else if(strcmp(argv[i], "--help") == 0)
|
||||
{
|
||||
std::cout << "EmulationStation, a graphical front-end for ROM browsing.\n";
|
||||
|
|
Loading…
Reference in a new issue