Changed screenscaling so it scales the entire screen rather than individual objects. This is needed to prevent incorrect scaling between objects with a fixed width/height and aspect scaled items.

This commit is contained in:
Pieter Hulshoff 2019-12-03 19:26:22 +01:00
parent ecaf871a9e
commit d6e7de7596
29 changed files with 204 additions and 194 deletions

View File

@ -230,7 +230,7 @@ void Component::draw()
static_cast<char>(baseViewInfo.BackgroundGreen*255),
static_cast<char>(baseViewInfo.BackgroundBlue*255));
SDL::renderCopy(backgroundTexture_, baseViewInfo.BackgroundAlpha, NULL, &rect, baseViewInfo);
SDL::renderCopy(backgroundTexture_, baseViewInfo.BackgroundAlpha, NULL, &rect, baseViewInfo, page.getScaleX(), page.getScaleY());
}
}

View File

@ -19,13 +19,11 @@
#include "../../Utility/Log.h"
#include <SDL2/SDL_image.h>
Image::Image(std::string file, std::string altFile, Page &p, float scaleX, float scaleY)
Image::Image(std::string file, std::string altFile, Page &p)
: Component(p)
, texture_(NULL)
, file_(file)
, altFile_(altFile)
, scaleX_(scaleX)
, scaleY_(scaleY)
{
allocateGraphicsMemory();
}
@ -66,8 +64,8 @@ void Image::allocateGraphicsMemory()
{
SDL_SetTextureBlendMode(texture_, SDL_BLENDMODE_BLEND);
SDL_QueryTexture(texture_, NULL, NULL, &width, &height);
baseViewInfo.ImageWidth = width * scaleX_;
baseViewInfo.ImageHeight = height * scaleY_;
baseViewInfo.ImageWidth = width;
baseViewInfo.ImageHeight = height;
}
SDL_UnlockMutex(SDL::getMutex());
@ -91,6 +89,6 @@ void Image::draw()
rect.h = static_cast<int>(baseViewInfo.ScaledHeight());
rect.w = static_cast<int>(baseViewInfo.ScaledWidth());
SDL::renderCopy(texture_, baseViewInfo.Alpha, NULL, &rect, baseViewInfo);
SDL::renderCopy(texture_, baseViewInfo.Alpha, NULL, &rect, baseViewInfo, page.getScaleX(), page.getScaleY());
}
}

View File

@ -22,7 +22,7 @@
class Image : public Component
{
public:
Image(std::string file, std::string altFile, Page &p, float scaleX, float scaleY);
Image(std::string file, std::string altFile, Page &p);
virtual ~Image();
void freeGraphicsMemory();
void allocateGraphicsMemory();
@ -32,6 +32,4 @@ protected:
SDL_Texture *texture_;
std::string file_;
std::string altFile_;
float scaleX_;
float scaleY_;
};

View File

