Added color tag to ImageComponent (for colorshift).

Changed TextComponent's truncation from ".." to "...".
Updated documentation.
This commit is contained in:
Aloshi 2014-01-23 15:30:32 -06:00
parent 305e91c9f8
commit 8eb9800127
5 changed files with 20 additions and 8 deletions

View file

@ -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! - 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/). - 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): - 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 cd EmulationStation
git pull git pull
export CXX=g++-4.7 export CXX=g++-4.7
@ -31,12 +31,12 @@ EmulationStation has a few dependencies. For building, you'll need SDL2, Boost (
**On Linux:** **On Linux:**
All of this be easily installed with apt-get: 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 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: Unless you're on the Raspberry Pi, you'll also need OpenGL:
``` ```bash
sudo apt-get install libgl1-mesa-dev 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: Here's an example es_systems.cfg:
``` ```xml
<!-- This is the EmulationStation Systems configuration file. <!-- This is the EmulationStation Systems configuration file.
All systems must be contained within the <systemList> tag.--> All systems must be contained within the <systemList> tag.-->
@ -144,6 +144,9 @@ All systems must be contained within the <systemList> tag.-->
<!-- The shell command executed when a game is selected. A few special tags are replaced if found in a command, like %ROM%. --> <!-- The shell command executed when a game is selected. A few special tags are replaced if found in a command, like %ROM%. -->
<command>snesemulator %ROM%</command> <command>snesemulator %ROM%</command>
<!-- This example would run the bash command "snesemulator /home/user/roms/snes/Super\ Mario\ World.sfc". --> <!-- This example would run the bash command "snesemulator /home/user/roms/snes/Super\ Mario\ World.sfc". -->
<!-- The Platform ID to use for scraping. 42 is the platform ID for the SNES. You can see the full list in src/PlatformIds.h. -->
<platformid>42</system>
</system> </system>
</systemList> </systemList>
``` ```
@ -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!). 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. 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: An example gamelist.xml:
``` ```xml
<gameList> <gameList>
<game> <game>
<path>/home/pi/ROMs/nes/mm2.nes</path> <path>/home/pi/ROMs/nes/mm2.nes</path>

View file

@ -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). - Path to the image file. Most common extensions are supported (including .jpg, .png, and unanimated .gif).
* `tile` - type: BOOLEAN. * `tile` - type: BOOLEAN.
- If true, the image will be tiled instead of stretched to fit its size. Useful for backgrounds. - 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 `<color>FF0000</color>` would become completely red.
#### text #### text
@ -324,7 +326,10 @@ Can be created as an extra.
* `pos` - type: NORMALIZED_PAIR. * `pos` - type: NORMALIZED_PAIR.
* `size` - 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. * `text` - type: STRING.
* `color` - type: COLOR. * `color` - type: COLOR.
* `fontPath` - type: PATH. * `fontPath` - type: PATH.

View file

@ -17,7 +17,8 @@ std::map< std::string, std::map<std::string, ThemeData::ElementPropertyType> > T
("maxSize", NORMALIZED_PAIR) ("maxSize", NORMALIZED_PAIR)
("origin", NORMALIZED_PAIR) ("origin", NORMALIZED_PAIR)
("path", PATH) ("path", PATH)
("tile", BOOLEAN)) ("tile", BOOLEAN)
("color", COLOR))
("text", boost::assign::map_list_of ("text", boost::assign::map_list_of
("pos", NORMALIZED_PAIR) ("pos", NORMALIZED_PAIR)
("size", NORMALIZED_PAIR) ("size", NORMALIZED_PAIR)

View file

@ -279,4 +279,7 @@ void ImageComponent::applyTheme(const std::shared_ptr<ThemeData>& theme, const s
bool tile = (elem->has("tile") && elem->get<bool>("tile")); bool tile = (elem->has("tile") && elem->get<bool>("tile"));
setImage(elem->get<std::string>("path"), tile); setImage(elem->get<std::string>("path"), tile);
} }
if(properties & COLOR && elem->has("color"))
setColorShift(elem->get<unsigned int>("color"));
} }

View file

@ -123,7 +123,7 @@ void TextComponent::onTextChanged()
if(!wrap && mSize.x() && mText.size() && size.x() > mSize.x()) if(!wrap && mSize.x() && mText.size() && size.x() > mSize.x())
{ {
// abbreviate text // abbreviate text
const std::string abbrev = ".."; const std::string abbrev = "...";
Eigen::Vector2f abbrevSize = f->sizeText(abbrev); Eigen::Vector2f abbrevSize = f->sizeText(abbrev);
std::string text = mText; std::string text = mText;