mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-21 21:55:38 +00:00
Changed scroll gradient to a radial gradient and made the display full
screen instead of just inside the list. Embedded the OpenSans font as the default font instead of relying on a platform-dependent system default.
This commit is contained in:
parent
a592dd4cf5
commit
816247ac20
|
@ -300,6 +300,7 @@ set(ES_SOURCES
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/data/converted/help_dpad_png.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/data/converted/help_up_down_png.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/data/converted/help_left_right_png.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/data/converted/opensans_hebrew_condensed_regular_ttf.cpp
|
||||
)
|
||||
|
||||
SOURCE_GROUP(resources FILES ResourceUtil.cpp)
|
||||
|
|
|
@ -27,12 +27,12 @@ Building
|
|||
EmulationStation uses some C++11 code, which means you'll need to install at least g++-4.7 on Linux, or VS2010 on Windows.
|
||||
For installing and switching to g++-4.7 see [here](http://lektiondestages.blogspot.de/2013/05/installing-and-switching-gccg-versions.html). You can also just use `export CXX=g++-4.7` to explicitly specify the compiler for CMake (make sure you delete your CMake cache files if it's not working).
|
||||
|
||||
EmulationStation has a few dependencies. For building, you'll need SDL2, Boost (System, Filesystem, Regex, DateTime), FreeImage, FreeType, Eigen3, and cURL. You'll also need the DejaVu TrueType font on Linux to run ES.
|
||||
EmulationStation has a few dependencies. For building, you'll need SDL2, Boost (System, Filesystem, Regex, DateTime), FreeImage, FreeType, Eigen3, and cURL.
|
||||
|
||||
**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
|
||||
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 libasound2-dev
|
||||
```
|
||||
|
||||
Unless you're on the Raspberry Pi, you'll also need OpenGL:
|
||||
|
|
|
@ -2,12 +2,13 @@
|
|||
|
||||
#include "Resources.h"
|
||||
|
||||
const size_t res2hNrOfFiles = 15;
|
||||
const size_t res2hNrOfFiles = 16;
|
||||
const Res2hEntry res2hFiles[res2hNrOfFiles] = {
|
||||
{":/button.png", button_png_size, button_png_data},
|
||||
{":/ES_logo_16.png", ES_logo_16_png_size, ES_logo_16_png_data},
|
||||
{":/ES_logo_32.png", ES_logo_32_png_size, ES_logo_32_png_data},
|
||||
{":/frame.png", frame_png_size, frame_png_data},
|
||||
{":/opensans_hebrew_condensed_regular.ttf", opensans_hebrew_condensed_regular_ttf_size, opensans_hebrew_condensed_regular_ttf_data},
|
||||
{":/scroll_gradient.png", scroll_gradient_png_size, scroll_gradient_png_data},
|
||||
{":/star_filled.png", star_filled_png_size, star_filled_png_data},
|
||||
{":/star_unfilled.png", star_unfilled_png_size, star_unfilled_png_data},
|
||||
|
@ -26,17 +27,18 @@ res2hMapType::value_type mapTemp[] = {
|
|||
std::make_pair(":/ES_logo_16.png", res2hFiles[1]),
|
||||
std::make_pair(":/ES_logo_32.png", res2hFiles[2]),
|
||||
std::make_pair(":/frame.png", res2hFiles[3]),
|
||||
std::make_pair(":/scroll_gradient.png", res2hFiles[4]),
|
||||
std::make_pair(":/star_filled.png", res2hFiles[5]),
|
||||
std::make_pair(":/star_unfilled.png", res2hFiles[6]),
|
||||
std::make_pair(":/textbox.png", res2hFiles[7]),
|
||||
std::make_pair(":/textbox_glow.png", res2hFiles[8]),
|
||||
std::make_pair(":/help/a.png", res2hFiles[9]),
|
||||
std::make_pair(":/help/b.png", res2hFiles[10]),
|
||||
std::make_pair(":/help/dpad.png", res2hFiles[11]),
|
||||
std::make_pair(":/help/left_right.png", res2hFiles[12]),
|
||||
std::make_pair(":/help/menu.png", res2hFiles[13]),
|
||||
std::make_pair(":/help/up_down.png", res2hFiles[14])
|
||||
std::make_pair(":/opensans_hebrew_condensed_regular.ttf", res2hFiles[4]),
|
||||
std::make_pair(":/scroll_gradient.png", res2hFiles[5]),
|
||||
std::make_pair(":/star_filled.png", res2hFiles[6]),
|
||||
std::make_pair(":/star_unfilled.png", res2hFiles[7]),
|
||||
std::make_pair(":/textbox.png", res2hFiles[8]),
|
||||
std::make_pair(":/textbox_glow.png", res2hFiles[9]),
|
||||
std::make_pair(":/help/a.png", res2hFiles[10]),
|
||||
std::make_pair(":/help/b.png", res2hFiles[11]),
|
||||
std::make_pair(":/help/dpad.png", res2hFiles[12]),
|
||||
std::make_pair(":/help/left_right.png", res2hFiles[13]),
|
||||
std::make_pair(":/help/menu.png", res2hFiles[14]),
|
||||
std::make_pair(":/help/up_down.png", res2hFiles[15])
|
||||
};
|
||||
|
||||
res2hMapType res2hMap(mapTemp, mapTemp + sizeof mapTemp / sizeof mapTemp[0]);
|
||||
|
|
|
@ -17,6 +17,9 @@ extern const unsigned char ES_logo_32_png_data[];
|
|||
extern const size_t frame_png_size;
|
||||
extern const unsigned char frame_png_data[];
|
||||
|
||||
extern const size_t opensans_hebrew_condensed_regular_ttf_size;
|
||||
extern const unsigned char opensans_hebrew_condensed_regular_ttf_data[];
|
||||
|
||||
extern const size_t scroll_gradient_png_size;
|
||||
extern const unsigned char scroll_gradient_png_data[];
|
||||
|
||||
|
|
3244
data/converted/opensans_hebrew_condensed_regular_ttf.cpp
Normal file
3244
data/converted/opensans_hebrew_condensed_regular_ttf.cpp
Normal file
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
BIN
data/resources/opensans_hebrew_condensed_regular.ttf
Normal file
BIN
data/resources/opensans_hebrew_condensed_regular.ttf
Normal file
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 81 KiB |
15
opensans_license.txt
Normal file
15
opensans_license.txt
Normal file
|
@ -0,0 +1,15 @@
|
|||
Regarding the Open Sans font (located in data/resources/ and data/converted):
|
||||
|
||||
Copyright 2010 Steve Matteson
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
|
@ -64,9 +64,8 @@ public:
|
|||
|
||||
mTitleOverlayOpacity = 0x00;
|
||||
mTitleOverlayColor = 0xFFFFFF00;
|
||||
mGradient.setResize((float)Renderer::getScreenWidth(), (float)Renderer::getScreenHeight());
|
||||
mGradient.setImage(":/scroll_gradient.png");
|
||||
mGradient.setColorShift(0x000040FF);
|
||||
mGradient.setOpacity(0);
|
||||
mTitleOverlayFont = Font::get(FONT_SIZE_LARGE);
|
||||
}
|
||||
|
||||
|
@ -216,17 +215,14 @@ protected:
|
|||
const std::string text = getSelectedName().size() >= 2 ? getSelectedName().substr(0, 2) : "??";
|
||||
|
||||
Eigen::Vector2f off = mTitleOverlayFont->sizeText(text);
|
||||
off[0] = (mSize.x() - off.x()) * 0.7f;
|
||||
off[1] = (mSize.y() - off.y()) * 0.5f;
|
||||
off[0] = (Renderer::getScreenWidth() - off.x()) * 0.5f;
|
||||
off[1] = (Renderer::getScreenHeight() - off.y()) * 0.5f;
|
||||
|
||||
mGradient.setOpacity(mTitleOverlayOpacity);
|
||||
mGradient.render(trans);
|
||||
mTitleOverlayFont->drawText(text, off, (mTitleOverlayColor & 0xFFFFFF00) | mTitleOverlayOpacity); // relies on mGradient's render to Renderer::setMatrix(trans)
|
||||
}
|
||||
Eigen::Affine3f identTrans = Eigen::Affine3f::Identity();
|
||||
|
||||
virtual void onSizeChanged() override
|
||||
{
|
||||
mGradient.setResize(mSize);
|
||||
mGradient.setOpacity(mTitleOverlayOpacity);
|
||||
mGradient.render(identTrans);
|
||||
mTitleOverlayFont->drawText(text, off, (mTitleOverlayColor & 0xFFFFFF00) | mTitleOverlayOpacity); // relies on mGradient's render for Renderer::setMatrix()
|
||||
}
|
||||
|
||||
void scroll(int amt)
|
||||
|
|
|
@ -46,6 +46,8 @@ public:
|
|||
inline void setFont(const std::shared_ptr<Font>& font)
|
||||
{
|
||||
mFont = font;
|
||||
mTitleOverlayFont = Font::get(FONT_SIZE_LARGE, mFont->getPath());
|
||||
|
||||
for(auto it = mEntries.begin(); it != mEntries.end(); it++)
|
||||
it->data.textCache.reset();
|
||||
}
|
||||
|
|
|
@ -16,59 +16,6 @@ int Font::getSize() const { return mSize; }
|
|||
|
||||
std::map< std::pair<std::string, int>, std::weak_ptr<Font> > Font::sFontMap;
|
||||
|
||||
static std::string default_font_path = "";
|
||||
|
||||
std::string Font::getDefaultPath()
|
||||
{
|
||||
if(!default_font_path.empty())
|
||||
return default_font_path;
|
||||
|
||||
const int fontCount = 4;
|
||||
|
||||
#ifdef WIN32
|
||||
std::string fonts[] = {"DejaVuSerif.ttf",
|
||||
"Arial.ttf",
|
||||
"Verdana.ttf",
|
||||
"Tahoma.ttf" };
|
||||
|
||||
//build full font path
|
||||
TCHAR winDir[MAX_PATH];
|
||||
GetWindowsDirectory(winDir, MAX_PATH);
|
||||
#ifdef UNICODE
|
||||
char winDirChar[MAX_PATH*2];
|
||||
char DefChar = ' ';
|
||||
WideCharToMultiByte(CP_ACP, 0, winDir, -1, winDirChar, MAX_PATH, &DefChar, NULL);
|
||||
std::string fontPath(winDirChar);
|
||||
#else
|
||||
std::string fontPath(winDir);
|
||||
#endif
|
||||
fontPath += "\\Fonts\\";
|
||||
//prepend to font file names
|
||||
for(int i = 0; i < fontCount; i++)
|
||||
{
|
||||
fonts[i] = fontPath + fonts[i];
|
||||
}
|
||||
#else
|
||||
std::string fonts[] = {"/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif.ttf",
|
||||
"/usr/share/fonts/TTF/DejaVuSerif.ttf",
|
||||
"/usr/share/fonts/dejavu/DejaVuSerif.ttf",
|
||||
"font.ttf" };
|
||||
#endif
|
||||
|
||||
for(int i = 0; i < fontCount; i++)
|
||||
{
|
||||
if(boost::filesystem::exists(fonts[i]))
|
||||
{
|
||||
default_font_path = fonts[i];
|
||||
return fonts[i];
|
||||
}
|
||||
}
|
||||
|
||||
LOG(LogError) << "Error - could not find the default font!";
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
void Font::initLibrary()
|
||||
{
|
||||
if(FT_Init_FreeType(&sLibrary))
|
||||
|
|
|
@ -68,8 +68,9 @@ public:
|
|||
void reload(std::shared_ptr<ResourceManager>& rm) override;
|
||||
|
||||
int getSize() const;
|
||||
inline const std::string& getPath() const { return mPath; }
|
||||
|
||||
static std::string getDefaultPath();
|
||||
inline static const char* getDefaultPath() { return ":/opensans_hebrew_condensed_regular.ttf"; }
|
||||
|
||||
static std::shared_ptr<Font> getFromTheme(const ThemeData::ThemeElement* elem, unsigned int properties, const std::shared_ptr<Font>& orig);
|
||||
|
||||
|
|
Loading…
Reference in a new issue