@ -18,7 +18,7 @@
#include "../../Utility/Log.h"
#include <fstream>
Image * ImageBuilder::CreateImage(std::string path, Page &p, std::string name, float scaleX, float scaleY)
Image * ImageBuilder::CreateImage(std::string path, Page &p, std::string name)
{
Image *image = NULL;
std::vector<std::string> extensions;
@ -35,7 +35,7 @@ Image * ImageBuilder::CreateImage(std::string path, Page &p, std::string name, f
if(Utils::findMatchingFile(prefix, extensions, file))
{
image = new Image(file, "", p, scaleX, scaleY);
image = new Image(file, "", p);
}
return image;

View File

@ -24,5 +24,5 @@
class ImageBuilder
{
public:
Image * CreateImage(std::string path, Page &p, std::string name, float scaleX, float scaleY);
Image * CreateImage(std::string path, Page &p, std::string name);
};

View File

@ -28,7 +28,7 @@
#include <vector>
#include <iostream>
ReloadableMedia::ReloadableMedia(Configuration &config, bool systemMode, bool layoutMode, bool commonMode, bool menuMode, std::string type, Page &p, int displayOffset, bool isVideo, Font *font, float scaleX, float scaleY)
ReloadableMedia::ReloadableMedia(Configuration &config, bool systemMode, bool layoutMode, bool commonMode, bool menuMode, std::string type, Page &p, int displayOffset, bool isVideo, Font *font)
: Component(p)
, config_(config)
, systemMode_(systemMode)
@ -41,8 +41,6 @@ ReloadableMedia::ReloadableMedia(Configuration &config, bool systemMode, bool la
, FfntInst_(font)
, textFallback_(false)
, type_(type)
, scaleX_(scaleX)
, scaleY_(scaleY)
, displayOffset_(displayOffset)
, volume_(1.0)
@ -383,7 +381,7 @@ void ReloadableMedia::reloadTexture()
// if image and artwork was not specified, fall back to displaying text
if(!loadedComponent_ && textFallback_)
{
loadedComponent_ = new Text(selectedItem->fullTitle, page, FfntInst_, scaleX_, scaleY_);
loadedComponent_ = new Text(selectedItem->fullTitle, page, FfntInst_);
baseViewInfo.ImageWidth = loadedComponent_->baseViewInfo.ImageWidth;
baseViewInfo.ImageHeight = loadedComponent_->baseViewInfo.ImageHeight;
}
@ -435,11 +433,11 @@ Component *ReloadableMedia::findComponent(std::string collection, std::string ty
if(type == "video")
{
component = videoBuild.createVideo(imagePath, page, basename, scaleX_, scaleY_);
component = videoBuild.createVideo(imagePath, page, basename);
}
else
{
component = imageBuild.CreateImage(imagePath, page, basename, scaleX_, scaleY_);
component = imageBuild.CreateImage(imagePath, page, basename);
}
return component;

View File

@ -27,7 +27,7 @@ class Image;
class ReloadableMedia : public Component
{
public:
ReloadableMedia(Configuration &config, bool systemMode, bool layoutMode, bool commonMode, bool menuMode, std::string type, Page &page, int displayOffset, bool isVideo, Font *font, float scaleX, float scaleY);
ReloadableMedia(Configuration &config, bool systemMode, bool layoutMode, bool commonMode, bool menuMode, std::string type, Page &page, int displayOffset, bool isVideo, Font *font);
virtual ~ReloadableMedia();
void update(float dt);
void draw();
@ -52,8 +52,6 @@ private:
Font *FfntInst_;
bool textFallback_;
std::string type_;
float scaleX_;
float scaleY_;
std::string currentCollection_;
Page *page_;
int displayOffset_;

View File

@ -28,7 +28,7 @@
#include <algorithm>
ReloadableScrollingText::ReloadableScrollingText(Configuration &config, bool systemMode, bool layoutMode, bool menuMode, std::string type, std::string textFormat, std::string singlePrefix, std::string singlePostfix, std::string pluralPrefix, std::string pluralPostfix, std::string alignment, Page &p, int displayOffset, Font *font, float scaleX, float scaleY, std::string direction, float scrollingSpeed, float startPosition, float startTime, float endTime )
ReloadableScrollingText::ReloadableScrollingText(Configuration &config, bool systemMode, bool layoutMode, bool menuMode, std::string type, std::string textFormat, std::string singlePrefix, std::string singlePostfix, std::string pluralPrefix, std::string pluralPostfix, std::string alignment, Page &p, int displayOffset, Font *font, std::string direction, float scrollingSpeed, float startPosition, float startTime, float endTime )
: Component(p)
, config_(config)
, systemMode_(systemMode)
@ -42,8 +42,6 @@ ReloadableScrollingText::ReloadableScrollingText(Configuration &config, bool sys
, pluralPrefix_(pluralPrefix)
, pluralPostfix_(pluralPostfix)
, alignment_(alignment)
, scaleX_(scaleX)
, scaleY_(scaleY)
, direction_(direction)
, scrollingSpeed_(scrollingSpeed)
, startPosition_(startPosition)
@ -81,11 +79,11 @@ void ReloadableScrollingText::update(float dt)
{
if (direction_ == "horizontal")
{
currentPosition_ += scrollingSpeed_ * dt * scaleX_;
currentPosition_ += scrollingSpeed_ * dt;
}
else if (direction_ == "vertical")
{
currentPosition_ += scrollingSpeed_ * dt * scaleY_;
currentPosition_ += scrollingSpeed_ * dt;
}
}
@ -131,11 +129,11 @@ void ReloadableScrollingText::reloadTexture( )
if (direction_ == "horizontal")
{
currentPosition_ = -startPosition_ * scaleX_;
currentPosition_ = -startPosition_;
}
else if (direction_ == "vertical")
{
currentPosition_ = -startPosition_ * scaleY_;
currentPosition_ = -startPosition_;
}
waitStartTime_ = startTime_;
waitEndTime_ = 0.0f;
@ -481,7 +479,7 @@ void ReloadableScrollingText::draw( )
imageMaxHeight = baseViewInfo.MaxHeight;
}
float scale = (float)baseViewInfo.FontSize / (float)font->getHeight( ) / scaleY_;
float scale = (float)baseViewInfo.FontSize / (float)font->getHeight( );
float xOrigin = baseViewInfo.XRelativeToOrigin( );
float yOrigin = baseViewInfo.YRelativeToOrigin( );
@ -516,43 +514,43 @@ void ReloadableScrollingText::draw( )
if (font->getRect( text_[l][i], glyph) && glyph.rect.h > 0)
{
SDL_Rect charRect = glyph.rect;
rect.h = static_cast<int>( charRect.h * scale * scaleY_ );
rect.w = static_cast<int>( charRect.w * scale * scaleX_ );
rect.h = static_cast<int>( charRect.h * scale );
rect.w = static_cast<int>( charRect.w * scale );
rect.y = static_cast<int>( yOrigin );
if (font->getAscent( ) < glyph.maxY)
{
rect.y += static_cast<int>( (font->getAscent( ) - glyph.maxY) * scale * scaleY_ );
rect.y += static_cast<int>( (font->getAscent( ) - glyph.maxY) * scale );
}
// Check if glyph falls partially outside the box at the back end
if ((rect.x + static_cast<int>( glyph.advance * scale * scaleX_ )) >= (static_cast<int>( xOrigin ) + imageMaxWidth))
if ((rect.x + static_cast<int>( glyph.advance * scale )) >= (static_cast<int>( xOrigin ) + imageMaxWidth))
{
rect.w = static_cast<int>( xOrigin ) + static_cast<int>( imageMaxWidth ) - rect.x;
charRect.w = static_cast<int>( rect.w / scale / scaleX_ );
charRect.w = static_cast<int>( rect.w / scale );
}
// Print the glyph if it falls (partially) within the box
if ( position + glyph.advance * scale * scaleX_ > currentPosition_ )
if ( position + glyph.advance * scale > currentPosition_ )
{
// Check if glyph falls partially outside the box at the front end
if ( position < currentPosition_ )
{
rect.w = static_cast<int>( glyph.advance * scale * scaleX_ + position - currentPosition_ );
charRect.x = static_cast<int>( charRect.x + charRect.w - rect.w / scale / scaleX_ );
charRect.w = static_cast<int>( rect.w / scale / scaleX_ );
rect.w = static_cast<int>( glyph.advance * scale + position - currentPosition_ );
charRect.x = static_cast<int>( charRect.x + charRect.w - rect.w / scale );
charRect.w = static_cast<int>( rect.w / scale );
}
if (rect.w > 0)
{
SDL::renderCopy(t, baseViewInfo.Alpha, &charRect, &rect, baseViewInfo);
SDL::renderCopy(t, baseViewInfo.Alpha, &charRect, &rect, baseViewInfo, page.getScaleX(), page.getScaleY());
rect.x += rect.w;
}
else if ((rect.x + static_cast<int>( glyph.advance * scale * scaleX_ )) >= (static_cast<int>( xOrigin ) + imageMaxWidth))
else if ((rect.x + static_cast<int>( glyph.advance * scale )) >= (static_cast<int>( xOrigin ) + imageMaxWidth))
{
rect.x = static_cast<int>( xOrigin ) + static_cast<int>( imageMaxWidth ) + 10; // Stop handling the rest of the string
}
}
position += glyph.advance * scale * scaleX_;
position += glyph.advance * scale;
}
}
@ -572,11 +570,11 @@ void ReloadableScrollingText::draw( )
}
// Reset scrolling position when we're done
if (currentPosition_ > imageWidth * scale * scaleX_)
if (currentPosition_ > imageWidth * scale)
{
waitStartTime_ = startTime_;
waitEndTime_ = endTime_;
currentPosition_ = -startPosition_ * scaleX_;
currentPosition_ = -startPosition_;
}
}
@ -588,7 +586,7 @@ void ReloadableScrollingText::draw( )
Font::GlyphInfo glyph;
if (font->getRect( ' ', glyph) )
{
spaceWidth = static_cast<int>( glyph.advance * scale * scaleX_);
spaceWidth = static_cast<int>( glyph.advance * scale);
}
}
@ -615,7 +613,7 @@ void ReloadableScrollingText::draw( )
Font::GlyphInfo glyph;
if (font->getRect( word[i], glyph) )
{
wordWidth += static_cast<int>( glyph.advance * scale * scaleX_ );
wordWidth += static_cast<int>( glyph.advance * scale );
}
}
// Determine if the word will fit on the line
@ -668,7 +666,7 @@ void ReloadableScrollingText::draw( )
}
// Do not scroll if the text fits fully inside the box, and start position is 0
if (text.size() * font->getHeight( ) * scale * scaleY_ <= imageMaxHeight && startPosition_ == 0.0f)
if (text.size() * font->getHeight( ) * scale <= imageMaxHeight && startPosition_ == 0.0f)
{
currentPosition_ = 0.0f;
waitStartTime_ = 0.0f;
@ -688,18 +686,18 @@ void ReloadableScrollingText::draw( )
rect.x = static_cast<int>( xOrigin );
if (alignment_ == "right")
{
rect.x = static_cast<int>( xOrigin + imageMaxWidth - textWidth[l] - (textWords[l] - 1) * spaceWidth * scale * scaleX_ );
rect.x = static_cast<int>( xOrigin + imageMaxWidth - textWidth[l] - (textWords[l] - 1) * spaceWidth * scale );
}
if (alignment_ == "centered")
{
rect.x = static_cast<int>( xOrigin + imageMaxWidth / 2 - textWidth[l] / 2 - (textWords[l] - 1) * spaceWidth * scale * scaleX_ / 2 );
rect.x = static_cast<int>( xOrigin + imageMaxWidth / 2 - textWidth[l] / 2 - (textWords[l] - 1) * spaceWidth * scale / 2 );
}
std::istringstream iss(text[l]);
std::string word;
unsigned int wordCount = textWords[l];
unsigned int spaceFill = static_cast<int>( imageMaxWidth ) - textWidth[l];
unsigned int yAdvance = static_cast<int>( font->getHeight( ) * scale * scaleY_ );
unsigned int yAdvance = static_cast<int>( font->getHeight( ) * scale );
while (iss >> word)
{
@ -710,34 +708,34 @@ void ReloadableScrollingText::draw( )
if (font->getRect( word[i], glyph) && glyph.rect.h > 0)
{
SDL_Rect charRect = glyph.rect;
rect.h = static_cast<int>( charRect.h * scale * scaleY_ );
rect.w = static_cast<int>( charRect.w * scale * scaleX_ );
yAdvance = static_cast<int>( font->getHeight( ) * scale * scaleY_ );
rect.h = static_cast<int>( charRect.h * scale );
rect.w = static_cast<int>( charRect.w * scale );
yAdvance = static_cast<int>( font->getHeight( ) * scale );
// Check if glyph falls partially outside the box at the bottom end
if ((rect.y + rect.h) >= (static_cast<int>( yOrigin ) + imageMaxHeight))
{
rect.h = static_cast<int>( yOrigin ) + static_cast<int>( imageMaxHeight ) - rect.y;
charRect.h = static_cast<int>( rect.h / scale / scaleY_ );
charRect.h = static_cast<int>( rect.h / scale );
}
// Print the glyph if it falls (partially) within the box
if ( position + font->getHeight( ) * scale * scaleY_ > currentPosition_ )
if ( position + font->getHeight( ) * scale > currentPosition_ )
{
// Check if glyph falls partially outside the box at the front end
if ( position < currentPosition_ )
{
yAdvance -= rect.h - static_cast<int>( font->getHeight( ) * scale * scaleX_ + position - currentPosition_ );
rect.h = static_cast<int>( font->getHeight( ) * scale * scaleX_ + position - currentPosition_ );
charRect.y = static_cast<int>( charRect.y + charRect.h - rect.h / scale / scaleX_ );
charRect.h = static_cast<int>( rect.h / scale / scaleX_ );
yAdvance -= rect.h - static_cast<int>( font->getHeight( ) * scale + position - currentPosition_ );
rect.h = static_cast<int>( font->getHeight( ) * scale + position - currentPosition_ );
charRect.y = static_cast<int>( charRect.y + charRect.h - rect.h / scale );
charRect.h = static_cast<int>( rect.h / scale );
}
if (rect.h > 0)
{
SDL::renderCopy(t, baseViewInfo.Alpha, &charRect, &rect, baseViewInfo);
SDL::renderCopy(t, baseViewInfo.Alpha, &charRect, &rect, baseViewInfo, page.getScaleX(), page.getScaleY());
}
}
rect.x += static_cast<int>( glyph.advance * scale * scaleX_ );
rect.x += static_cast<int>( glyph.advance * scale );
}
}
@ -762,31 +760,31 @@ void ReloadableScrollingText::draw( )
if (font->getRect( ' ', glyph) && glyph.rect.h > 0)
{
rect.h = static_cast<int>( glyph.rect.h * scale * scaleY_ );
rect.h = static_cast<int>( glyph.rect.h * scale );
// Check if the glyph falls (partially) within the box at the front end
if ((position + font->getHeight( ) * scale * scaleY_ > currentPosition_) &&
if ((position + font->getHeight( ) * scale > currentPosition_) &&
(position < currentPosition_))
{
yAdvance -= rect.h - static_cast<int>( font->getHeight( ) * scale * scaleX_ + position - currentPosition_ );
yAdvance -= rect.h - static_cast<int>( font->getHeight( ) * scale + position - currentPosition_ );
}
}
}
if ( position + font->getHeight( ) * scale * scaleY_ > currentPosition_ )
if ( position + font->getHeight( ) * scale > currentPosition_ )
{
rect.y += yAdvance;
}
position += font->getHeight( ) * scale * scaleY_;
position += font->getHeight( ) * scale;
}
// Reset scrolling position when we're done
if (currentPosition_ > text.size( ) * font->getHeight( ) * scale * scaleX_)
if (currentPosition_ > text.size( ) * font->getHeight( ) * scale)
{
waitStartTime_ = startTime_;
waitEndTime_ = endTime_;
currentPosition_ = -startPosition_ * scaleY_;
currentPosition_ = -startPosition_;
}
}

