mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2026-04-28 17:09:33 +02:00
Altered font rendering to allow black. Still see bleeding effects. Might need to do per-pixel alpha values.
This commit is contained in:
Binary file not shown.
@@ -1,15 +1,12 @@
|
|||||||
<layout width="1920" height="1080" font="Lato-Black.ttf" fontColor="ecf0f1">
|
<layout width="1920" height="1080" font="Roboto-Bold.ttf" fontColor="c0842b">
|
||||||
<sound type="load" src="load.wav" />
|
<sound type="load" src="load.wav" />
|
||||||
<sound type="unload" src="unload.wav" />
|
<sound type="unload" src="unload.wav" />
|
||||||
<sound type="highlight" src="highlight.wav" />
|
<sound type="highlight" src="highlight.wav" />
|
||||||
<sound type="select" src="select.wav" />
|
<sound type="select" src="select.wav" />
|
||||||
|
|
||||||
<!-- background -->
|
<!-- background -->
|
||||||
<container backgroundColor="000000" backgroundAlpha="FF" x="0" y="0" height="stretch" width="stretch" layer="0" alpha="0.3" />
|
<container backgroundColor="C0392B" backgroundAlpha="1.0" x="0" y="0" height="stretch" width="stretch" layer="0"/>
|
||||||
|
|
||||||
<!-- border for menu -->
|
|
||||||
<container backgroundColor="c0392b" backgroundAlpha="99" x="center" y="0" height="stretch" width="center" layer="1" alpha="0.3" />
|
|
||||||
|
|
||||||
<menu orientation="horizontal" algorithm="easeincircular" xOffset="500" y="0" width="center" height="stretch" speed="0.05" acceleration="0.05" layer="3">
|
<menu orientation="horizontal" algorithm="easeincircular" xOffset="500" y="0" width="center" height="stretch" speed="0.05" acceleration="0.05" layer="3">
|
||||||
<itemDefaults spacing="10" x="center" height="30" font-size="30" alpha="0.5" xOffset="20" yOrigin="center" />
|
<itemDefaults spacing="10" x="center" height="30" font-size="30" alpha="0.5" xOffset="20" yOrigin="center" />
|
||||||
<item index="start" height="0" spacing="0" alpha="0"/>
|
<item index="start" height="0" spacing="0" alpha="0"/>
|
||||||
|
|||||||
BIN
Package/Environment/Common/Layouts/Default 16x9/Roboto-Bold.ttf
Normal file
BIN
Package/Environment/Common/Layouts/Default 16x9/Roboto-Bold.ttf
Normal file
Binary file not shown.
@@ -1,31 +0,0 @@
|
|||||||
<layout width="1920" height="1080" font="Age.otf" fontColor="ecf0f1">
|
|
||||||
|
|
||||||
<!-- border for menu -->
|
|
||||||
<container backgroundColor="c0392b" backgroundAlpha="99" x="0" y="0" height="stretch" width="stretch" layer="0" alpha="0.3" />
|
|
||||||
|
|
||||||
<!-- logo -->
|
|
||||||
<image x="center" y="center" height="150" xOrigin="center" yOrigin="center" src="logo.png" layer="1" alpha="1">
|
|
||||||
<onEnter>
|
|
||||||
<set duration=".5">
|
|
||||||
<animate type="alpha" from="0" to="1" algorithm="easeinquadratic"/>
|
|
||||||
</set>
|
|
||||||
</onEnter>
|
|
||||||
<onIdle>
|
|
||||||
<set duration=".5">
|
|
||||||
<animate type="alpha" from="1" to=".5" algorithm="easeinquadratic"/>
|
|
||||||
</set>
|
|
||||||
<set duration=".5">
|
|
||||||
<animate type="alpha" from=".5" to="1" algorithm="easeinquadratic"/>
|
|
||||||
</set>
|
|
||||||
</onIdle>
|
|
||||||
<onExit>
|
|
||||||
<set duration=".5">
|
|
||||||
<animate type="alpha" from="1" to="0" algorithm="easeinquadratic"/>
|
|
||||||
</set>
|
|
||||||
</onExit>
|
|
||||||
</image>
|
|
||||||
</layout>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BIN
Package/Environment/Common/Layouts/Splash/Lato-Regular.ttf
Normal file
BIN
Package/Environment/Common/Layouts/Splash/Lato-Regular.ttf
Normal file
Binary file not shown.
@@ -50,7 +50,7 @@ bool Font::GetRect(unsigned int charCode, GlyphInfo &glyph)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Font::Initialize(std::string fontPath, SDL_Color color)
|
bool Font::Initialize(std::string fontPath)
|
||||||
{
|
{
|
||||||
TTF_Font *font = TTF_OpenFont(fontPath.c_str(), 128);
|
TTF_Font *font = TTF_OpenFont(fontPath.c_str(), 128);
|
||||||
|
|
||||||
@@ -70,6 +70,11 @@ bool Font::Initialize(std::string fontPath, SDL_Color color)
|
|||||||
GlyphInfoBuild *info = new GlyphInfoBuild;
|
GlyphInfoBuild *info = new GlyphInfoBuild;
|
||||||
memset(info, sizeof(GlyphInfoBuild), 0);
|
memset(info, sizeof(GlyphInfoBuild), 0);
|
||||||
|
|
||||||
|
SDL_Color color;
|
||||||
|
color.r = 255;
|
||||||
|
color.g = 255;
|
||||||
|
color.b = 255;
|
||||||
|
color.a = 255;
|
||||||
info->Surface = TTF_RenderGlyph_Blended(font, i, color);
|
info->Surface = TTF_RenderGlyph_Blended(font, i, color);
|
||||||
TTF_GlyphMetrics(font, i, &info->Glyph.MinX, &info->Glyph.MaxX, &info->Glyph.MinY, &info->Glyph.MaxY, &info->Glyph.Advance);
|
TTF_GlyphMetrics(font, i, &info->Glyph.MinX, &info->Glyph.MaxX, &info->Glyph.MinY, &info->Glyph.MaxY, &info->Glyph.Advance);
|
||||||
|
|
||||||
@@ -114,7 +119,9 @@ bool Font::Initialize(std::string fontPath, SDL_Color color)
|
|||||||
bmask = 0x00ff0000;
|
bmask = 0x00ff0000;
|
||||||
amask = 0xff000000;
|
amask = 0xff000000;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SDL_Surface *atlasSurface = SDL_CreateRGBSurface(0, atlasWidth, atlasHeight, 24, rmask, gmask, bmask, amask);
|
SDL_Surface *atlasSurface = SDL_CreateRGBSurface(0, atlasWidth, atlasHeight, 24, rmask, gmask, bmask, amask);
|
||||||
|
SDL_FillRect(atlasSurface, NULL, SDL_MapRGB(atlasSurface->format, 0, 0, 0));
|
||||||
|
|
||||||
std::map<unsigned int, GlyphInfoBuild *>::iterator it;
|
std::map<unsigned int, GlyphInfoBuild *>::iterator it;
|
||||||
for(it = Atlas.begin(); it != Atlas.end(); it++)
|
for(it = Atlas.begin(); it != Atlas.end(); it++)
|
||||||
@@ -126,7 +133,7 @@ bool Font::Initialize(std::string fontPath, SDL_Color color)
|
|||||||
}
|
}
|
||||||
|
|
||||||
SDL_LockMutex(SDL::GetMutex());
|
SDL_LockMutex(SDL::GetMutex());
|
||||||
SDL_SetColorKey(atlasSurface, SDL_TRUE, SDL_MapRGB(atlasSurface->format, 0, 0, 0));
|
SDL_SetColorKey(atlasSurface, SDL_TRUE, SDL_MapRGB(atlasSurface->format, 0x00, 0x00, 0x00));
|
||||||
Texture = SDL_CreateTextureFromSurface(SDL::GetRenderer(), atlasSurface);
|
Texture = SDL_CreateTextureFromSurface(SDL::GetRenderer(), atlasSurface);
|
||||||
SDL_FreeSurface(atlasSurface);
|
SDL_FreeSurface(atlasSurface);
|
||||||
SDL_UnlockMutex(SDL::GetMutex());
|
SDL_UnlockMutex(SDL::GetMutex());
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public:
|
|||||||
|
|
||||||
Font();
|
Font();
|
||||||
virtual ~Font();
|
virtual ~Font();
|
||||||
bool Initialize(std::string fontPath, SDL_Color color);
|
bool Initialize(std::string fontPath);
|
||||||
void DeInitialize();
|
void DeInitialize();
|
||||||
SDL_Texture *GetTexture();
|
SDL_Texture *GetTexture();
|
||||||
bool GetRect(unsigned int charCode, GlyphInfo &glyph);
|
bool GetRect(unsigned int charCode, GlyphInfo &glyph);
|
||||||
|
|||||||
@@ -66,14 +66,14 @@ Font *FontCache::GetFont(std::string fontPath)
|
|||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FontCache::LoadFont(std::string fontPath, SDL_Color color)
|
bool FontCache::LoadFont(std::string fontPath)
|
||||||
{
|
{
|
||||||
std::map<std::string, Font *>::iterator it = FontFaceMap.find(fontPath);
|
std::map<std::string, Font *>::iterator it = FontFaceMap.find(fontPath);
|
||||||
|
|
||||||
if(it == FontFaceMap.end())
|
if(it == FontFaceMap.end())
|
||||||
{
|
{
|
||||||
Font *f = new Font();
|
Font *f = new Font();
|
||||||
f->Initialize(fontPath, color);
|
f->Initialize(fontPath);
|
||||||
FontFaceMap[fontPath] = f;
|
FontFaceMap[fontPath] = f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ public:
|
|||||||
void Initialize();
|
void Initialize();
|
||||||
void DeInitialize();
|
void DeInitialize();
|
||||||
FontCache();
|
FontCache();
|
||||||
bool LoadFont(std::string font, SDL_Color color);
|
bool LoadFont(std::string font);
|
||||||
Font *GetFont(std::string font);
|
Font *GetFont(std::string font);
|
||||||
|
|
||||||
virtual ~FontCache();
|
virtual ~FontCache();
|
||||||
|
|||||||
@@ -363,7 +363,7 @@ bool PageBuilder::BuildComponents(xml_node<> *layout, Page *page)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FC->LoadFont(Font, FontColor);
|
FC->LoadFont(Font);
|
||||||
Text *c = new Text(value->value(), FC->GetFont(Font), FontColor, ScaleX, ScaleY);
|
Text *c = new Text(value->value(), FC->GetFont(Font), FontColor, ScaleX, ScaleY);
|
||||||
ViewInfo *v = c->GetBaseViewInfo();
|
ViewInfo *v = c->GetBaseViewInfo();
|
||||||
|
|
||||||
@@ -427,7 +427,7 @@ void PageBuilder::LoadReloadableImages(xml_node<> *layout, std::string tagName,
|
|||||||
{
|
{
|
||||||
if(type)
|
if(type)
|
||||||
{
|
{
|
||||||
FC->LoadFont(Font, FontColor);
|
FC->LoadFont(Font);
|
||||||
c = new ReloadableText(type->value(), FC->GetFont(Font), FontColor, LayoutKey, Collection, ScaleX, ScaleY);
|
c = new ReloadableText(type->value(), FC->GetFont(Font), FontColor, LayoutKey, Collection, ScaleX, ScaleY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -500,7 +500,7 @@ ScrollingList * PageBuilder::BuildMenu(xml_node<> *menuXml)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// on default, text will be rendered to the menu. Preload it into cache.
|
// on default, text will be rendered to the menu. Preload it into cache.
|
||||||
FC->LoadFont(Font, FontColor);
|
FC->LoadFont(Font);
|
||||||
|
|
||||||
menu = new ScrollingList(Config, ScaleX, ScaleY, FC->GetFont(Font), FontColor, LayoutKey, Collection, imageType);
|
menu = new ScrollingList(Config, ScaleX, ScaleY, FC->GetFont(Font), FontColor, LayoutKey, Collection, imageType);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user