mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2026-03-18 18:02:49 +01:00
Merged develop into default for release 0.7.1.
This commit is contained in:
@@ -499,6 +499,7 @@ void ScrollingList::update(float dt)
|
|||||||
ViewInfo *nextvi = scrollPoints_->at(nextI);
|
ViewInfo *nextvi = scrollPoints_->at(nextI);
|
||||||
|
|
||||||
resetTweens(c, tweenPoints_->at(i), currentvi, nextvi, scrollPeriod_);
|
resetTweens(c, tweenPoints_->at(i), currentvi, nextvi, scrollPeriod_);
|
||||||
|
c->baseViewInfo.font = nextvi->font; // Use the font settings of the next index
|
||||||
c->triggerMenuScrollEvent();
|
c->triggerMenuScrollEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,13 @@ void Text::draw()
|
|||||||
{
|
{
|
||||||
Component::draw();
|
Component::draw();
|
||||||
|
|
||||||
SDL_Texture *t = fontInst_->getTexture();
|
Font *font;
|
||||||
|
if (baseViewInfo.font) // Use font of this specific item if available
|
||||||
|
font = baseViewInfo.font;
|
||||||
|
else // If not, use the general font settings
|
||||||
|
font = fontInst_;
|
||||||
|
|
||||||
|
SDL_Texture *t = font->getTexture();
|
||||||
|
|
||||||
float imageHeight = 0;
|
float imageHeight = 0;
|
||||||
float imageWidth = 0;
|
float imageWidth = 0;
|
||||||
@@ -64,7 +70,7 @@ void Text::draw()
|
|||||||
for(unsigned int i = 0; i < textData_.size(); ++i)
|
for(unsigned int i = 0; i < textData_.size(); ++i)
|
||||||
{
|
{
|
||||||
Font::GlyphInfo glyph;
|
Font::GlyphInfo glyph;
|
||||||
if(fontInst_->getRect(textData_[i], glyph))
|
if(font->getRect(textData_[i], glyph))
|
||||||
{
|
{
|
||||||
if(glyph.minX < 0)
|
if(glyph.minX < 0)
|
||||||
{
|
{
|
||||||
@@ -76,7 +82,7 @@ void Text::draw()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
imageHeight = (float)fontInst_->getHeight();
|
imageHeight = (float)font->getHeight();
|
||||||
float scale = (float)baseViewInfo.FontSize / (float)imageHeight;
|
float scale = (float)baseViewInfo.FontSize / (float)imageHeight;
|
||||||
|
|
||||||
float oldWidth = baseViewInfo.Width;
|
float oldWidth = baseViewInfo.Width;
|
||||||
@@ -105,7 +111,7 @@ void Text::draw()
|
|||||||
{
|
{
|
||||||
Font::GlyphInfo glyph;
|
Font::GlyphInfo glyph;
|
||||||
|
|
||||||
if(fontInst_->getRect(textData_[i], glyph) && glyph.rect.h > 0)
|
if(font->getRect(textData_[i], glyph) && glyph.rect.h > 0)
|
||||||
{
|
{
|
||||||
SDL_Rect charRect = glyph.rect;
|
SDL_Rect charRect = glyph.rect;
|
||||||
float h = static_cast<float>(charRect.h * scale);
|
float h = static_cast<float>(charRect.h * scale);
|
||||||
@@ -118,9 +124,9 @@ void Text::draw()
|
|||||||
{
|
{
|
||||||
rect.x += static_cast<int>((float)(glyph.minX) * scale);
|
rect.x += static_cast<int>((float)(glyph.minX) * scale);
|
||||||
}
|
}
|
||||||
if(fontInst_->getAscent() < glyph.maxY)
|
if(font->getAscent() < glyph.maxY)
|
||||||
{
|
{
|
||||||
rect.y += static_cast<int>((fontInst_->getAscent() - glyph.maxY)*scale);
|
rect.y += static_cast<int>((font->getAscent() - glyph.maxY)*scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -482,17 +482,17 @@ Font *PageBuilder::addFont(xml_node<> *component, xml_node<> *defaults)
|
|||||||
|
|
||||||
if(defaults)
|
if(defaults)
|
||||||
{
|
{
|
||||||
if(defaults->first_attribute("font"))
|
if(!fontXml && defaults->first_attribute("font"))
|
||||||
{
|
{
|
||||||
fontXml = defaults->first_attribute("font");
|
fontXml = defaults->first_attribute("font");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(defaults->first_attribute("fontColor"))
|
if(!fontColorXml && defaults->first_attribute("fontColor"))
|
||||||
{
|
{
|
||||||
fontColorXml = defaults->first_attribute("fontColor");
|
fontColorXml = defaults->first_attribute("fontColor");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(defaults->first_attribute("loadFontSize"))
|
if(!fontSizeXml && defaults->first_attribute("loadFontSize"))
|
||||||
{
|
{
|
||||||
fontSizeXml = defaults->first_attribute("loadFontSize");
|
fontSizeXml = defaults->first_attribute("loadFontSize");
|
||||||
}
|
}
|
||||||
@@ -843,6 +843,7 @@ void PageBuilder::buildViewInfo(xml_node<> *componentXml, ViewInfo &info, xml_no
|
|||||||
xml_attribute<> *height = findAttribute(componentXml, "height", defaultXml);
|
xml_attribute<> *height = findAttribute(componentXml, "height", defaultXml);
|
||||||
xml_attribute<> *width = findAttribute(componentXml, "width", defaultXml);
|
xml_attribute<> *width = findAttribute(componentXml, "width", defaultXml);
|
||||||
xml_attribute<> *fontSize = findAttribute(componentXml, "fontSize", defaultXml);
|
xml_attribute<> *fontSize = findAttribute(componentXml, "fontSize", defaultXml);
|
||||||
|
xml_attribute<> *fontColor = findAttribute(componentXml, "fontColor", defaultXml);
|
||||||
xml_attribute<> *minHeight = findAttribute(componentXml, "minHeight", defaultXml);
|
xml_attribute<> *minHeight = findAttribute(componentXml, "minHeight", defaultXml);
|
||||||
xml_attribute<> *minWidth = findAttribute(componentXml, "minWidth", defaultXml);
|
xml_attribute<> *minWidth = findAttribute(componentXml, "minWidth", defaultXml);
|
||||||
xml_attribute<> *maxHeight = findAttribute(componentXml, "maxHeight", defaultXml);
|
xml_attribute<> *maxHeight = findAttribute(componentXml, "maxHeight", defaultXml);
|
||||||
@@ -885,6 +886,12 @@ void PageBuilder::buildViewInfo(xml_node<> *componentXml, ViewInfo &info, xml_no
|
|||||||
info.Angle = angle ? Utils::convertFloat(angle->value()) : 0.f;
|
info.Angle = angle ? Utils::convertFloat(angle->value()) : 0.f;
|
||||||
info.Layer = layer ? Utils::convertInt(layer->value()) : 0;
|
info.Layer = layer ? Utils::convertInt(layer->value()) : 0;
|
||||||
|
|
||||||
|
if(fontColor)
|
||||||
|
{
|
||||||
|
Font *font = addFont(componentXml, defaultXml);
|
||||||
|
info.font = font;
|
||||||
|
}
|
||||||
|
|
||||||
if(backgroundColor)
|
if(backgroundColor)
|
||||||
{
|
{
|
||||||
std::stringstream ss(backgroundColor->value());
|
std::stringstream ss(backgroundColor->value());
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ ViewInfo::ViewInfo()
|
|||||||
, ImageWidth(0)
|
, ImageWidth(0)
|
||||||
, ImageHeight(0)
|
, ImageHeight(0)
|
||||||
, FontSize(-1)
|
, FontSize(-1)
|
||||||
|
, font(0)
|
||||||
, Angle(0)
|
, Angle(0)
|
||||||
, Alpha(1)
|
, Alpha(1)
|
||||||
, Layer(0)
|
, Layer(0)
|
||||||
|
|||||||
@@ -19,6 +19,8 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
|
class Font;
|
||||||
|
|
||||||
class ViewInfo
|
class ViewInfo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -53,6 +55,7 @@ public:
|
|||||||
float ImageWidth;
|
float ImageWidth;
|
||||||
float ImageHeight;
|
float ImageHeight;
|
||||||
float FontSize;
|
float FontSize;
|
||||||
|
Font *font;
|
||||||
float Angle;
|
float Angle;
|
||||||
float Alpha;
|
float Alpha;
|
||||||
unsigned int Layer;
|
unsigned int Layer;
|
||||||
|
|||||||
Reference in New Issue
Block a user