View File

@ -24,7 +24,7 @@
class ReloadableScrollingText : public Component
{
public:
ReloadableScrollingText(Configuration &config, bool systemMode, bool layoutMode, bool menuMode, std::string type, std::string textFormat, std::string singlePrefix, std::string singlePostfix, std::string pluralPrefix, std::string pluralPostfix, std::string alignment, Page &page, int displayOffset, Font *font, float scaleX, float scaleY, std::string direction, float scrollingSpeed, float startPosition, float startTime, float endTime );
ReloadableScrollingText(Configuration &config, bool systemMode, bool layoutMode, bool menuMode, std::string type, std::string textFormat, std::string singlePrefix, std::string singlePostfix, std::string pluralPrefix, std::string pluralPostfix, std::string alignment, Page &page, int displayOffset, Font *font, std::string direction, float scrollingSpeed, float startPosition, float startTime, float endTime );
virtual ~ReloadableScrollingText( );
void update(float dt);
void draw( );
@ -49,8 +49,6 @@ private:
std::string pluralPostfix_;
std::string alignment_;
std::vector<std::string> text_;
float scaleX_;
float scaleY_;
std::string direction_;
float scrollingSpeed_;
float startPosition_;

View File

@ -25,7 +25,7 @@
#include <time.h>
#include <algorithm>
ReloadableText::ReloadableText(std::string type, Page &page, Configuration &config, bool systemMode, Font *font, std::string layoutKey, std::string timeFormat, std::string textFormat, std::string singlePrefix, std::string singlePostfix, std::string pluralPrefix, std::string pluralPostfix, float scaleX, float scaleY)
ReloadableText::ReloadableText(std::string type, Page &page, Configuration &config, bool systemMode, Font *font, std::string layoutKey, std::string timeFormat, std::string textFormat, std::string singlePrefix, std::string singlePostfix, std::string pluralPrefix, std::string pluralPostfix)
: Component(page)
, config_(config)
, systemMode_(systemMode)
@ -39,8 +39,6 @@ ReloadableText::ReloadableText(std::string type, Page &page, Configuration &conf
, singlePostfix_(singlePostfix)
, pluralPrefix_(pluralPrefix)
, pluralPostfix_(pluralPostfix)
, scaleX_(scaleX)
, scaleY_(scaleY)
{
allocateGraphicsMemory();
}
@ -282,7 +280,7 @@ void ReloadableText::ReloadTexture()
ss << text;
}
imageInst_ = new Text(ss.str(), page, fontInst_, scaleX_, scaleY_);
imageInst_ = new Text(ss.str(), page, fontInst_);
}
}

