mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2026-01-27 02:05:06 +01:00
Added background image color support. Changed "transparency" to "alpha" for layouts. Fixed code syling.
This commit is contained in:
parent
ccdafb0e8f
commit
d309c3b96f
@ -10,20 +10,20 @@
|
||||
<menu imageType="title" algorithm="easeincircular" x="center" y="center" xOrigin="center" yOrigin="center" speed="0.05" acceleration="0.05" height="25">
|
||||
<!-- todo: the menu does not support the standard onEnter onExit, onHighlightEnter onHighlightExit tags like the rest of the system does. -->
|
||||
|
||||
<item xOffset="-500" yOffset="0" layer="1" fontSize="5" height="0" transparency="0" />
|
||||
<item xOffset="-650" yOffset="200" layer="2" fontSize="7" height="30" transparency="0.1"/>
|
||||
<item xOffset="-700" yOffset="300" layer="3" fontSize="10" height="60" transparency="0.25"/>
|
||||
<item xOffset="-500" yOffset="350" layer="4" fontSize="20" height="100" transparency="0.5"/>
|
||||
<item xOffset="0" yOffset="375" layer="5" fontSize="40" height="200" transparency="1" selected="true" />
|
||||
<item xOffset="500" yOffset="350" layer="4" fontSize="20" height="100" transparency="0.5"/>
|
||||
<item xOffset="700" yOffset="300" layer="3" fontSize="10" height="60" transparency="0.25"/>
|
||||
<item xOffset="650" yOffset="200" layer="2" fontSize="7" height="30" transparency="0.1"/>
|
||||
<item xOffset="500" yOffset="1" layer="1" fontSize="5" height="0" transparency="0"/>
|
||||
<item xOffset="-500" yOffset="0" layer="1" fontSize="5" height="0" alpha="0" />
|
||||
<item xOffset="-650" yOffset="200" layer="2" fontSize="7" height="30" alpha="0.1"/>
|
||||
<item xOffset="-700" yOffset="300" layer="3" fontSize="10" height="60" alpha="0.25"/>
|
||||
<item xOffset="-500" yOffset="350" layer="4" fontSize="20" height="100" alpha="0.5"/>
|
||||
<item xOffset="0" yOffset="375" layer="5" fontSize="40" height="200" alpha="1" selected="true" />
|
||||
<item xOffset="500" yOffset="350" layer="4" fontSize="20" height="100" alpha="0.5"/>
|
||||
<item xOffset="700" yOffset="300" layer="3" fontSize="10" height="60" alpha="0.25"/>
|
||||
<item xOffset="650" yOffset="200" layer="2" fontSize="7" height="30" alpha="0.1"/>
|
||||
<item xOffset="500" yOffset="1" layer="1" fontSize="5" height="0" alpha="0"/>
|
||||
</menu>
|
||||
|
||||
<image x="center" y="center" height="stretch" width="stretch" xOrigin="center" yOrigin="center" src="background.png" layer="0" transparency="0.5"/>
|
||||
<image x="center" y="center" height="stretch" width="stretch" xOrigin="center" yOrigin="center" src="background.png" layer="0" alpha="0.5"/>
|
||||
|
||||
<image x="30" y="20" height="80" src="logo.png" layer="1" transparency="0.3">
|
||||
<image x="30" y="20" height="80" src="logo.png" layer="1" alpha="0.3">
|
||||
<onEnter>
|
||||
<set duration=".5">
|
||||
<animate type="y" from="top" to="20" algorithm="easeinquadratic"/>
|
||||
@ -97,24 +97,24 @@
|
||||
<set duration=".2">
|
||||
<animate type="y" from="bottom" to="100" algorithm="easeinoutquadratic"/>
|
||||
<animate type="width" from="0" to="400" algorithm="easeoutquadratic"/>
|
||||
<animate type="transparency" from="0" to="0.5" algorithm="easeinquadratic"/>
|
||||
<animate type="alpha" from="0" to="0.5" algorithm="easeinquadratic"/>
|
||||
</set>
|
||||
<set duration=".2">
|
||||
<animate type="y" from="100" to="130" algorithm="easeinoutquadratic"/>
|
||||
<animate type="width" from="400" to="800" algorithm="easeoutquadratic"/>
|
||||
<animate type="transparency" from=".5" to="0.75" algorithm="easeinquadratic"/>
|
||||
<animate type="alpha" from=".5" to="0.75" algorithm="easeinquadratic"/>
|
||||
</set>
|
||||
</onHighlightEnter>
|
||||
<onHighlightExit>
|
||||
<set duration=".2">
|
||||
<animate type="y" to="100" from="130" algorithm="easeinoutquadratic"/>
|
||||
<animate type="width" to="400" from="800" algorithm="easeoutquadratic"/>
|
||||
<animate type="transparency" from=".75" to="0.5" algorithm="easeinquadratic"/>
|
||||
<animate type="alpha" from=".75" to="0.5" algorithm="easeinquadratic"/>
|
||||
</set>
|
||||
<set duration=".2">
|
||||
<animate type="y" to="bottom" from="100" algorithm="easeinoutquadratic"/>
|
||||
<animate type="width" to="0" from="400" algorithm="easeoutquadratic"/>
|
||||
<animate type="transparency" to="0.5" from="0" algorithm="easeinquadratic"/>
|
||||
<animate type="alpha" to="0.5" from="0" algorithm="easeinquadratic"/>
|
||||
</set>
|
||||
</onHighlightExit>
|
||||
|
||||
|
||||
@ -10,20 +10,20 @@
|
||||
<menu imageType="title" algorithm="easeincircular" x="center" y="center" xOrigin="center" yOrigin="center" speed="0.05" acceleration="0.05" height="25">
|
||||
<!-- todo: the menu does not support the standard onEnter onExit, onHighlightEnter onHighlightExit tags like the rest of the system does. -->
|
||||
|
||||
<item xOffset="-100" yOffset="-120" layer="1" fontSize="5" height="15" transparency="0" />
|
||||
<item xOffset="-250" yOffset="-80" layer="2" fontSize="7" height="20" transparency="0.1"/>
|
||||
<item xOffset="-400" yOffset="0" layer="3" fontSize="10" height="30" transparency="0.25"/>
|
||||
<item xOffset="-300" yOffset="133" layer="4" fontSize="20" height="60" transparency="0.5"/>
|
||||
<item xOffset="0" yOffset="175" layer="5" fontSize="40" height="150" transparency="1" selected="true" />
|
||||
<item xOffset="300" yOffset="133" layer="4" fontSize="20" height="60" transparency="0.5"/>
|
||||
<item xOffset="400" yOffset="0" layer="3" fontSize="10" height="30" transparency="0.25"/>
|
||||
<item xOffset="250" yOffset="-80" layer="2" fontSize="7" height="15" transparency="0.1"/>
|
||||
<item xOffset="100" yOffset="-120" layer="1" fontSize="5" height="0" transparency="0"/>
|
||||
<item xOffset="-100" yOffset="-120" layer="1" fontSize="5" height="15" alpha="0" />
|
||||
<item xOffset="-250" yOffset="-80" layer="2" fontSize="7" height="20" alpha="0.1"/>
|
||||
<item xOffset="-400" yOffset="0" layer="3" fontSize="10" height="30" alpha="0.25"/>
|
||||
<item xOffset="-300" yOffset="133" layer="4" fontSize="20" height="60" alpha="0.5"/>
|
||||
<item xOffset="0" yOffset="175" layer="5" fontSize="40" height="150" alpha="1" selected="true" />
|
||||
<item xOffset="300" yOffset="133" layer="4" fontSize="20" height="60" alpha="0.5"/>
|
||||
<item xOffset="400" yOffset="0" layer="3" fontSize="10" height="30" alpha="0.25"/>
|
||||
<item xOffset="250" yOffset="-80" layer="2" fontSize="7" height="15" alpha="0.1"/>
|
||||
<item xOffset="100" yOffset="-120" layer="1" fontSize="5" height="0" alpha="0"/>
|
||||
</menu>
|
||||
|
||||
<image x="center" y="center" height="stretch" width="stretch" xOrigin="center" yOrigin="center" src="background.png" layer="0" transparency="0.5"/>
|
||||
<image x="center" y="center" height="stretch" width="stretch" xOrigin="center" yOrigin="center" src="background.png" layer="0" alpha="0.5"/>
|
||||
|
||||
<image x="30" y="20" height="50" src="logo.png" layer="1" transparency="0.3">
|
||||
<image x="30" y="20" height="50" src="logo.png" layer="1" alpha="0.3">
|
||||
<onEnter>
|
||||
<set duration=".5">
|
||||
<animate type="y" from="top" to="20" algorithm="easeinquadratic"/>
|
||||
@ -59,24 +59,24 @@
|
||||
<set duration=".2">
|
||||
<animate type="y" from="bottom" to="100" algorithm="easeinoutquadratic"/>
|
||||
<animate type="width" from="0" to="200" algorithm="easeoutquadratic"/>
|
||||
<animate type="transparency" from="0" to="0.5" algorithm="easeinquadratic"/>
|
||||
<animate type="alpha" from="0" to="0.5" algorithm="easeinquadratic"/>
|
||||
</set>
|
||||
<set duration=".2">
|
||||
<animate type="y" from="100" to="130" algorithm="easeinoutquadratic"/>
|
||||
<animate type="width" from="200" to="320" algorithm="easeoutquadratic"/>
|
||||
<animate type="transparency" from=".5" to="0.75" algorithm="easeinquadratic"/>
|
||||
<animate type="alpha" from=".5" to="0.75" algorithm="easeinquadratic"/>
|
||||
</set>
|
||||
</onHighlightEnter>
|
||||
<onHighlightExit>
|
||||
<set duration=".2">
|
||||
<animate type="y" to="100" from="130" algorithm="easeinoutquadratic"/>
|
||||
<animate type="width" to="200" from="320" algorithm="easeoutquadratic"/>
|
||||
<animate type="transparency" from=".75" to="0.5" algorithm="easeinquadratic"/>
|
||||
<animate type="alpha" from=".75" to="0.5" algorithm="easeinquadratic"/>
|
||||
</set>
|
||||
<set duration=".2">
|
||||
<animate type="y" to="bottom" from="100" algorithm="easeinoutquadratic"/>
|
||||
<animate type="width" to="0" from="200" algorithm="easeoutquadratic"/>
|
||||
<animate type="transparency" to="0.5" from="0" algorithm="easeinquadratic"/>
|
||||
<animate type="alpha" to="0.5" from="0" algorithm="easeinquadratic"/>
|
||||
</set>
|
||||
</onHighlightExit>
|
||||
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
/* This file is subject to the terms and conditions defined in
|
||||
* file 'LICENSE.txt', which is part of this source code package.
|
||||
/* This file is subject to the terms and conditions defined in
|
||||
* file 'LICENSE.txt', which is part of this source code package.
|
||||
*/
|
||||
#include "AttractMode.h"
|
||||
#include "../Graphics/Page.h"
|
||||
|
||||
AttractMode::AttractMode()
|
||||
: IsActive(false)
|
||||
, ElapsedTime(0)
|
||||
, ActiveTime(0)
|
||||
, IdleTime(0)
|
||||
: IsActive(false)
|
||||
, ElapsedTime(0)
|
||||
, ActiveTime(0)
|
||||
, IdleTime(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@ -18,5 +18,5 @@ private:
|
||||
float ElapsedTime;
|
||||
float ActiveTime;
|
||||
float IdleTime;
|
||||
|
||||
|
||||
};
|
||||
|
||||
@ -34,7 +34,7 @@ bool Tween::GetTweenProperty(std::string name, TweenProperty &property)
|
||||
TweenPropertyMap["x"] = TWEEN_PROPERTY_X;
|
||||
TweenPropertyMap["y"] = TWEEN_PROPERTY_Y;
|
||||
TweenPropertyMap["angle"] = TWEEN_PROPERTY_ANGLE;
|
||||
TweenPropertyMap["transparency"] = TWEEN_PROPERTY_TRANSPARENCY;
|
||||
TweenPropertyMap["alpha"] = TWEEN_PROPERTY_ALPHA;
|
||||
TweenPropertyMap["width"] = TWEEN_PROPERTY_WIDTH;
|
||||
TweenPropertyMap["height"] = TWEEN_PROPERTY_HEIGHT;
|
||||
TweenPropertyMap["xorigin"] = TWEEN_PROPERTY_X_ORIGIN;
|
||||
|
||||
@ -34,7 +34,7 @@ enum TweenProperty
|
||||
TWEEN_PROPERTY_HEIGHT,
|
||||
TWEEN_PROPERTY_WIDTH,
|
||||
TWEEN_PROPERTY_ANGLE,
|
||||
TWEEN_PROPERTY_TRANSPARENCY,
|
||||
TWEEN_PROPERTY_ALPHA,
|
||||
TWEEN_PROPERTY_X,
|
||||
TWEEN_PROPERTY_Y,
|
||||
TWEEN_PROPERTY_X_ORIGIN,
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
#include "../Animate/Tween.h"
|
||||
#include "../../Graphics/ViewInfo.h"
|
||||
#include "../../Utility/Log.h"
|
||||
#include "../../SDL.h"
|
||||
|
||||
Component::Component()
|
||||
{
|
||||
@ -15,8 +16,8 @@ Component::Component()
|
||||
OnHighlightExitTweens = NULL;
|
||||
SelectedItem = NULL;
|
||||
NewItemSelectedSinceEnter = false;
|
||||
BackgroundTexture = NULL;
|
||||
FreeGraphicsMemory();
|
||||
|
||||
}
|
||||
|
||||
Component::~Component()
|
||||
@ -34,11 +35,27 @@ void Component::FreeGraphicsMemory()
|
||||
CurrentTweens = NULL;
|
||||
CurrentTweenIndex = 0;
|
||||
CurrentTweenComplete = false;
|
||||
ElapsedTweenTime =0;
|
||||
ElapsedTweenTime = 0;
|
||||
ScrollActive = false;
|
||||
|
||||
if(BackgroundTexture)
|
||||
{
|
||||
SDL_DestroyTexture(BackgroundTexture);
|
||||
BackgroundTexture = NULL;
|
||||
}
|
||||
}
|
||||
void Component::AllocateGraphicsMemory()
|
||||
{
|
||||
if(!BackgroundTexture)
|
||||
{
|
||||
// make a 4x4 pixel wide surface to be stretched during rendering, make it a white background so we can use
|
||||
// color later
|
||||
SDL_Surface *surface = SDL_CreateRGBSurface(0, 4, 4, 32, 0, 0, 0, 0);
|
||||
SDL_FillRect(surface, NULL, SDL_MapRGB(surface->format, 255, 255, 255));
|
||||
BackgroundTexture = SDL_CreateTextureFromSurface(SDL::GetRenderer(), surface);
|
||||
SDL_FreeSurface(surface);
|
||||
SDL_SetTextureBlendMode(BackgroundTexture, SDL_BLENDMODE_BLEND);
|
||||
}
|
||||
}
|
||||
|
||||
void Component::TriggerEnterEvent()
|
||||
@ -72,8 +89,6 @@ bool Component::IsWaiting()
|
||||
return (CurrentAnimationState == HIGHLIGHT_WAIT);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Component::Update(float dt)
|
||||
{
|
||||
ElapsedTweenTime += dt;
|
||||
@ -184,6 +199,22 @@ void Component::Update(float dt)
|
||||
CurrentTweenComplete = Animate(IsIdle());
|
||||
}
|
||||
|
||||
void Component::Draw()
|
||||
{
|
||||
ViewInfo *info = GetBaseViewInfo();
|
||||
SDL_Rect rect;
|
||||
rect.h = static_cast<int>(info->GetHeight());
|
||||
rect.w = static_cast<int>(info->GetWidth());
|
||||
rect.x = static_cast<int>(info->GetXRelativeToOrigin());
|
||||
rect.y = static_cast<int>(info->GetYRelativeToOrigin());
|
||||
|
||||
SDL_SetTextureColorMod(BackgroundTexture,
|
||||
static_cast<char>(info->GetBackgroundRed()*255),
|
||||
static_cast<char>(info->GetBackgroundGreen()*255),
|
||||
static_cast<char>(info->GetBackgroundBlue()*255));
|
||||
|
||||
SDL::RenderCopy(BackgroundTexture, static_cast<char>(info->GetBackgroundAlpha()*255), NULL, &rect, info->GetAngle());
|
||||
}
|
||||
|
||||
bool Component::Animate(bool loop)
|
||||
{
|
||||
@ -236,8 +267,8 @@ bool Component::Animate(bool loop)
|
||||
GetBaseViewInfo()->SetAngle(value);
|
||||
break;
|
||||
|
||||
case TWEEN_PROPERTY_TRANSPARENCY:
|
||||
GetBaseViewInfo()->SetTransparency(value);
|
||||
case TWEEN_PROPERTY_ALPHA:
|
||||
GetBaseViewInfo()->SetAlpha(value);
|
||||
break;
|
||||
|
||||
case TWEEN_PROPERTY_X_ORIGIN:
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "../../SDL.h"
|
||||
#include "../MenuNotifierInterface.h"
|
||||
#include "../ViewInfo.h"
|
||||
#include "../Animate/Tween.h"
|
||||
@ -53,7 +54,7 @@ public:
|
||||
}
|
||||
virtual void Update(float dt);
|
||||
|
||||
virtual void Draw() = 0;
|
||||
virtual void Draw();
|
||||
|
||||
ViewInfo *GetBaseViewInfo()
|
||||
{
|
||||
@ -119,4 +120,6 @@ private:
|
||||
Tween *TweenInst;
|
||||
Item *SelectedItem;
|
||||
bool ScrollActive;
|
||||
SDL_Texture *BackgroundTexture;
|
||||
|
||||
};
|
||||
|
||||
@ -60,6 +60,8 @@ void Image::AllocateGraphicsMemory()
|
||||
|
||||
void Image::Draw()
|
||||
{
|
||||
Component::Draw();
|
||||
|
||||
if(Texture)
|
||||
{
|
||||
ViewInfo *info = GetBaseViewInfo();
|
||||
@ -70,6 +72,6 @@ void Image::Draw()
|
||||
rect.h = static_cast<int>(info->GetHeight());
|
||||
rect.w = static_cast<int>(info->GetWidth());
|
||||
|
||||
SDL::RenderCopy(Texture, static_cast<char>((info->GetTransparency() * 255)), NULL, &rect, info->GetAngle());
|
||||
SDL::RenderCopy(Texture, static_cast<char>((info->GetAlpha() * 255)), NULL, &rect, info->GetAngle());
|
||||
}
|
||||
}
|
||||
|
||||
@ -162,6 +162,8 @@ void ReloadableMedia::Draw()
|
||||
{
|
||||
ViewInfo *info = GetBaseViewInfo();
|
||||
|
||||
Component::Draw();
|
||||
|
||||
if(LoadedComponent)
|
||||
{
|
||||
info->SetImageHeight(LoadedComponent->GetBaseViewInfo()->GetImageHeight());
|
||||
|
||||
@ -61,11 +61,11 @@ ScrollingList::~ScrollingList()
|
||||
{
|
||||
if(SpriteList)
|
||||
{
|
||||
std::vector<ComponentItemBinding *>::iterator it = SpriteList->begin();
|
||||
std::vector<ComponentItemBinding *>::iterator it = SpriteList->begin();
|
||||
|
||||
while(it != SpriteList->end())
|
||||
{
|
||||
if(*it != NULL)
|
||||
if(*it != NULL)
|
||||
{
|
||||
DeallocateTexture(*it);
|
||||
if((*it)->GetCollectionItem())
|
||||
@ -76,9 +76,9 @@ ScrollingList::~ScrollingList()
|
||||
delete *it;
|
||||
}
|
||||
|
||||
SpriteList->erase(it);
|
||||
|
||||
it = SpriteList->begin();
|
||||
SpriteList->erase(it);
|
||||
|
||||
it = SpriteList->begin();
|
||||
}
|
||||
|
||||
delete SpriteList;
|
||||
@ -329,7 +329,7 @@ void ScrollingList::Update(float dt)
|
||||
spriteViewInfo->SetYOffset(Tween::AnimateSingle(LINEAR, currentViewInfo->GetYOffset(), nextViewInfo->GetYOffset(), scrollPeriod, CurrentAnimateTime));
|
||||
spriteViewInfo->SetHeight(Tween::AnimateSingle(LINEAR, currentViewInfo->GetHeight(), nextViewInfo->GetHeight(), scrollPeriod, CurrentAnimateTime));
|
||||
spriteViewInfo->SetWidth(Tween::AnimateSingle(LINEAR, currentViewInfo->GetWidth(), nextViewInfo->GetWidth(), scrollPeriod, CurrentAnimateTime));
|
||||
spriteViewInfo->SetTransparency(Tween::AnimateSingle(LINEAR, currentViewInfo->GetTransparency(), nextViewInfo->GetTransparency(), scrollPeriod, CurrentAnimateTime));
|
||||
spriteViewInfo->SetAlpha(Tween::AnimateSingle(LINEAR, currentViewInfo->GetAlpha(), nextViewInfo->GetAlpha(), scrollPeriod, CurrentAnimateTime));
|
||||
spriteViewInfo->SetAngle(Tween::AnimateSingle(LINEAR, currentViewInfo->GetAngle(), nextViewInfo->GetAngle(), scrollPeriod, CurrentAnimateTime));
|
||||
spriteViewInfo->SetFontSize(Tween::AnimateSingle(LINEAR, currentViewInfo->GetFontSize(), nextViewInfo->GetFontSize(), scrollPeriod, CurrentAnimateTime));
|
||||
c->Update(dt);
|
||||
|
||||
@ -36,6 +36,8 @@ void Text::AllocateGraphicsMemory()
|
||||
|
||||
void Text::Draw()
|
||||
{
|
||||
Component::Draw();
|
||||
|
||||
SDL_Texture *t = FontInst->GetTexture();
|
||||
|
||||
ViewInfo *info = GetBaseViewInfo();
|
||||
@ -89,7 +91,7 @@ void Text::Draw()
|
||||
SDL_SetTextureColorMod(t, FontColor.r, FontColor.g, FontColor.b);
|
||||
SDL_UnlockMutex(SDL::GetMutex());
|
||||
|
||||
SDL::RenderCopy(t, static_cast<char>(info->GetTransparency() * 255), &charRect, &rect, info->GetAngle());
|
||||
SDL::RenderCopy(t, static_cast<char>(info->GetAlpha() * 255), &charRect, &rect, info->GetAngle());
|
||||
rect.x += static_cast<int>(glyph.Advance * scale);
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,6 +79,6 @@ void VideoComponent::Draw()
|
||||
|
||||
if(texture)
|
||||
{
|
||||
SDL::RenderCopy(texture, static_cast<int>(info->GetTransparency() * 255), NULL, &rect, info->GetAngle());
|
||||
SDL::RenderCopy(texture, static_cast<int>(info->GetAlpha() * 255), NULL, &rect, info->GetAngle());
|
||||
}
|
||||
}
|
||||
|
||||
@ -523,9 +523,11 @@ void PageBuilder::BuildViewInfo(xml_node<> *componentXml, ViewInfo *info)
|
||||
xml_attribute<> *minWidth = FindRecursiveAttribute(componentXml, "minWidth");
|
||||
xml_attribute<> *maxHeight = FindRecursiveAttribute(componentXml, "maxHeight");
|
||||
xml_attribute<> *maxWidth = FindRecursiveAttribute(componentXml, "maxWidth");
|
||||
xml_attribute<> *transparency = FindRecursiveAttribute(componentXml, "transparency");
|
||||
xml_attribute<> *alpha = FindRecursiveAttribute(componentXml, "alpha");
|
||||
xml_attribute<> *angle = FindRecursiveAttribute(componentXml, "angle");
|
||||
xml_attribute<> *layer = FindRecursiveAttribute(componentXml, "layer");
|
||||
xml_attribute<> *backgroundColor = FindRecursiveAttribute(componentXml, "backgroundColor");
|
||||
xml_attribute<> *backgroundAlpha = FindRecursiveAttribute(componentXml, "backgroundAlpha");
|
||||
|
||||
info->SetX(GetHorizontalAlignment(x, 0));
|
||||
info->SetY(GetVerticalAlignment(y, 0));
|
||||
@ -552,18 +554,37 @@ void PageBuilder::BuildViewInfo(xml_node<> *componentXml, ViewInfo *info)
|
||||
info->SetWidth(GetHorizontalAlignment(width, -1));
|
||||
}
|
||||
info->SetFontSize(GetVerticalAlignment(fontSize, -1));
|
||||
/*
|
||||
std::stringstream ss;
|
||||
ss << "font size is \"" << info->GetFontSize() << "\"";
|
||||
Logger::Write(Logger::ZONE_ERROR, "Layout", ss.str());
|
||||
*/
|
||||
info->SetMinHeight(GetVerticalAlignment(minHeight, 0));
|
||||
info->SetMinWidth(GetHorizontalAlignment(minWidth, 0));
|
||||
info->SetMaxHeight(GetVerticalAlignment(maxHeight, FLT_MAX));
|
||||
info->SetMaxWidth(GetVerticalAlignment(maxWidth, FLT_MAX));
|
||||
info->SetTransparency( transparency ? Utils::ConvertFloat(transparency->value()) : 1);
|
||||
info->SetAlpha( alpha ? Utils::ConvertFloat(alpha->value()) : 1);
|
||||
info->SetAngle( angle ? Utils::ConvertFloat(angle->value()) : 0);
|
||||
info->SetLayer( layer ? Utils::ConvertInt(layer->value()) : 0);
|
||||
|
||||
if(backgroundColor)
|
||||
{
|
||||
std::stringstream ss(backgroundColor->value());
|
||||
int num;
|
||||
ss >> std::hex >> num;
|
||||
int red = num / 0x10000;
|
||||
int green = (num / 0x100) % 0x100;
|
||||
int blue = num % 0x100;
|
||||
|
||||
info->SetBackgroundRed(static_cast<float>(red)/255);
|
||||
info->SetBackgroundGreen(static_cast<float>(green)/255);
|
||||
info->SetBackgroundBlue(static_cast<float>(blue)/255);
|
||||
}
|
||||
|
||||
if(backgroundAlpha)
|
||||
{
|
||||
std::stringstream ss(backgroundAlpha->value());
|
||||
int num;
|
||||
ss >> std::hex >> num;
|
||||
|
||||
info->SetBackgroundAlpha(static_cast<float>(num)/255);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -23,8 +23,12 @@ ViewInfo::ViewInfo()
|
||||
, ImageHeight(0)
|
||||
, FontSize(-1)
|
||||
, Angle(0)
|
||||
, Transparency(1)
|
||||
, Alpha(1)
|
||||
, Layer(0)
|
||||
, BackgroundRed(0)
|
||||
, BackgroundGreen(0)
|
||||
, BackgroundBlue(0)
|
||||
, BackgroundAlpha(0)
|
||||
{
|
||||
}
|
||||
|
||||
@ -201,14 +205,14 @@ void ViewInfo::SetMinWidth(float minwidth)
|
||||
MinWidth = minwidth;
|
||||
}
|
||||
|
||||
float ViewInfo::GetTransparency() const
|
||||
float ViewInfo::GetAlpha() const
|
||||
{
|
||||
return Transparency;
|
||||
return Alpha;
|
||||
}
|
||||
|
||||
void ViewInfo::SetTransparency(float transparency)
|
||||
void ViewInfo::SetAlpha(float alpha)
|
||||
{
|
||||
Transparency = transparency;
|
||||
Alpha = alpha;
|
||||
}
|
||||
|
||||
float ViewInfo::GetX() const
|
||||
@ -298,3 +302,43 @@ void ViewInfo::SetFontSize(float fontSize)
|
||||
{
|
||||
FontSize = fontSize;
|
||||
}
|
||||
|
||||
|
||||
float ViewInfo::GetBackgroundRed()
|
||||
{
|
||||
return BackgroundRed;
|
||||
}
|
||||
|
||||
void ViewInfo::SetBackgroundRed(float value)
|
||||
{
|
||||
BackgroundRed = value;
|
||||
}
|
||||
|
||||
float ViewInfo::GetBackgroundGreen()
|
||||
{
|
||||
return BackgroundGreen;
|
||||
}
|
||||
|
||||
void ViewInfo::SetBackgroundGreen(float value)
|
||||
{
|
||||
BackgroundGreen = value;
|
||||
}
|
||||
float ViewInfo::GetBackgroundBlue()
|
||||
{
|
||||
return BackgroundBlue;
|
||||
}
|
||||
|
||||
void ViewInfo::SetBackgroundBlue(float value)
|
||||
{
|
||||
BackgroundBlue = value;
|
||||
}
|
||||
|
||||
float ViewInfo::GetBackgroundAlpha()
|
||||
{
|
||||
return BackgroundAlpha;
|
||||
}
|
||||
|
||||
void ViewInfo::SetBackgroundAlpha(float value)
|
||||
{
|
||||
BackgroundAlpha = value;
|
||||
}
|
||||
@ -35,8 +35,8 @@ public:
|
||||
void SetMinHeight(float minheight);
|
||||
float GetMinWidth() const;
|
||||
void SetMinWidth(float minwidth);
|
||||
float GetTransparency() const;
|
||||
void SetTransparency(float transparency);
|
||||
float GetAlpha() const;
|
||||
void SetAlpha(float alpha);
|
||||
float GetX() const;
|
||||
void SetX(float x);
|
||||
float GetXOffset() const;
|
||||
@ -54,6 +54,15 @@ public:
|
||||
float GetRawWidth();
|
||||
float GetRawHeight();
|
||||
|
||||
float GetBackgroundRed();
|
||||
void SetBackgroundRed(float value);
|
||||
float GetBackgroundGreen();
|
||||
void SetBackgroundGreen(float value);
|
||||
float GetBackgroundBlue();
|
||||
void SetBackgroundBlue(float value);
|
||||
float GetBackgroundAlpha();
|
||||
void SetBackgroundAlpha(float value);
|
||||
|
||||
void SetHeight(float height);
|
||||
void SetWidth(float width);
|
||||
float GetFontSize() const;
|
||||
@ -82,8 +91,12 @@ private:
|
||||
float ImageHeight;
|
||||
float FontSize;
|
||||
float Angle;
|
||||
float Transparency;
|
||||
float Alpha;
|
||||
unsigned int Layer;
|
||||
float HorizontalScale;
|
||||
float VerticalScale;
|
||||
float BackgroundRed;
|
||||
float BackgroundGreen;
|
||||
float BackgroundBlue;
|
||||
float BackgroundAlpha;
|
||||
};
|
||||
|
||||
@ -279,7 +279,7 @@ bool RetroFE::Back(bool &exit)
|
||||
bool exitOnBack = false;
|
||||
Config.GetProperty("exitOnFirstPageBack", exitOnBack);
|
||||
exit = false;
|
||||
|
||||
|
||||
if(PageChain.size() > 1)
|
||||
{
|
||||
Page *page = PageChain.back();
|
||||
@ -374,7 +374,7 @@ Page *RetroFE::LoadPage(std::string collectionName)
|
||||
Logger::Write(Logger::ZONE_INFO, "RetroFE", "Creating page for collection " + collectionName);
|
||||
|
||||
Page *page = NULL;
|
||||
|
||||
|
||||
std::vector<Item *> *collection = GetCollection(collectionName);
|
||||
std::string layoutName = GetLayout(collectionName);
|
||||
|
||||
@ -387,7 +387,7 @@ Page *RetroFE::LoadPage(std::string collectionName)
|
||||
PageBuilder pb(layoutName, collectionName, Config, &FC);
|
||||
page = pb.BuildPage();
|
||||
|
||||
if(!page)
|
||||
if(!page)
|
||||
{
|
||||
Logger::Write(Logger::ZONE_ERROR, "RetroFE", "Could not create page for " + collectionName);
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ private:
|
||||
RETROFE_STATE ProcessUserInput(Page *page);
|
||||
void Update(float dt, bool scrollActive);
|
||||
std::string GetLayout(std::string collectionName);
|
||||
std::vector<Item *> *GetCollection(std::string collectionName);
|
||||
std::vector<Item *> *GetCollection(std::string collectionName);
|
||||
Configuration &Config;
|
||||
CollectionDatabase &CollectionDB;
|
||||
UserInput Input;
|
||||
|
||||
@ -230,8 +230,7 @@ SDL_Window* SDL::GetWindow()
|
||||
return Window;
|
||||
}
|
||||
|
||||
|
||||
bool SDL::RenderCopy(SDL_Texture *texture, unsigned char transparency, SDL_Rect *src, SDL_Rect *dest, double angle)
|
||||
bool SDL::RenderCopy(SDL_Texture *texture, unsigned char alpha, SDL_Rect *src, SDL_Rect *dest, double angle)
|
||||
{
|
||||
SDL_Rect rotateRect;
|
||||
rotateRect.w = dest->w;
|
||||
@ -248,7 +247,7 @@ bool SDL::RenderCopy(SDL_Texture *texture, unsigned char transparency, SDL_Rect
|
||||
rotateRect.y = dest->y;
|
||||
}
|
||||
|
||||
SDL_SetTextureAlphaMod(texture, transparency);
|
||||
SDL_SetTextureAlphaMod(texture, alpha);
|
||||
SDL_RenderCopyEx(GetRenderer(), texture, src, &rotateRect, angle, NULL, SDL_FLIP_NONE);
|
||||
|
||||
return true;
|
||||
|
||||
@ -15,7 +15,7 @@ public:
|
||||
static SDL_Renderer *GetRenderer();
|
||||
static SDL_mutex *GetMutex();
|
||||
static SDL_Window *GetWindow();
|
||||
static bool RenderCopy(SDL_Texture *texture, unsigned char transparency, SDL_Rect *src, SDL_Rect *dest, double angle);
|
||||
static bool RenderCopy(SDL_Texture *texture, unsigned char alpha, SDL_Rect *src, SDL_Rect *dest, double angle);
|
||||
static int GetWindowWidth()
|
||||
{
|
||||
return WindowWidth;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user