From 8eb980012799ec141c803e90c2bb10da4cdd4b51 Mon Sep 17 00:00:00 2001 From: Aloshi Date: Thu, 23 Jan 2014 15:30:32 -0600 Subject: [PATCH] Added color tag to ImageComponent (for colorshift). Changed TextComponent's truncation from ".." to "...". Updated documentation. --- README.md | 13 ++++++++----- THEMES.md | 7 ++++++- src/ThemeData.cpp | 3 ++- src/components/ImageComponent.cpp | 3 +++ src/components/TextComponent.cpp | 2 +- 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 150cc64f2..ab63d066f 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ I found a bug! I have a problem! - First, try to check the [issue list](https://github.com/Aloshi/EmulationStation/issues?state=open) for some entries that might match your problem. Make sure to check closed issues too! - If you're running EmulationStation on a on Raspberry Pi and have problems with config file changes not taking effect, content missing after editing, etc., check if your SD card is corrupted (see issues [#78](https://github.com/Aloshi/EmulationStation/issues/78) and [#107](https://github.com/Aloshi/EmulationStation/issues/107)). You can do this with free tools like [h2testw](http://www.heise.de/download/h2testw.html) or [F3](http://oss.digirati.com.br/f3/). - Try to update to the latest version of EmulationStation using git (you might need to delete your `es_input.cfg` and `es_settings.cfg` after that to reset them to default values): -``` +```bash cd EmulationStation git pull export CXX=g++-4.7 @@ -31,12 +31,12 @@ EmulationStation has a few dependencies. For building, you'll need SDL2, Boost ( **On Linux:** All of this be easily installed with apt-get: -``` +```bash sudo apt-get install libsdl2-dev libboost-dev libboost-system-dev libboost-filesystem-dev libboost-regex-dev libboost-date-time-dev libfreeimage-dev libfreetype6-dev libeigen3-dev libcurl-dev ttf-dejavu libasound2-dev ``` Unless you're on the Raspberry Pi, you'll also need OpenGL: -``` +```bash sudo apt-get install libgl1-mesa-dev ``` @@ -121,7 +121,7 @@ The order EmulationStation displays systems reflects the order you define them i Here's an example es_systems.cfg: -``` +```xml @@ -144,6 +144,9 @@ All systems must be contained within the tag.--> snesemulator %ROM% + + + 42 ``` @@ -165,7 +168,7 @@ The gamelist.xml for a system defines metadata for a system's games, such as a n If a file named gamelist.xml is found in the root of a system's search directory OR within `~/.emulationstation/%NAME%/`, game metadata will be loaded from it. This allows you to define images, descriptions, and different names for files. Note that only standard ASCII characters are supported for text (if you see a weird [X] symbol, you're probably using unicode!). Images will be automatically resized to fit within the left column of the screen. Smaller images will load faster, so try to keep your resolution low. An example gamelist.xml: -``` +```xml /home/pi/ROMs/nes/mm2.nes diff --git a/THEMES.md b/THEMES.md index 903a385e8..f708c9a62 100644 --- a/THEMES.md +++ b/THEMES.md @@ -317,6 +317,8 @@ Can be created as an extra. - Path to the image file. Most common extensions are supported (including .jpg, .png, and unanimated .gif). * `tile` - type: BOOLEAN. - If true, the image will be tiled instead of stretched to fit its size. Useful for backgrounds. +* `color` - type: COLOR. + - Multiply each pixel's color by this color. For example, an all-white image with `FF0000` would become completely red. #### text @@ -324,7 +326,10 @@ Can be created as an extra. * `pos` - type: NORMALIZED_PAIR. * `size` - type: NORMALIZED_PAIR. - - You should only set this if you want your text to behave like a "textbox" - that is, your text is multi-line and should wrap. + - Possible combinations: + - `0 0` - automatically size so text fits on one line (expanding horizontally). + - `w 0` - automatically wrap text so it doesn't go beyond `w` (expanding vertically). + - `w h` - works like a "text box." If `h` is non-zero and `h` <= `fontSize` (implying it should be a single line of text), text that goes beyond `w` will be truncated with an elipses (...). * `text` - type: STRING. * `color` - type: COLOR. * `fontPath` - type: PATH. diff --git a/src/ThemeData.cpp b/src/ThemeData.cpp index 6481b1918..08f3b9244 100644 --- a/src/ThemeData.cpp +++ b/src/ThemeData.cpp @@ -17,7 +17,8 @@ std::map< std::string, std::map > T ("maxSize", NORMALIZED_PAIR) ("origin", NORMALIZED_PAIR) ("path", PATH) - ("tile", BOOLEAN)) + ("tile", BOOLEAN) + ("color", COLOR)) ("text", boost::assign::map_list_of ("pos", NORMALIZED_PAIR) ("size", NORMALIZED_PAIR) diff --git a/src/components/ImageComponent.cpp b/src/components/ImageComponent.cpp index 8d6b68d15..abb37134a 100644 --- a/src/components/ImageComponent.cpp +++ b/src/components/ImageComponent.cpp @@ -279,4 +279,7 @@ void ImageComponent::applyTheme(const std::shared_ptr& theme, const s bool tile = (elem->has("tile") && elem->get("tile")); setImage(elem->get("path"), tile); } + + if(properties & COLOR && elem->has("color")) + setColorShift(elem->get("color")); } diff --git a/src/components/TextComponent.cpp b/src/components/TextComponent.cpp index d89b9990a..83b073c64 100644 --- a/src/components/TextComponent.cpp +++ b/src/components/TextComponent.cpp @@ -123,7 +123,7 @@ void TextComponent::onTextChanged() if(!wrap && mSize.x() && mText.size() && size.x() > mSize.x()) { // abbreviate text - const std::string abbrev = ".."; + const std::string abbrev = "..."; Eigen::Vector2f abbrevSize = f->sizeText(abbrev); std::string text = mText;