View File

@ -25,7 +25,7 @@
class ReloadableText : public Component
{
public:
ReloadableText(std::string type, Page &page, Configuration &config, bool systemMode, Font *font, std::string layoutKey, std::string timeFormat, std::string textFormat, std::string singlePrefix, std::string singlePostfix, std::string pluralPrefix, std::string pluralPostfix, float scaleX, float scaleY);
ReloadableText(std::string type, Page &page, Configuration &config, bool systemMode, Font *font, std::string layoutKey, std::string timeFormat, std::string textFormat, std::string singlePrefix, std::string singlePostfix, std::string pluralPrefix, std::string pluralPostfix);
virtual ~ReloadableText();
void update(float dt);
void draw();
@ -49,7 +49,4 @@ private:
std::string singlePostfix_;
std::string pluralPrefix_;
std::string pluralPostfix_;
float scaleX_;
float scaleY_;
};

View File

@ -44,8 +44,6 @@ ScrollingList::ScrollingList( Configuration &c,
Page &p,
bool layoutMode,
bool commonMode,
float scaleX,
float scaleY,
Font *font,
std::string layoutKey,
std::string imageType )
@ -63,8 +61,6 @@ ScrollingList::ScrollingList( Configuration &c,
, minScrollTime_( 0.500 )
, scrollPeriod_( 0 )
, config_( c )
, scaleX_( scaleX )
, scaleY_( scaleY )
, fontInst_( font )
, layoutKey_( layoutKey )
, imageType_( imageType )
@ -86,8 +82,6 @@ ScrollingList::ScrollingList( const ScrollingList &copy )
, minScrollTime_( copy.minScrollTime_ )
, scrollPeriod_( copy.startScrollTime_ )
, config_( copy.config_ )
, scaleX_( copy.scaleX_ )
, scaleY_( copy.scaleY_ )
, fontInst_( copy.fontInst_ )
, layoutKey_( copy.layoutKey_ )
, imageType_( copy.imageType_ )
@ -776,7 +770,7 @@ bool ScrollingList::allocateTexture( unsigned int index, Item *item )
else
config_.getMediaPropertyAbsolutePath( collectionName, imageType_, false, imagePath );
}
t = imageBuild.CreateImage( imagePath, page, names[n], scaleX_, scaleY_ );
t = imageBuild.CreateImage( imagePath, page, names[n] );
// check sub-collection path for art
if ( !t && !commonMode_ )
{
@ -789,7 +783,7 @@ bool ScrollingList::allocateTexture( unsigned int index, Item *item )
{
config_.getMediaPropertyAbsolutePath( item->collectionInfo->name, imageType_, false, imagePath );
}
t = imageBuild.CreateImage( imagePath, page, names[n], scaleX_, scaleY_ );
t = imageBuild.CreateImage( imagePath, page, names[n] );
}
}
@ -814,16 +808,16 @@ bool ScrollingList::allocateTexture( unsigned int index, Item *item )
else
config_.getMediaPropertyAbsolutePath( item->name, imageType_, true, imagePath );
}
t = imageBuild.CreateImage( imagePath, page, imageType_, scaleX_, scaleY_ );
t = imageBuild.CreateImage( imagePath, page, imageType_ );
}
// check rom directory path for art
if ( !t )
t = imageBuild.CreateImage( item->filepath, page, imageType_, scaleX_, scaleY_ );
t = imageBuild.CreateImage( item->filepath, page, imageType_ );
if ( !t )
{
t = new Text(item->title, page, fontInst_, scaleX_, scaleY_ );
t = new Text(item->title, page, fontInst_ );
}
if ( t )

View File

@ -37,8 +37,6 @@ public:
Page &p,
bool layoutMode,
bool commonMode,
float scaleX,
float scaleY,
Font *font,
std::string layoutKey,
std::string imageType );
@ -123,8 +121,6 @@ private:
float scrollPeriod_;
Configuration &config_;
float scaleX_;
float scaleY_;
Font *fontInst_;
std::string layoutKey_;
std::string imageType_;

View File

@ -22,12 +22,10 @@
#include <sstream>
Text::Text( std::string text, Page &p, Font *font, float scaleX, float scaleY )
Text::Text( std::string text, Page &p, Font *font )
: Component(p)
, textData_(text)
, fontInst_(font)
, scaleX_(scaleX)
, scaleY_(scaleY)
{
allocateGraphicsMemory( );
}
@ -159,7 +157,7 @@ void Text::draw( )
}
SDL::renderCopy( t, baseViewInfo.Alpha, &charRect, &rect, baseViewInfo );
SDL::renderCopy( t, baseViewInfo.Alpha, &charRect, &rect, baseViewInfo, page.getScaleX(), page.getScaleY() );
rect.x += static_cast<int>( glyph.advance * scale );

