diff --git a/Package/Environment/Common/Layouts/Default 16x9/Age.otf b/Package/Environment/Common/Layouts/Default 16x9/Age.otf new file mode 100644 index 0000000..5d76781 Binary files /dev/null and b/Package/Environment/Common/Layouts/Default 16x9/Age.otf differ diff --git a/Package/Environment/Common/Layouts/Default 16x9/Layout.xml b/Package/Environment/Common/Layouts/Default 16x9/Layout.xml index 64ac1af..d164de6 100644 --- a/Package/Environment/Common/Layouts/Default 16x9/Layout.xml +++ b/Package/Environment/Common/Layouts/Default 16x9/Layout.xml @@ -1,4 +1,4 @@ - + @@ -7,14 +7,14 @@ - - + + + - + - @@ -30,12 +30,9 @@ - - - @@ -52,7 +49,6 @@ - diff --git a/Package/Environment/Common/Layouts/Showcase 16x9/Age.otf b/Package/Environment/Common/Layouts/Showcase 16x9/Age.otf new file mode 100644 index 0000000..5d76781 Binary files /dev/null and b/Package/Environment/Common/Layouts/Showcase 16x9/Age.otf differ diff --git a/Package/Environment/Common/Layouts/Showcase 16x9/Layout.xml b/Package/Environment/Common/Layouts/Showcase 16x9/Layout.xml new file mode 100644 index 0000000..a75e983 --- /dev/null +++ b/Package/Environment/Common/Layouts/Showcase 16x9/Layout.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Package/Environment/Common/Layouts/Showcase 16x9/highlight.wav b/Package/Environment/Common/Layouts/Showcase 16x9/highlight.wav new file mode 100644 index 0000000..589d167 Binary files /dev/null and b/Package/Environment/Common/Layouts/Showcase 16x9/highlight.wav differ diff --git a/Package/Environment/Common/Layouts/Showcase 16x9/load.wav b/Package/Environment/Common/Layouts/Showcase 16x9/load.wav new file mode 100644 index 0000000..077480e Binary files /dev/null and b/Package/Environment/Common/Layouts/Showcase 16x9/load.wav differ diff --git a/Package/Environment/Common/Layouts/Showcase 16x9/select.wav b/Package/Environment/Common/Layouts/Showcase 16x9/select.wav new file mode 100644 index 0000000..6678b93 Binary files /dev/null and b/Package/Environment/Common/Layouts/Showcase 16x9/select.wav differ diff --git a/Package/Environment/Common/Layouts/Showcase 16x9/unload.wav b/Package/Environment/Common/Layouts/Showcase 16x9/unload.wav new file mode 100644 index 0000000..65f069a Binary files /dev/null and b/Package/Environment/Common/Layouts/Showcase 16x9/unload.wav differ diff --git a/Package/Environment/Common/Layouts/Splash/Lato-Regular.ttf b/Package/Environment/Common/Layouts/Splash/Lato-Regular.ttf deleted file mode 100644 index f01f558..0000000 Binary files a/Package/Environment/Common/Layouts/Splash/Lato-Regular.ttf and /dev/null differ diff --git a/Package/Environment/Common/Layouts/Splash/Layout.xml b/Package/Environment/Common/Layouts/Splash/Layout.xml index 71953ce..e7742ab 100644 --- a/Package/Environment/Common/Layouts/Splash/Layout.xml +++ b/Package/Environment/Common/Layouts/Splash/Layout.xml @@ -1,7 +1,11 @@ - + + + + + - + diff --git a/RetroFE/Source/Graphics/Component/Text.cpp b/RetroFE/Source/Graphics/Component/Text.cpp index dc686dc..4328e42 100644 --- a/RetroFE/Source/Graphics/Component/Text.cpp +++ b/RetroFE/Source/Graphics/Component/Text.cpp @@ -100,11 +100,6 @@ void Text::Draw() rect.w = static_cast(w); rect.y = static_cast(yOrigin); - SDL_LockMutex(SDL::GetMutex()); - SDL_SetTextureBlendMode(t, SDL_BLENDMODE_ADD); - SDL_SetTextureColorMod(t, FontColor.r, FontColor.g, FontColor.b); - SDL_UnlockMutex(SDL::GetMutex()); - SDL::RenderCopy(t, static_cast(info->GetAlpha() * 255), &charRect, &rect, info->GetAngle()); rect.x += static_cast(glyph.Advance * scale); } diff --git a/RetroFE/Source/Graphics/Font.cpp b/RetroFE/Source/Graphics/Font.cpp index bb233e8..935eb5b 100644 --- a/RetroFE/Source/Graphics/Font.cpp +++ b/RetroFE/Source/Graphics/Font.cpp @@ -50,46 +50,9 @@ bool Font::GetRect(unsigned int charCode, GlyphInfo &glyph) return false; } -void SetSurfaceAlpha (SDL_Surface *surface, Uint8 alpha) +bool Font::Initialize(std::string fontPath, int fontSize, SDL_Color color) { - SDL_PixelFormat* fmt = surface->format; - - // If surface has no alpha channel, just set the surface alpha. - if( fmt->Amask == 0 ) { - SDL_SetSurfaceAlphaMod( surface, alpha ); - } - // Else change the alpha of each pixel. - else { - unsigned bpp = fmt->BytesPerPixel; - // Scaling factor to clamp alpha to [0, alpha]. - float scale = alpha / 255.0f; - - SDL_LockSurface(surface); - - for (int y = 0; y < surface->h; ++y) - for (int x = 0; x < surface->w; ++x) { - // Get a pointer to the current pixel. - Uint32* pixel_ptr = (Uint32 *)( - (Uint8 *)surface->pixels - + y * surface->pitch - + x * bpp - ); - - // Get the old pixel components. - Uint8 r, g, b, a; - SDL_GetRGBA( *pixel_ptr, fmt, &r, &g, &b, &a ); - - // Set the pixel with the new alpha. - *pixel_ptr = SDL_MapRGBA( fmt, r, g, b, (Uint8)(scale * a) ); - } - - SDL_UnlockSurface(surface); - } -} - -bool Font::Initialize(std::string fontPath, SDL_Color color) -{ - TTF_Font *font = TTF_OpenFont(fontPath.c_str(), 128); + TTF_Font *font = TTF_OpenFont(fontPath.c_str(), fontSize); if (!font) { diff --git a/RetroFE/Source/Graphics/Font.h b/RetroFE/Source/Graphics/Font.h index 83cad32..b23952d 100644 --- a/RetroFE/Source/Graphics/Font.h +++ b/RetroFE/Source/Graphics/Font.h @@ -22,7 +22,7 @@ public: Font(); virtual ~Font(); - bool Initialize(std::string fontPath, SDL_Color color); + bool Initialize(std::string fontPath, int fontSize, SDL_Color color); void DeInitialize(); SDL_Texture *GetTexture(); bool GetRect(unsigned int charCode, GlyphInfo &glyph); diff --git a/RetroFE/Source/Graphics/FontCache.cpp b/RetroFE/Source/Graphics/FontCache.cpp index ee5b715..fb00867 100644 --- a/RetroFE/Source/Graphics/FontCache.cpp +++ b/RetroFE/Source/Graphics/FontCache.cpp @@ -66,14 +66,14 @@ Font *FontCache::GetFont(std::string fontPath) return t; } -bool FontCache::LoadFont(std::string fontPath, SDL_Color color) +bool FontCache::LoadFont(std::string fontPath, int fontSize, SDL_Color color) { std::map::iterator it = FontFaceMap.find(fontPath); if(it == FontFaceMap.end()) { Font *f = new Font(); - f->Initialize(fontPath, color); + f->Initialize(fontPath, fontSize, color); FontFaceMap[fontPath] = f; } diff --git a/RetroFE/Source/Graphics/FontCache.h b/RetroFE/Source/Graphics/FontCache.h index c2fe4db..399ceb4 100644 --- a/RetroFE/Source/Graphics/FontCache.h +++ b/RetroFE/Source/Graphics/FontCache.h @@ -13,7 +13,7 @@ public: void Initialize(); void DeInitialize(); FontCache(); - bool LoadFont(std::string font, SDL_Color color); + bool LoadFont(std::string font, int fontSize, SDL_Color color); Font *GetFont(std::string font); virtual ~FontCache(); diff --git a/RetroFE/Source/Graphics/PageBuilder.cpp b/RetroFE/Source/Graphics/PageBuilder.cpp index 5ae4c83..815c6bf 100644 --- a/RetroFE/Source/Graphics/PageBuilder.cpp +++ b/RetroFE/Source/Graphics/PageBuilder.cpp @@ -54,12 +54,13 @@ PageBuilder::PageBuilder(std::string layoutKey, std::string collection, Configur , ScaleY(1) , ScreenHeight(0) , ScreenWidth(0) + , FontSize(24) , FC(fc) { ScreenWidth = SDL::GetWindowWidth(); ScreenHeight = SDL::GetWindowHeight(); FontColor.a = 255; - FontColor.r = 255; + FontColor.r = 0; FontColor.g = 0; FontColor.b = 0; } @@ -110,6 +111,8 @@ Page *PageBuilder::BuildPage() xml_attribute<> *layoutHeightXml = root->first_attribute("height"); xml_attribute<> *fontXml = root->first_attribute("font"); xml_attribute<> *fontColorXml = root->first_attribute("fontColor"); + xml_attribute<> *fontSizeXml = root->first_attribute("loadFontSize"); + int layoutHeight; int layoutWidth; if(!layoutWidthXml || !layoutHeightXml) @@ -119,7 +122,6 @@ Page *PageBuilder::BuildPage() } if(fontXml) { - //todo: reuse from ComponentBuilder. Not sure how since it relies on knowing the collection std::string fontPropertyKey = "layouts." + LayoutKey + ".font"; Config.SetProperty(fontPropertyKey, fontXml->value()); @@ -145,6 +147,11 @@ Page *PageBuilder::BuildPage() FontColor.r = intColor & 0xFF; } + if(fontSizeXml) + { + FontSize = Utils::ConvertInt(fontSizeXml->value()); + } + layoutWidth = Utils::ConvertInt(layoutWidthXml->value()); layoutHeight = Utils::ConvertInt(layoutHeightXml->value()); @@ -363,7 +370,7 @@ bool PageBuilder::BuildComponents(xml_node<> *layout, Page *page) } else { - FC->LoadFont(Font, FontColor); + FC->LoadFont(Font, FontSize, FontColor); Text *c = new Text(value->value(), FC->GetFont(Font), FontColor, ScaleX, ScaleY); ViewInfo *v = c->GetBaseViewInfo(); @@ -427,7 +434,7 @@ void PageBuilder::LoadReloadableImages(xml_node<> *layout, std::string tagName, { if(type) { - FC->LoadFont(Font, FontColor); + FC->LoadFont(Font, FontSize, FontColor); c = new ReloadableText(type->value(), FC->GetFont(Font), FontColor, LayoutKey, Collection, ScaleX, ScaleY); } } @@ -500,7 +507,7 @@ ScrollingList * PageBuilder::BuildMenu(xml_node<> *menuXml) } // on default, text will be rendered to the menu. Preload it into cache. - FC->LoadFont(Font, FontColor); + FC->LoadFont(Font, FontSize, FontColor); menu = new ScrollingList(Config, ScaleX, ScaleY, FC->GetFont(Font), FontColor, LayoutKey, Collection, imageType); @@ -765,7 +772,7 @@ void PageBuilder::BuildViewInfo(xml_node<> *componentXml, ViewInfo *info, xml_no if(backgroundAlpha) { - info->SetBackgroundAlpha( alpha ? Utils::ConvertFloat(backgroundAlpha->value()) : 1); + info->SetBackgroundAlpha( backgroundAlpha ? Utils::ConvertFloat(backgroundAlpha->value()) : 1); } } diff --git a/RetroFE/Source/Graphics/PageBuilder.h b/RetroFE/Source/Graphics/PageBuilder.h index 23890d0..26ff93a 100644 --- a/RetroFE/Source/Graphics/PageBuilder.h +++ b/RetroFE/Source/Graphics/PageBuilder.h @@ -33,6 +33,7 @@ private: int ScreenWidth; SDL_Color FontColor; std::string Font; + int FontSize; FontCache *FC; //todo: don't need Font itself, just need cache instances void LoadReloadableImages(rapidxml::xml_node<> *layout, std::string tagName, Page *page);