View File

@ -29,7 +29,7 @@ class Text : public Component
{
public:
Text( std::string text, Page &p, Font *font, float scaleX, float scaleY );
Text( std::string text, Page &p, Font *font );
virtual ~Text( );
void setText( std::string text, int id = -1 );
void allocateGraphicsMemory( );
@ -41,6 +41,4 @@ public:
private:
std::string textData_;
Font *fontInst_;
float scaleX_;
float scaleY_;
};

View File

@ -26,14 +26,12 @@
bool Video::enabled_ = true;
Video::Video(std::string file, std::string altFile, int numLoops, Page &p, float scaleX, float scaleY)
Video::Video(std::string file, std::string altFile, int numLoops, Page &p)
: Component(p)
, video_(NULL)
, file_(file)
, altFile_(altFile)
, numLoops_(numLoops)
, scaleX_(scaleX)
, scaleY_(scaleY)
, volume_(1.0)
{
@ -105,7 +103,7 @@ void Video::allocateGraphicsMemory( )
IVideo *video = new GStreamerVideo();
video->initialize();
((GStreamerVideo *)(video))->setNumLoops(numLoops_);
video_ = new VideoComponent( video, page, file, scaleX_, scaleY_ );
video_ = new VideoComponent( video, page, file );
}
}

View File

@ -22,7 +22,7 @@
class Video : public Component
{
public:
Video( std::string file, std::string altFile, int numLoops, Page &page, float scaleX, float scaleY );
Video( std::string file, std::string altFile, int numLoops, Page &page );
virtual ~Video( );
static void setEnabled(bool enabled);
void update(float dt);
@ -38,8 +38,6 @@ protected:
std::string file_;
std::string altFile_;
int numLoops_;
float scaleX_;
float scaleY_;
private:
static bool enabled_;

View File

@ -21,7 +21,7 @@
#include <fstream>
VideoComponent * VideoBuilder::createVideo(std::string path, Page &page, std::string name, float scaleX, float scaleY)
VideoComponent * VideoBuilder::createVideo(std::string path, Page &page, std::string name)
{
VideoComponent *component = NULL;
std::vector<std::string> extensions;
@ -40,7 +40,7 @@ VideoComponent * VideoBuilder::createVideo(std::string path, Page &page, std::st
if(video)
{
component = new VideoComponent(video, page, file, scaleX, scaleY);
component = new VideoComponent(video, page, file);
}
}

View File

@ -24,7 +24,7 @@
class VideoBuilder
{
public:
VideoComponent * createVideo(std::string path, Page &page, std::string name, float scaleX, float scaleY);
VideoComponent * createVideo(std::string path, Page &page, std::string name);
private:
VideoFactory factory_;

View File

@ -21,12 +21,10 @@
#include "../../Video/GStreamerVideo.h"
#include "../../SDL.h"
VideoComponent::VideoComponent(IVideo *videoInst, Page &p, std::string videoFile, float scaleX, float scaleY)
VideoComponent::VideoComponent(IVideo *videoInst, Page &p, std::string videoFile)
: Component(p)
, videoFile_(videoFile)
, videoInst_(videoInst)
, scaleX_(scaleX)
, scaleY_(scaleY)
, isPlaying_(false)
, volume_(1.0)
{
@ -99,7 +97,7 @@ void VideoComponent::draw()
if(texture)
{
SDL::renderCopy(texture, baseViewInfo.Alpha, NULL, &rect, baseViewInfo);
SDL::renderCopy(texture, baseViewInfo.Alpha, NULL, &rect, baseViewInfo, page.getScaleX(), page.getScaleY());
}
}

View File

@ -25,7 +25,7 @@
class VideoComponent : public Component
{
public:
VideoComponent(IVideo *videoInst, Page &p, std::string videoFile, float scaleX, float scaleY);
VideoComponent(IVideo *videoInst, Page &p, std::string videoFile);
virtual ~VideoComponent();
void update(float dt);
void draw();
@ -39,8 +39,6 @@ private:
std::string videoFile_;
std::string name_;
IVideo *videoInst_;
float scaleX_;
float scaleY_;
bool isPlaying_;
double volume_;
};

View File

@ -28,7 +28,7 @@
#include <sstream>
Page::Page(Configuration &config)
Page::Page(Configuration &config, float scaleX, float scaleY)
: config_(config)
, menuDepth_(0)
, scrollActive_(false)
@ -39,6 +39,8 @@ Page::Page(Configuration &config)
, highlightSoundChunk_(NULL)
, selectSoundChunk_(NULL)
, minShowTime_(0)
, scaleX_(scaleX)
, scaleY_(scaleY)
{
}
@ -1546,3 +1548,15 @@ bool Page::hasSubs()
{
return collections_.back().collection->hasSubs;
}
float Page::getScaleX()
{
return scaleX_;
}
float Page::getScaleY()
{
return scaleY_;
}

View File

@ -40,7 +40,7 @@ public:
};
Page(Configuration &c);
Page(Configuration &c, float scaleX, float scaleY);
virtual ~Page();
void deInitialize();
virtual void onNewItemSelected();
@ -98,30 +98,32 @@ public:
bool isSelectPlaying();
std::string getCollectionName();
CollectionInfo *getCollection();
void setMinShowTime(float value);
void setMinShowTime(float value);
float getMinShowTime();
void menuScroll();
void highlightEnter();
void highlightExit();
void playlistEnter();
void playlistExit();
void menuJumpEnter();
void menuJumpExit();
void attractEnter( );
void attract( );
void attractExit( );
void triggerEvent( std::string action );
void setText( std::string text, int id );
void addPlaylist();
void removePlaylist();
void updateLastPlayedPlaylist( Item *item );
void reallocateMenuSpritePoints();
bool isMenuScrolling();
bool isPlaying();
void resetScrollPeriod();
void updateScrollPeriod();
void scroll(bool forward);
bool hasSubs();
void menuScroll();
void highlightEnter();
void highlightExit();
void playlistEnter();
void playlistExit();
void menuJumpEnter();
void menuJumpExit();
void attractEnter( );
void attract( );
void attractExit( );
void triggerEvent( std::string action );
void setText( std::string text, int id );
void addPlaylist();
void removePlaylist();
void updateLastPlayedPlaylist( Item *item );
void reallocateMenuSpritePoints();
bool isMenuScrolling();
bool isPlaying();
void resetScrollPeriod();
void updateScrollPeriod();
void scroll(bool forward);
bool hasSubs();
float getScaleX();
float getScaleY();
private:
void playlistChange();
@ -160,6 +162,8 @@ private:
float minShowTime_;
float elapsedTime_;
CollectionInfo::Playlists_T::iterator playlist_;
float scaleX_;
float scaleY_;
};

View File

@ -57,6 +57,8 @@ PageBuilder::PageBuilder(std::string layoutKey, std::string layoutPage, Configur
, scaleY_(1)
, screenHeight_(0)
, screenWidth_(0)
, layoutHeight_(0)
, layoutWidth_(0)
, fontSize_(24)
, fontCache_(fc)
, isMenu_(isMenu)
@ -156,8 +158,6 @@ Page *PageBuilder::buildPage( std::string collectionName )
xml_attribute<> *fontSizeXml = root->first_attribute("loadFontSize");
xml_attribute<> *minShowTimeXml = root->first_attribute("minShowTime");
int layoutHeight;
int layoutWidth;
if(!layoutWidthXml || !layoutHeightXml)
{
Logger::write(Logger::ZONE_ERROR, "Layout", "<layout> tag must specify a width and height");
@ -189,23 +189,23 @@ Page *PageBuilder::buildPage( std::string collectionName )
fontSize_ = Utils::convertInt(fontSizeXml->value());
}
layoutWidth = Utils::convertInt(layoutWidthXml->value());
layoutHeight = Utils::convertInt(layoutHeightXml->value());
layoutWidth_ = Utils::convertInt(layoutWidthXml->value());
layoutHeight_ = Utils::convertInt(layoutHeightXml->value());
if(layoutWidth == 0 || layoutHeight == 0)
if(layoutWidth_ == 0 || layoutHeight_ == 0)
{
Logger::write(Logger::ZONE_ERROR, "Layout", "Layout width and height cannot be set to 0");
return NULL;
}
scaleX_ = (float)screenWidth_ / (float)layoutWidth;
scaleY_ = (float)screenHeight_ / (float)layoutHeight;
scaleX_ = (float)screenWidth_ / (float)layoutWidth_;
scaleY_ = (float)screenHeight_ / (float)layoutHeight_;
std::stringstream ss;
ss << layoutWidth << "x" << layoutHeight << " (scale " << scaleX_ << "x" << scaleY_ << ")";
ss << layoutWidth_ << "x" << layoutHeight_ << " (scale " << scaleX_ << "x" << scaleY_ << ")";
Logger::write(Logger::ZONE_INFO, "Layout", "Layout resolution " + ss.str());
page = new Page(config_);
page = new Page(config_, scaleX_, scaleY_);
if(minShowTimeXml)
{
@ -310,15 +310,15 @@ float PageBuilder::getHorizontalAlignment(xml_attribute<> *attribute, float valu
}
else if(!str.compare("center"))
{
value = static_cast<float>(screenWidth_) / 2;
value = static_cast<float>(layoutWidth_) / 2;
}
else if(!str.compare("right") || !str.compare("stretch"))
{
value = static_cast<float>(screenWidth_);
value = static_cast<float>(layoutWidth_);
}
else
{
value = Utils::convertFloat(str) * scaleX_;
value = Utils::convertFloat(str);
}
}
@ -343,15 +343,15 @@ float PageBuilder::getVerticalAlignment(xml_attribute<> *attribute, float valueI
}
else if(!str.compare("center"))
{
value = static_cast<float>(screenHeight_ / 2);
value = static_cast<float>(layoutHeight_ / 2);
}
else if(!str.compare("bottom") || !str.compare("stretch"))
{
value = static_cast<float>(screenHeight_);
value = static_cast<float>(layoutHeight_);
}
else
{
value = Utils::convertFloat(str) * scaleY_;
value = Utils::convertFloat(str);
}
}
return value;
@ -410,7 +410,7 @@ bool PageBuilder::buildComponents(xml_node<> *layout, Page *page)
std::string altImagePath;
altImagePath = Utils::combinePath(Configuration::absolutePath, "layouts", layoutName, std::string(src->value()));
Image *c = new Image(imagePath, altImagePath, *page, scaleX_, scaleY_);
Image *c = new Image(imagePath, altImagePath, *page);
c->setId( id );
xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload");
if (menuScrollReload &&
@ -453,7 +453,7 @@ bool PageBuilder::buildComponents(xml_node<> *layout, Page *page)
altVideoPath = Utils::combinePath(Configuration::absolutePath, "layouts", layoutName, std::string(srcXml->value()));
int numLoops = numLoopsXml ? Utils::convertInt(numLoopsXml->value()) : 1;
Video *c = new Video(videoPath, altVideoPath, numLoops, *page, scaleX_, scaleY_);
Video *c = new Video(videoPath, altVideoPath, numLoops, *page);
c->setId( id );
xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload");
if (menuScrollReload &&
@ -489,7 +489,7 @@ bool PageBuilder::buildComponents(xml_node<> *layout, Page *page)
else
{
Font *font = addFont(componentXml, NULL);
Text *c = new Text(value->value(), *page, font, scaleX_, scaleY_);
Text *c = new Text(value->value(), *page, font);
c->setId( id );
xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload");
if (menuScrollReload &&
@ -507,7 +507,7 @@ bool PageBuilder::buildComponents(xml_node<> *layout, Page *page)
for(xml_node<> *componentXml = layout->first_node("statusText"); componentXml; componentXml = componentXml->next_sibling("statusText"))
{
Font *font = addFont(componentXml, NULL);
Text *c = new Text("", *page, font, scaleX_, scaleY_);
Text *c = new Text("", *page, font);
xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload");
if (menuScrollReload &&
(Utils::toLower(menuScrollReload->value()) == "true" ||
@ -661,7 +661,7 @@ void PageBuilder::loadReloadableImages(xml_node<> *layout, std::string tagName,
{
pluralPostfix = pluralPostfixXml->value();
}
c = new ReloadableText(type->value(), *page, config_, systemMode, font, layoutKey, timeFormat, textFormat, singlePrefix, singlePostfix, pluralPrefix, pluralPostfix, scaleX_, scaleY_);
c = new ReloadableText(type->value(), *page, config_, systemMode, font, layoutKey, timeFormat, textFormat, singlePrefix, singlePostfix, pluralPrefix, pluralPostfix);
c->setId( id );
xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload");
if (menuScrollReload &&
@ -733,7 +733,7 @@ void PageBuilder::loadReloadableImages(xml_node<> *layout, std::string tagName,
{
pluralPostfix = pluralPostfixXml->value();
}
c = new ReloadableScrollingText(config_, systemMode, layoutMode, menuMode, type->value(), singlePrefix, singlePostfix, pluralPrefix, pluralPostfix, textFormat, alignment, *page, selectedOffset, font, scaleX_, scaleY_, direction, scrollingSpeed, startPosition, startTime, endTime);
c = new ReloadableScrollingText(config_, systemMode, layoutMode, menuMode, type->value(), singlePrefix, singlePostfix, pluralPrefix, pluralPostfix, textFormat, alignment, *page, selectedOffset, font, direction, scrollingSpeed, startPosition, startTime, endTime);
c->setId( id );
xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload");
if (menuScrollReload &&
@ -747,7 +747,7 @@ void PageBuilder::loadReloadableImages(xml_node<> *layout, std::string tagName,
else
{
Font *font = addFont(componentXml, NULL);
c = new ReloadableMedia(config_, systemMode, layoutMode, commonMode, menuMode, type->value(), *page, selectedOffset, (tagName == "reloadableVideo"), font, scaleX_, scaleY_);
c = new ReloadableMedia(config_, systemMode, layoutMode, commonMode, menuMode, type->value(), *page, selectedOffset, (tagName == "reloadableVideo"), font);
c->setId( id );
xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload");
if (menuScrollReload &&
@ -1009,7 +1009,7 @@ ScrollingList * PageBuilder::buildMenu(xml_node<> *menuXml, Page &page)
// on default, text will be rendered to the menu. Preload it into cache.
Font *font = addFont(itemDefaults, NULL);
menu = new ScrollingList(config_, page, layoutMode, commonMode, scaleX_, scaleY_, font, layoutKey, imageType);
menu = new ScrollingList(config_, page, layoutMode, commonMode, font, layoutKey, imageType);
if(scrollTimeXml)
{
@ -1282,8 +1282,8 @@ void PageBuilder::buildViewInfo(xml_node<> *componentXml, ViewInfo &info, xml_no
float yOriginRelative = getVerticalAlignment(yOrigin, 0);
// the origins need to be saved as a percent since the heights and widths can be scaled
info.XOrigin = xOriginRelative / screenWidth_;
info.YOrigin = yOriginRelative / screenHeight_;
info.XOrigin = xOriginRelative / layoutWidth_;
info.YOrigin = yOriginRelative / layoutHeight_;
if(!height && !width)
@ -1301,17 +1301,17 @@ void PageBuilder::buildViewInfo(xml_node<> *componentXml, ViewInfo &info, xml_no
info.MinWidth = getHorizontalAlignment(minWidth, 0);
info.MaxHeight = getVerticalAlignment(maxHeight, FLT_MAX);
info.MaxWidth = getVerticalAlignment(maxWidth, FLT_MAX);
info.Alpha = alpha ? Utils::convertFloat(alpha->value()) : 1.f;
info.Angle = angle ? Utils::convertFloat(angle->value()) : 0.f;
info.Layer = layer ? Utils::convertInt(layer->value()) : 0;
info.Reflection = reflection ? reflection->value() : "";
info.ReflectionDistance = reflectionDistance ? Utils::convertInt(reflectionDistance->value()) : 0;
info.ReflectionScale = reflectionScale ? Utils::convertFloat(reflectionScale->value()) : 0.25f;
info.ReflectionAlpha = reflectionAlpha ? Utils::convertFloat(reflectionAlpha->value()) : 1.f;
info.ContainerX = containerX ? Utils::convertFloat(containerX->value()) * scaleX_ : 0.f;
info.ContainerY = containerY ? Utils::convertFloat(containerY->value()) * scaleY_ : 0.f;
info.ContainerWidth = containerWidth ? Utils::convertFloat(containerWidth->value()) * scaleX_ : -1.f;
info.ContainerHeight = containerHeight ? Utils::convertFloat(containerHeight->value()) * scaleY_ : -1.f;
info.Alpha = alpha ? Utils::convertFloat(alpha->value()) : 1.f;
info.Angle = angle ? Utils::convertFloat(angle->value()) : 0.f;
info.Layer = layer ? Utils::convertInt(layer->value()) : 0;
info.Reflection = reflection ? reflection->value() : "";
info.ReflectionDistance = reflectionDistance ? Utils::convertInt(reflectionDistance->value()) : 0;
info.ReflectionScale = reflectionScale ? Utils::convertFloat(reflectionScale->value()) : 0.25f;
info.ReflectionAlpha = reflectionAlpha ? Utils::convertFloat(reflectionAlpha->value()) : 1.f;
info.ContainerX = containerX ? Utils::convertFloat(containerX->value()) : 0.f;
info.ContainerY = containerY ? Utils::convertFloat(containerY->value()) : 0.f;
info.ContainerWidth = containerWidth ? Utils::convertFloat(containerWidth->value()) : -1.f;
info.ContainerHeight = containerHeight ? Utils::convertFloat(containerHeight->value()) : -1.f;
if(fontColor)
{
@ -1427,8 +1427,8 @@ void PageBuilder::getAnimationEvents(xml_node<> *node, TweenSet &tweens)
// x origin gets translated to a percent
case TWEEN_PROPERTY_X_ORIGIN:
fromValue = getHorizontalAlignment(from, 0) / screenWidth_;
toValue = getHorizontalAlignment(to, 0) / screenWidth_;
fromValue = getHorizontalAlignment(from, 0) / layoutWidth_;
toValue = getHorizontalAlignment(to, 0) / layoutWidth_;
break;
case TWEEN_PROPERTY_HEIGHT:
@ -1444,8 +1444,8 @@ void PageBuilder::getAnimationEvents(xml_node<> *node, TweenSet &tweens)
// y origin gets translated to a percent
case TWEEN_PROPERTY_Y_ORIGIN:
fromValue = getVerticalAlignment(from, 0) / screenHeight_;
toValue = getVerticalAlignment(to, 0) / screenHeight_;
fromValue = getVerticalAlignment(from, 0) / layoutHeight_;
toValue = getVerticalAlignment(to, 0) / layoutHeight_;
break;
case TWEEN_PROPERTY_MAX_WIDTH:

View File

@ -46,6 +46,8 @@ private:
float scaleY_;
int screenHeight_;
int screenWidth_;
int layoutHeight_;
int layoutWidth_;
SDL_Color fontColor_;
std::string fontName_;
int fontSize_;

View File

@ -59,8 +59,6 @@ public:
float Angle;
float Alpha;
unsigned int Layer;
float HorizontalScale;
float VerticalScale;
float BackgroundRed;
float BackgroundGreen;
float BackgroundBlue;

View File

@ -273,15 +273,15 @@ SDL_Window* SDL::getWindow( )
// Render a copy of a texture
bool SDL::renderCopy( SDL_Texture *texture, float alpha, SDL_Rect *src, SDL_Rect *dest, ViewInfo &viewInfo )
bool SDL::renderCopy( SDL_Texture *texture, float alpha, SDL_Rect *src, SDL_Rect *dest, ViewInfo &viewInfo, float scaleX, float scaleY )
{
SDL_Rect srcRect;
SDL_Rect dstRect;
SDL_Rect srcRectCopy;
SDL_Rect dstRectCopy;
double scaleX;
double scaleY;
double imageScaleX;
double imageScaleY;
dstRect.w = dest->w;
dstRect.h = dest->h;
@ -317,8 +317,8 @@ bool SDL::renderCopy( SDL_Texture *texture, float alpha, SDL_Rect *src, SDL_Rect
}
// Define the scale
scaleX = (dstRect.w > 0) ? static_cast<double>( srcRect.w ) / static_cast<double>( dstRect.w ) : 0.0;
scaleY = (dstRect.h > 0) ? static_cast<double>( srcRect.h ) / static_cast<double>( dstRect.h ) : 0.0;
imageScaleX = (dstRect.w > 0) ? static_cast<double>( srcRect.w ) / static_cast<double>( dstRect.w ) : 0.0;
imageScaleY = (dstRect.h > 0) ? static_cast<double>( srcRect.h ) / static_cast<double>( dstRect.h ) : 0.0;
// Make a copy
srcRectCopy.x = srcRect.x;
@ -364,18 +364,37 @@ bool SDL::renderCopy( SDL_Texture *texture, float alpha, SDL_Rect *src, SDL_Rect
}
// Define source width and height
srcRect.w = static_cast<int>( dstRect.w * scaleX );
srcRect.h = static_cast<int>( dstRect.h * scaleY );
srcRect.w = static_cast<int>( dstRect.w * imageScaleX );
srcRect.h = static_cast<int>( dstRect.h * imageScaleY );
}
dstRectCopy.x = dstRect.x;
dstRectCopy.y = dstRect.y;
dstRectCopy.w = dstRect.w;
dstRectCopy.h = dstRect.h;
dstRect.x *= scaleX;
dstRect.y *= scaleY;
dstRect.w *= scaleX;
dstRect.h *= scaleY;
SDL_SetTextureAlphaMod( texture, static_cast<char>( alpha * 255 ) );
SDL_RenderCopyEx( getRenderer( ), texture, &srcRect, &dstRect, viewInfo.Angle, NULL, SDL_FLIP_NONE );
dstRect.x = dstRectCopy.x;
dstRect.y = dstRectCopy.y;
dstRect.w = dstRectCopy.w;
dstRect.h = dstRectCopy.h;
if ( viewInfo.Reflection == "top" )
{
dstRect.h = static_cast<unsigned int>( static_cast<float>(dstRect.h ) * viewInfo.ReflectionScale);
dstRect.y = dstRect.y - dstRect.h - viewInfo.ReflectionDistance;
dstRect.x *= scaleX;
dstRect.y *= scaleY;
dstRect.w *= scaleX;
dstRect.h *= scaleY;
SDL_SetTextureAlphaMod( texture, static_cast<char>( viewInfo.ReflectionAlpha * alpha * 255 ) );
SDL_RenderCopyEx( getRenderer( ), texture, src, &dstRect, viewInfo.Angle, NULL, SDL_FLIP_VERTICAL );
}
@ -384,6 +403,10 @@ bool SDL::renderCopy( SDL_Texture *texture, float alpha, SDL_Rect *src, SDL_Rect
{
dstRect.y = dstRect.y + dstRect.h + viewInfo.ReflectionDistance;
dstRect.h = static_cast<unsigned int>( static_cast<float>(dstRect.h ) * viewInfo.ReflectionScale);
dstRect.x *= scaleX;
dstRect.y *= scaleY;
dstRect.w *= scaleX;
dstRect.h *= scaleY;
SDL_SetTextureAlphaMod( texture, static_cast<char>( viewInfo.ReflectionAlpha * alpha * 255 ) );
SDL_RenderCopyEx( getRenderer( ), texture, src, &dstRect, viewInfo.Angle, NULL, SDL_FLIP_VERTICAL );
}
@ -392,6 +415,10 @@ bool SDL::renderCopy( SDL_Texture *texture, float alpha, SDL_Rect *src, SDL_Rect
{
dstRect.w = static_cast<unsigned int>( static_cast<float>(dstRect.w ) * viewInfo.ReflectionScale);
dstRect.x = dstRect.x - dstRect.w - viewInfo.ReflectionDistance;
dstRect.x *= scaleX;
dstRect.y *= scaleY;
dstRect.w *= scaleX;
dstRect.h *= scaleY;
SDL_SetTextureAlphaMod( texture, static_cast<char>( viewInfo.ReflectionAlpha * alpha * 255 ) );
SDL_RenderCopyEx( getRenderer( ), texture, src, &dstRect, viewInfo.Angle, NULL, SDL_FLIP_HORIZONTAL );
}
@ -400,6 +427,10 @@ bool SDL::renderCopy( SDL_Texture *texture, float alpha, SDL_Rect *src, SDL_Rect
{
dstRect.x = dstRect.x + dstRect.w + viewInfo.ReflectionDistance;
dstRect.w = static_cast<unsigned int>( static_cast<float>(dstRect.w ) * viewInfo.ReflectionScale);
dstRect.x *= scaleX;
dstRect.y *= scaleY;
dstRect.w *= scaleX;
dstRect.h *= scaleY;
SDL_SetTextureAlphaMod( texture, static_cast<char>( viewInfo.ReflectionAlpha * alpha * 255 ) );
SDL_RenderCopyEx( getRenderer( ), texture, src, &dstRect, viewInfo.Angle, NULL, SDL_FLIP_HORIZONTAL );
}

View File

@ -32,7 +32,7 @@ public:
static SDL_Renderer *getRenderer( );
static SDL_mutex *getMutex( );
static SDL_Window *getWindow( );
static bool renderCopy( SDL_Texture *texture, float alpha, SDL_Rect *src, SDL_Rect *dest, ViewInfo &viewInfo );
static bool renderCopy( SDL_Texture *texture, float alpha, SDL_Rect *src, SDL_Rect *dest, ViewInfo &viewInfo, float scaleX, float scaleY );
static int getWindowWidth( )
{
return windowWidth_;

View File

@ -21,7 +21,7 @@
std::string retrofe_version_major = "0";
std::string retrofe_version_minor = "9";
std::string retrofe_version_build = "15";
std::string retrofe_version_build = "16";
std::string Version::getString( )