mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2026-01-25 01:04:53 +01:00
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:
parent
ecaf871a9e
commit
d6e7de7596
@ -230,7 +230,7 @@ void Component::draw()
|
|||||||
static_cast<char>(baseViewInfo.BackgroundGreen*255),
|
static_cast<char>(baseViewInfo.BackgroundGreen*255),
|
||||||
static_cast<char>(baseViewInfo.BackgroundBlue*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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -19,13 +19,11 @@
|
|||||||
#include "../../Utility/Log.h"
|
#include "../../Utility/Log.h"
|
||||||
#include <SDL2/SDL_image.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)
|
: Component(p)
|
||||||
, texture_(NULL)
|
, texture_(NULL)
|
||||||
, file_(file)
|
, file_(file)
|
||||||
, altFile_(altFile)
|
, altFile_(altFile)
|
||||||
, scaleX_(scaleX)
|
|
||||||
, scaleY_(scaleY)
|
|
||||||
{
|
{
|
||||||
allocateGraphicsMemory();
|
allocateGraphicsMemory();
|
||||||
}
|
}
|
||||||
@ -66,8 +64,8 @@ void Image::allocateGraphicsMemory()
|
|||||||
{
|
{
|
||||||
SDL_SetTextureBlendMode(texture_, SDL_BLENDMODE_BLEND);
|
SDL_SetTextureBlendMode(texture_, SDL_BLENDMODE_BLEND);
|
||||||
SDL_QueryTexture(texture_, NULL, NULL, &width, &height);
|
SDL_QueryTexture(texture_, NULL, NULL, &width, &height);
|
||||||
baseViewInfo.ImageWidth = width * scaleX_;
|
baseViewInfo.ImageWidth = width;
|
||||||
baseViewInfo.ImageHeight = height * scaleY_;
|
baseViewInfo.ImageHeight = height;
|
||||||
}
|
}
|
||||||
SDL_UnlockMutex(SDL::getMutex());
|
SDL_UnlockMutex(SDL::getMutex());
|
||||||
|
|
||||||
@ -91,6 +89,6 @@ void Image::draw()
|
|||||||
rect.h = static_cast<int>(baseViewInfo.ScaledHeight());
|
rect.h = static_cast<int>(baseViewInfo.ScaledHeight());
|
||||||
rect.w = static_cast<int>(baseViewInfo.ScaledWidth());
|
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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
class Image : public Component
|
class Image : public Component
|
||||||
{
|
{
|
||||||
public:
|
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();
|
virtual ~Image();
|
||||||
void freeGraphicsMemory();
|
void freeGraphicsMemory();
|
||||||
void allocateGraphicsMemory();
|
void allocateGraphicsMemory();
|
||||||
@ -32,6 +32,4 @@ protected:
|
|||||||
SDL_Texture *texture_;
|
SDL_Texture *texture_;
|
||||||
std::string file_;
|
std::string file_;
|
||||||
std::string altFile_;
|
std::string altFile_;
|
||||||
float scaleX_;
|
|
||||||
float scaleY_;
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -18,7 +18,7 @@
|
|||||||
#include "../../Utility/Log.h"
|
#include "../../Utility/Log.h"
|
||||||
#include <fstream>
|
#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;
|
Image *image = NULL;
|
||||||
std::vector<std::string> extensions;
|
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))
|
if(Utils::findMatchingFile(prefix, extensions, file))
|
||||||
{
|
{
|
||||||
image = new Image(file, "", p, scaleX, scaleY);
|
image = new Image(file, "", p);
|
||||||
}
|
}
|
||||||
|
|
||||||
return image;
|
return image;
|
||||||
|
|||||||
@ -24,5 +24,5 @@
|
|||||||
class ImageBuilder
|
class ImageBuilder
|
||||||
{
|
{
|
||||||
public:
|
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);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -28,7 +28,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <iostream>
|
#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)
|
: Component(p)
|
||||||
, config_(config)
|
, config_(config)
|
||||||
, systemMode_(systemMode)
|
, systemMode_(systemMode)
|
||||||
@ -41,8 +41,6 @@ ReloadableMedia::ReloadableMedia(Configuration &config, bool systemMode, bool la
|
|||||||
, FfntInst_(font)
|
, FfntInst_(font)
|
||||||
, textFallback_(false)
|
, textFallback_(false)
|
||||||
, type_(type)
|
, type_(type)
|
||||||
, scaleX_(scaleX)
|
|
||||||
, scaleY_(scaleY)
|
|
||||||
, displayOffset_(displayOffset)
|
, displayOffset_(displayOffset)
|
||||||
, volume_(1.0)
|
, volume_(1.0)
|
||||||
|
|
||||||
@ -383,7 +381,7 @@ void ReloadableMedia::reloadTexture()
|
|||||||
// if image and artwork was not specified, fall back to displaying text
|
// if image and artwork was not specified, fall back to displaying text
|
||||||
if(!loadedComponent_ && textFallback_)
|
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.ImageWidth = loadedComponent_->baseViewInfo.ImageWidth;
|
||||||
baseViewInfo.ImageHeight = loadedComponent_->baseViewInfo.ImageHeight;
|
baseViewInfo.ImageHeight = loadedComponent_->baseViewInfo.ImageHeight;
|
||||||
}
|
}
|
||||||
@ -435,11 +433,11 @@ Component *ReloadableMedia::findComponent(std::string collection, std::string ty
|
|||||||
|
|
||||||
if(type == "video")
|
if(type == "video")
|
||||||
{
|
{
|
||||||
component = videoBuild.createVideo(imagePath, page, basename, scaleX_, scaleY_);
|
component = videoBuild.createVideo(imagePath, page, basename);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
component = imageBuild.CreateImage(imagePath, page, basename, scaleX_, scaleY_);
|
component = imageBuild.CreateImage(imagePath, page, basename);
|
||||||
}
|
}
|
||||||
|
|
||||||
return component;
|
return component;
|
||||||
|
|||||||
@ -27,7 +27,7 @@ class Image;
|
|||||||
class ReloadableMedia : public Component
|
class ReloadableMedia : public Component
|
||||||
{
|
{
|
||||||
public:
|
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();
|
virtual ~ReloadableMedia();
|
||||||
void update(float dt);
|
void update(float dt);
|
||||||
void draw();
|
void draw();
|
||||||
@ -52,8 +52,6 @@ private:
|
|||||||
Font *FfntInst_;
|
Font *FfntInst_;
|
||||||
bool textFallback_;
|
bool textFallback_;
|
||||||
std::string type_;
|
std::string type_;
|
||||||
float scaleX_;
|
|
||||||
float scaleY_;
|
|
||||||
std::string currentCollection_;
|
std::string currentCollection_;
|
||||||
Page *page_;
|
Page *page_;
|
||||||
int displayOffset_;
|
int displayOffset_;
|
||||||
|
|||||||
@ -28,7 +28,7 @@
|
|||||||
#include <algorithm>
|
#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)
|
: Component(p)
|
||||||
, config_(config)
|
, config_(config)
|
||||||
, systemMode_(systemMode)
|
, systemMode_(systemMode)
|
||||||
@ -42,8 +42,6 @@ ReloadableScrollingText::ReloadableScrollingText(Configuration &config, bool sys
|
|||||||
, pluralPrefix_(pluralPrefix)
|
, pluralPrefix_(pluralPrefix)
|
||||||
, pluralPostfix_(pluralPostfix)
|
, pluralPostfix_(pluralPostfix)
|
||||||
, alignment_(alignment)
|
, alignment_(alignment)
|
||||||
, scaleX_(scaleX)
|
|
||||||
, scaleY_(scaleY)
|
|
||||||
, direction_(direction)
|
, direction_(direction)
|
||||||
, scrollingSpeed_(scrollingSpeed)
|
, scrollingSpeed_(scrollingSpeed)
|
||||||
, startPosition_(startPosition)
|
, startPosition_(startPosition)
|
||||||
@ -81,11 +79,11 @@ void ReloadableScrollingText::update(float dt)
|
|||||||
{
|
{
|
||||||
if (direction_ == "horizontal")
|
if (direction_ == "horizontal")
|
||||||
{
|
{
|
||||||
currentPosition_ += scrollingSpeed_ * dt * scaleX_;
|
currentPosition_ += scrollingSpeed_ * dt;
|
||||||
}
|
}
|
||||||
else if (direction_ == "vertical")
|
else if (direction_ == "vertical")
|
||||||
{
|
{
|
||||||
currentPosition_ += scrollingSpeed_ * dt * scaleY_;
|
currentPosition_ += scrollingSpeed_ * dt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,11 +129,11 @@ void ReloadableScrollingText::reloadTexture( )
|
|||||||
|
|
||||||
if (direction_ == "horizontal")
|
if (direction_ == "horizontal")
|
||||||
{
|
{
|
||||||
currentPosition_ = -startPosition_ * scaleX_;
|
currentPosition_ = -startPosition_;
|
||||||
}
|
}
|
||||||
else if (direction_ == "vertical")
|
else if (direction_ == "vertical")
|
||||||
{
|
{
|
||||||
currentPosition_ = -startPosition_ * scaleY_;
|
currentPosition_ = -startPosition_;
|
||||||
}
|
}
|
||||||
waitStartTime_ = startTime_;
|
waitStartTime_ = startTime_;
|
||||||
waitEndTime_ = 0.0f;
|
waitEndTime_ = 0.0f;
|
||||||
@ -481,7 +479,7 @@ void ReloadableScrollingText::draw( )
|
|||||||
imageMaxHeight = baseViewInfo.MaxHeight;
|
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 xOrigin = baseViewInfo.XRelativeToOrigin( );
|
||||||
float yOrigin = baseViewInfo.YRelativeToOrigin( );
|
float yOrigin = baseViewInfo.YRelativeToOrigin( );
|
||||||
@ -516,43 +514,43 @@ void ReloadableScrollingText::draw( )
|
|||||||
if (font->getRect( text_[l][i], glyph) && glyph.rect.h > 0)
|
if (font->getRect( text_[l][i], glyph) && glyph.rect.h > 0)
|
||||||
{
|
{
|
||||||
SDL_Rect charRect = glyph.rect;
|
SDL_Rect charRect = glyph.rect;
|
||||||
rect.h = static_cast<int>( charRect.h * scale * scaleY_ );
|
rect.h = static_cast<int>( charRect.h * scale );
|
||||||
rect.w = static_cast<int>( charRect.w * scale * scaleX_ );
|
rect.w = static_cast<int>( charRect.w * scale );
|
||||||
rect.y = static_cast<int>( yOrigin );
|
rect.y = static_cast<int>( yOrigin );
|
||||||
|
|
||||||
if (font->getAscent( ) < glyph.maxY)
|
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
|
// 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;
|
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
|
// 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
|
// Check if glyph falls partially outside the box at the front end
|
||||||
if ( position < currentPosition_ )
|
if ( position < currentPosition_ )
|
||||||
{
|
{
|
||||||
rect.w = static_cast<int>( glyph.advance * scale * scaleX_ + position - currentPosition_ );
|
rect.w = static_cast<int>( glyph.advance * scale + position - currentPosition_ );
|
||||||
charRect.x = static_cast<int>( charRect.x + charRect.w - rect.w / scale / scaleX_ );
|
charRect.x = static_cast<int>( charRect.x + charRect.w - rect.w / scale );
|
||||||
charRect.w = static_cast<int>( rect.w / scale / scaleX_ );
|
charRect.w = static_cast<int>( rect.w / scale );
|
||||||
}
|
}
|
||||||
if (rect.w > 0)
|
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;
|
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
|
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
|
// Reset scrolling position when we're done
|
||||||
if (currentPosition_ > imageWidth * scale * scaleX_)
|
if (currentPosition_ > imageWidth * scale)
|
||||||
{
|
{
|
||||||
waitStartTime_ = startTime_;
|
waitStartTime_ = startTime_;
|
||||||
waitEndTime_ = endTime_;
|
waitEndTime_ = endTime_;
|
||||||
currentPosition_ = -startPosition_ * scaleX_;
|
currentPosition_ = -startPosition_;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -588,7 +586,7 @@ void ReloadableScrollingText::draw( )
|
|||||||
Font::GlyphInfo glyph;
|
Font::GlyphInfo glyph;
|
||||||
if (font->getRect( ' ', 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;
|
Font::GlyphInfo glyph;
|
||||||
if (font->getRect( word[i], 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
|
// 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
|
// 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;
|
currentPosition_ = 0.0f;
|
||||||
waitStartTime_ = 0.0f;
|
waitStartTime_ = 0.0f;
|
||||||
@ -688,18 +686,18 @@ void ReloadableScrollingText::draw( )
|
|||||||
rect.x = static_cast<int>( xOrigin );
|
rect.x = static_cast<int>( xOrigin );
|
||||||
if (alignment_ == "right")
|
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")
|
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::istringstream iss(text[l]);
|
||||||
std::string word;
|
std::string word;
|
||||||
unsigned int wordCount = textWords[l];
|
unsigned int wordCount = textWords[l];
|
||||||
unsigned int spaceFill = static_cast<int>( imageMaxWidth ) - textWidth[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)
|
while (iss >> word)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -710,34 +708,34 @@ void ReloadableScrollingText::draw( )
|
|||||||
if (font->getRect( word[i], glyph) && glyph.rect.h > 0)
|
if (font->getRect( word[i], glyph) && glyph.rect.h > 0)
|
||||||
{
|
{
|
||||||
SDL_Rect charRect = glyph.rect;
|
SDL_Rect charRect = glyph.rect;
|
||||||
rect.h = static_cast<int>( charRect.h * scale * scaleY_ );
|
rect.h = static_cast<int>( charRect.h * scale );
|
||||||
rect.w = static_cast<int>( charRect.w * scale * scaleX_ );
|
rect.w = static_cast<int>( charRect.w * scale );
|
||||||
yAdvance = static_cast<int>( font->getHeight( ) * scale * scaleY_ );
|
yAdvance = static_cast<int>( font->getHeight( ) * scale );
|
||||||
|
|
||||||
// Check if glyph falls partially outside the box at the bottom end
|
// Check if glyph falls partially outside the box at the bottom end
|
||||||
if ((rect.y + rect.h) >= (static_cast<int>( yOrigin ) + imageMaxHeight))
|
if ((rect.y + rect.h) >= (static_cast<int>( yOrigin ) + imageMaxHeight))
|
||||||
{
|
{
|
||||||
rect.h = static_cast<int>( yOrigin ) + static_cast<int>( imageMaxHeight ) - rect.y;
|
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
|
// 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
|
// Check if glyph falls partially outside the box at the front end
|
||||||
if ( position < currentPosition_ )
|
if ( 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_ );
|
||||||
rect.h = static_cast<int>( font->getHeight( ) * scale * scaleX_ + position - currentPosition_ );
|
rect.h = static_cast<int>( font->getHeight( ) * scale + position - currentPosition_ );
|
||||||
charRect.y = static_cast<int>( charRect.y + charRect.h - rect.h / scale / scaleX_ );
|
charRect.y = static_cast<int>( charRect.y + charRect.h - rect.h / scale );
|
||||||
charRect.h = static_cast<int>( rect.h / scale / scaleX_ );
|
charRect.h = static_cast<int>( rect.h / scale );
|
||||||
}
|
}
|
||||||
if (rect.h > 0)
|
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)
|
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
|
// 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_))
|
(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;
|
rect.y += yAdvance;
|
||||||
}
|
}
|
||||||
position += font->getHeight( ) * scale * scaleY_;
|
position += font->getHeight( ) * scale;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset scrolling position when we're done
|
// Reset scrolling position when we're done
|
||||||
if (currentPosition_ > text.size( ) * font->getHeight( ) * scale * scaleX_)
|
if (currentPosition_ > text.size( ) * font->getHeight( ) * scale)
|
||||||
{
|
{
|
||||||
waitStartTime_ = startTime_;
|
waitStartTime_ = startTime_;
|
||||||
waitEndTime_ = endTime_;
|
waitEndTime_ = endTime_;
|
||||||
currentPosition_ = -startPosition_ * scaleY_;
|
currentPosition_ = -startPosition_;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,7 +24,7 @@
|
|||||||
class ReloadableScrollingText : public Component
|
class ReloadableScrollingText : public Component
|
||||||
{
|
{
|
||||||
public:
|
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( );
|
virtual ~ReloadableScrollingText( );
|
||||||
void update(float dt);
|
void update(float dt);
|
||||||
void draw( );
|
void draw( );
|
||||||
@ -49,8 +49,6 @@ private:
|
|||||||
std::string pluralPostfix_;
|
std::string pluralPostfix_;
|
||||||
std::string alignment_;
|
std::string alignment_;
|
||||||
std::vector<std::string> text_;
|
std::vector<std::string> text_;
|
||||||
float scaleX_;
|
|
||||||
float scaleY_;
|
|
||||||
std::string direction_;
|
std::string direction_;
|
||||||
float scrollingSpeed_;
|
float scrollingSpeed_;
|
||||||
float startPosition_;
|
float startPosition_;
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <algorithm>
|
#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)
|
: Component(page)
|
||||||
, config_(config)
|
, config_(config)
|
||||||
, systemMode_(systemMode)
|
, systemMode_(systemMode)
|
||||||
@ -39,8 +39,6 @@ ReloadableText::ReloadableText(std::string type, Page &page, Configuration &conf
|
|||||||
, singlePostfix_(singlePostfix)
|
, singlePostfix_(singlePostfix)
|
||||||
, pluralPrefix_(pluralPrefix)
|
, pluralPrefix_(pluralPrefix)
|
||||||
, pluralPostfix_(pluralPostfix)
|
, pluralPostfix_(pluralPostfix)
|
||||||
, scaleX_(scaleX)
|
|
||||||
, scaleY_(scaleY)
|
|
||||||
{
|
{
|
||||||
allocateGraphicsMemory();
|
allocateGraphicsMemory();
|
||||||
}
|
}
|
||||||
@ -282,7 +280,7 @@ void ReloadableText::ReloadTexture()
|
|||||||
ss << text;
|
ss << text;
|
||||||
}
|
}
|
||||||
|
|
||||||
imageInst_ = new Text(ss.str(), page, fontInst_, scaleX_, scaleY_);
|
imageInst_ = new Text(ss.str(), page, fontInst_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
class ReloadableText : public Component
|
class ReloadableText : public Component
|
||||||
{
|
{
|
||||||
public:
|
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();
|
virtual ~ReloadableText();
|
||||||
void update(float dt);
|
void update(float dt);
|
||||||
void draw();
|
void draw();
|
||||||
@ -49,7 +49,4 @@ private:
|
|||||||
std::string singlePostfix_;
|
std::string singlePostfix_;
|
||||||
std::string pluralPrefix_;
|
std::string pluralPrefix_;
|
||||||
std::string pluralPostfix_;
|
std::string pluralPostfix_;
|
||||||
|
|
||||||
float scaleX_;
|
|
||||||
float scaleY_;
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -44,8 +44,6 @@ ScrollingList::ScrollingList( Configuration &c,
|
|||||||
Page &p,
|
Page &p,
|
||||||
bool layoutMode,
|
bool layoutMode,
|
||||||
bool commonMode,
|
bool commonMode,
|
||||||
float scaleX,
|
|
||||||
float scaleY,
|
|
||||||
Font *font,
|
Font *font,
|
||||||
std::string layoutKey,
|
std::string layoutKey,
|
||||||
std::string imageType )
|
std::string imageType )
|
||||||
@ -63,8 +61,6 @@ ScrollingList::ScrollingList( Configuration &c,
|
|||||||
, minScrollTime_( 0.500 )
|
, minScrollTime_( 0.500 )
|
||||||
, scrollPeriod_( 0 )
|
, scrollPeriod_( 0 )
|
||||||
, config_( c )
|
, config_( c )
|
||||||
, scaleX_( scaleX )
|
|
||||||
, scaleY_( scaleY )
|
|
||||||
, fontInst_( font )
|
, fontInst_( font )
|
||||||
, layoutKey_( layoutKey )
|
, layoutKey_( layoutKey )
|
||||||
, imageType_( imageType )
|
, imageType_( imageType )
|
||||||
@ -86,8 +82,6 @@ ScrollingList::ScrollingList( const ScrollingList © )
|
|||||||
, minScrollTime_( copy.minScrollTime_ )
|
, minScrollTime_( copy.minScrollTime_ )
|
||||||
, scrollPeriod_( copy.startScrollTime_ )
|
, scrollPeriod_( copy.startScrollTime_ )
|
||||||
, config_( copy.config_ )
|
, config_( copy.config_ )
|
||||||
, scaleX_( copy.scaleX_ )
|
|
||||||
, scaleY_( copy.scaleY_ )
|
|
||||||
, fontInst_( copy.fontInst_ )
|
, fontInst_( copy.fontInst_ )
|
||||||
, layoutKey_( copy.layoutKey_ )
|
, layoutKey_( copy.layoutKey_ )
|
||||||
, imageType_( copy.imageType_ )
|
, imageType_( copy.imageType_ )
|
||||||
@ -776,7 +770,7 @@ bool ScrollingList::allocateTexture( unsigned int index, Item *item )
|
|||||||
else
|
else
|
||||||
config_.getMediaPropertyAbsolutePath( collectionName, imageType_, false, imagePath );
|
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
|
// check sub-collection path for art
|
||||||
if ( !t && !commonMode_ )
|
if ( !t && !commonMode_ )
|
||||||
{
|
{
|
||||||
@ -789,7 +783,7 @@ bool ScrollingList::allocateTexture( unsigned int index, Item *item )
|
|||||||
{
|
{
|
||||||
config_.getMediaPropertyAbsolutePath( item->collectionInfo->name, imageType_, false, imagePath );
|
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
|
else
|
||||||
config_.getMediaPropertyAbsolutePath( item->name, imageType_, true, imagePath );
|
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
|
// check rom directory path for art
|
||||||
if ( !t )
|
if ( !t )
|
||||||
t = imageBuild.CreateImage( item->filepath, page, imageType_, scaleX_, scaleY_ );
|
t = imageBuild.CreateImage( item->filepath, page, imageType_ );
|
||||||
|
|
||||||
if ( !t )
|
if ( !t )
|
||||||
{
|
{
|
||||||
t = new Text(item->title, page, fontInst_, scaleX_, scaleY_ );
|
t = new Text(item->title, page, fontInst_ );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( t )
|
if ( t )
|
||||||
|
|||||||
@ -37,8 +37,6 @@ public:
|
|||||||
Page &p,
|
Page &p,
|
||||||
bool layoutMode,
|
bool layoutMode,
|
||||||
bool commonMode,
|
bool commonMode,
|
||||||
float scaleX,
|
|
||||||
float scaleY,
|
|
||||||
Font *font,
|
Font *font,
|
||||||
std::string layoutKey,
|
std::string layoutKey,
|
||||||
std::string imageType );
|
std::string imageType );
|
||||||
@ -123,8 +121,6 @@ private:
|
|||||||
float scrollPeriod_;
|
float scrollPeriod_;
|
||||||
|
|
||||||
Configuration &config_;
|
Configuration &config_;
|
||||||
float scaleX_;
|
|
||||||
float scaleY_;
|
|
||||||
Font *fontInst_;
|
Font *fontInst_;
|
||||||
std::string layoutKey_;
|
std::string layoutKey_;
|
||||||
std::string imageType_;
|
std::string imageType_;
|
||||||
|
|||||||
@ -22,12 +22,10 @@
|
|||||||
#include <sstream>
|
#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)
|
: Component(p)
|
||||||
, textData_(text)
|
, textData_(text)
|
||||||
, fontInst_(font)
|
, fontInst_(font)
|
||||||
, scaleX_(scaleX)
|
|
||||||
, scaleY_(scaleY)
|
|
||||||
{
|
{
|
||||||
allocateGraphicsMemory( );
|
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 );
|
rect.x += static_cast<int>( glyph.advance * scale );
|
||||||
|
|
||||||
|
|||||||
@ -29,7 +29,7 @@ class Text : public Component
|
|||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Text( std::string text, Page &p, Font *font, float scaleX, float scaleY );
|
Text( std::string text, Page &p, Font *font );
|
||||||
virtual ~Text( );
|
virtual ~Text( );
|
||||||
void setText( std::string text, int id = -1 );
|
void setText( std::string text, int id = -1 );
|
||||||
void allocateGraphicsMemory( );
|
void allocateGraphicsMemory( );
|
||||||
@ -41,6 +41,4 @@ public:
|
|||||||
private:
|
private:
|
||||||
std::string textData_;
|
std::string textData_;
|
||||||
Font *fontInst_;
|
Font *fontInst_;
|
||||||
float scaleX_;
|
|
||||||
float scaleY_;
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -26,14 +26,12 @@
|
|||||||
bool Video::enabled_ = true;
|
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)
|
: Component(p)
|
||||||
, video_(NULL)
|
, video_(NULL)
|
||||||
, file_(file)
|
, file_(file)
|
||||||
, altFile_(altFile)
|
, altFile_(altFile)
|
||||||
, numLoops_(numLoops)
|
, numLoops_(numLoops)
|
||||||
, scaleX_(scaleX)
|
|
||||||
, scaleY_(scaleY)
|
|
||||||
, volume_(1.0)
|
, volume_(1.0)
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -105,7 +103,7 @@ void Video::allocateGraphicsMemory( )
|
|||||||
IVideo *video = new GStreamerVideo();
|
IVideo *video = new GStreamerVideo();
|
||||||
video->initialize();
|
video->initialize();
|
||||||
((GStreamerVideo *)(video))->setNumLoops(numLoops_);
|
((GStreamerVideo *)(video))->setNumLoops(numLoops_);
|
||||||
video_ = new VideoComponent( video, page, file, scaleX_, scaleY_ );
|
video_ = new VideoComponent( video, page, file );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
class Video : public Component
|
class Video : public Component
|
||||||
{
|
{
|
||||||
public:
|
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( );
|
virtual ~Video( );
|
||||||
static void setEnabled(bool enabled);
|
static void setEnabled(bool enabled);
|
||||||
void update(float dt);
|
void update(float dt);
|
||||||
@ -38,8 +38,6 @@ protected:
|
|||||||
std::string file_;
|
std::string file_;
|
||||||
std::string altFile_;
|
std::string altFile_;
|
||||||
int numLoops_;
|
int numLoops_;
|
||||||
float scaleX_;
|
|
||||||
float scaleY_;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static bool enabled_;
|
static bool enabled_;
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
#include <fstream>
|
#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;
|
VideoComponent *component = NULL;
|
||||||
std::vector<std::string> extensions;
|
std::vector<std::string> extensions;
|
||||||
@ -40,7 +40,7 @@ VideoComponent * VideoBuilder::createVideo(std::string path, Page &page, std::st
|
|||||||
|
|
||||||
if(video)
|
if(video)
|
||||||
{
|
{
|
||||||
component = new VideoComponent(video, page, file, scaleX, scaleY);
|
component = new VideoComponent(video, page, file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -24,7 +24,7 @@
|
|||||||
class VideoBuilder
|
class VideoBuilder
|
||||||
{
|
{
|
||||||
public:
|
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:
|
private:
|
||||||
VideoFactory factory_;
|
VideoFactory factory_;
|
||||||
|
|||||||
@ -21,12 +21,10 @@
|
|||||||
#include "../../Video/GStreamerVideo.h"
|
#include "../../Video/GStreamerVideo.h"
|
||||||
#include "../../SDL.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)
|
: Component(p)
|
||||||
, videoFile_(videoFile)
|
, videoFile_(videoFile)
|
||||||
, videoInst_(videoInst)
|
, videoInst_(videoInst)
|
||||||
, scaleX_(scaleX)
|
|
||||||
, scaleY_(scaleY)
|
|
||||||
, isPlaying_(false)
|
, isPlaying_(false)
|
||||||
, volume_(1.0)
|
, volume_(1.0)
|
||||||
{
|
{
|
||||||
@ -99,7 +97,7 @@ void VideoComponent::draw()
|
|||||||
|
|
||||||
if(texture)
|
if(texture)
|
||||||
{
|
{
|
||||||
SDL::renderCopy(texture, baseViewInfo.Alpha, NULL, &rect, baseViewInfo);
|
SDL::renderCopy(texture, baseViewInfo.Alpha, NULL, &rect, baseViewInfo, page.getScaleX(), page.getScaleY());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
class VideoComponent : public Component
|
class VideoComponent : public Component
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VideoComponent(IVideo *videoInst, Page &p, std::string videoFile, float scaleX, float scaleY);
|
VideoComponent(IVideo *videoInst, Page &p, std::string videoFile);
|
||||||
virtual ~VideoComponent();
|
virtual ~VideoComponent();
|
||||||
void update(float dt);
|
void update(float dt);
|
||||||
void draw();
|
void draw();
|
||||||
@ -39,8 +39,6 @@ private:
|
|||||||
std::string videoFile_;
|
std::string videoFile_;
|
||||||
std::string name_;
|
std::string name_;
|
||||||
IVideo *videoInst_;
|
IVideo *videoInst_;
|
||||||
float scaleX_;
|
|
||||||
float scaleY_;
|
|
||||||
bool isPlaying_;
|
bool isPlaying_;
|
||||||
double volume_;
|
double volume_;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -28,7 +28,7 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
|
||||||
Page::Page(Configuration &config)
|
Page::Page(Configuration &config, float scaleX, float scaleY)
|
||||||
: config_(config)
|
: config_(config)
|
||||||
, menuDepth_(0)
|
, menuDepth_(0)
|
||||||
, scrollActive_(false)
|
, scrollActive_(false)
|
||||||
@ -39,6 +39,8 @@ Page::Page(Configuration &config)
|
|||||||
, highlightSoundChunk_(NULL)
|
, highlightSoundChunk_(NULL)
|
||||||
, selectSoundChunk_(NULL)
|
, selectSoundChunk_(NULL)
|
||||||
, minShowTime_(0)
|
, minShowTime_(0)
|
||||||
|
, scaleX_(scaleX)
|
||||||
|
, scaleY_(scaleY)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1546,3 +1548,15 @@ bool Page::hasSubs()
|
|||||||
{
|
{
|
||||||
return collections_.back().collection->hasSubs;
|
return collections_.back().collection->hasSubs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
float Page::getScaleX()
|
||||||
|
{
|
||||||
|
return scaleX_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
float Page::getScaleY()
|
||||||
|
{
|
||||||
|
return scaleY_;
|
||||||
|
}
|
||||||
|
|||||||
@ -40,7 +40,7 @@ public:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Page(Configuration &c);
|
Page(Configuration &c, float scaleX, float scaleY);
|
||||||
virtual ~Page();
|
virtual ~Page();
|
||||||
void deInitialize();
|
void deInitialize();
|
||||||
virtual void onNewItemSelected();
|
virtual void onNewItemSelected();
|
||||||
@ -98,30 +98,32 @@ public:
|
|||||||
bool isSelectPlaying();
|
bool isSelectPlaying();
|
||||||
std::string getCollectionName();
|
std::string getCollectionName();
|
||||||
CollectionInfo *getCollection();
|
CollectionInfo *getCollection();
|
||||||
void setMinShowTime(float value);
|
void setMinShowTime(float value);
|
||||||
float getMinShowTime();
|
float getMinShowTime();
|
||||||
void menuScroll();
|
void menuScroll();
|
||||||
void highlightEnter();
|
void highlightEnter();
|
||||||
void highlightExit();
|
void highlightExit();
|
||||||
void playlistEnter();
|
void playlistEnter();
|
||||||
void playlistExit();
|
void playlistExit();
|
||||||
void menuJumpEnter();
|
void menuJumpEnter();
|
||||||
void menuJumpExit();
|
void menuJumpExit();
|
||||||
void attractEnter( );
|
void attractEnter( );
|
||||||
void attract( );
|
void attract( );
|
||||||
void attractExit( );
|
void attractExit( );
|
||||||
void triggerEvent( std::string action );
|
void triggerEvent( std::string action );
|
||||||
void setText( std::string text, int id );
|
void setText( std::string text, int id );
|
||||||
void addPlaylist();
|
void addPlaylist();
|
||||||
void removePlaylist();
|
void removePlaylist();
|
||||||
void updateLastPlayedPlaylist( Item *item );
|
void updateLastPlayedPlaylist( Item *item );
|
||||||
void reallocateMenuSpritePoints();
|
void reallocateMenuSpritePoints();
|
||||||
bool isMenuScrolling();
|
bool isMenuScrolling();
|
||||||
bool isPlaying();
|
bool isPlaying();
|
||||||
void resetScrollPeriod();
|
void resetScrollPeriod();
|
||||||
void updateScrollPeriod();
|
void updateScrollPeriod();
|
||||||
void scroll(bool forward);
|
void scroll(bool forward);
|
||||||
bool hasSubs();
|
bool hasSubs();
|
||||||
|
float getScaleX();
|
||||||
|
float getScaleY();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void playlistChange();
|
void playlistChange();
|
||||||
@ -160,6 +162,8 @@ private:
|
|||||||
float minShowTime_;
|
float minShowTime_;
|
||||||
float elapsedTime_;
|
float elapsedTime_;
|
||||||
CollectionInfo::Playlists_T::iterator playlist_;
|
CollectionInfo::Playlists_T::iterator playlist_;
|
||||||
|
float scaleX_;
|
||||||
|
float scaleY_;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -57,6 +57,8 @@ PageBuilder::PageBuilder(std::string layoutKey, std::string layoutPage, Configur
|
|||||||
, scaleY_(1)
|
, scaleY_(1)
|
||||||
, screenHeight_(0)
|
, screenHeight_(0)
|
||||||
, screenWidth_(0)
|
, screenWidth_(0)
|
||||||
|
, layoutHeight_(0)
|
||||||
|
, layoutWidth_(0)
|
||||||
, fontSize_(24)
|
, fontSize_(24)
|
||||||
, fontCache_(fc)
|
, fontCache_(fc)
|
||||||
, isMenu_(isMenu)
|
, isMenu_(isMenu)
|
||||||
@ -156,8 +158,6 @@ Page *PageBuilder::buildPage( std::string collectionName )
|
|||||||
xml_attribute<> *fontSizeXml = root->first_attribute("loadFontSize");
|
xml_attribute<> *fontSizeXml = root->first_attribute("loadFontSize");
|
||||||
xml_attribute<> *minShowTimeXml = root->first_attribute("minShowTime");
|
xml_attribute<> *minShowTimeXml = root->first_attribute("minShowTime");
|
||||||
|
|
||||||
int layoutHeight;
|
|
||||||
int layoutWidth;
|
|
||||||
if(!layoutWidthXml || !layoutHeightXml)
|
if(!layoutWidthXml || !layoutHeightXml)
|
||||||
{
|
{
|
||||||
Logger::write(Logger::ZONE_ERROR, "Layout", "<layout> tag must specify a width and height");
|
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());
|
fontSize_ = Utils::convertInt(fontSizeXml->value());
|
||||||
}
|
}
|
||||||
|
|
||||||
layoutWidth = Utils::convertInt(layoutWidthXml->value());
|
layoutWidth_ = Utils::convertInt(layoutWidthXml->value());
|
||||||
layoutHeight = Utils::convertInt(layoutHeightXml->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");
|
Logger::write(Logger::ZONE_ERROR, "Layout", "Layout width and height cannot be set to 0");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
scaleX_ = (float)screenWidth_ / (float)layoutWidth;
|
scaleX_ = (float)screenWidth_ / (float)layoutWidth_;
|
||||||
scaleY_ = (float)screenHeight_ / (float)layoutHeight;
|
scaleY_ = (float)screenHeight_ / (float)layoutHeight_;
|
||||||
|
|
||||||
std::stringstream ss;
|
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());
|
Logger::write(Logger::ZONE_INFO, "Layout", "Layout resolution " + ss.str());
|
||||||
|
|
||||||
page = new Page(config_);
|
page = new Page(config_, scaleX_, scaleY_);
|
||||||
|
|
||||||
if(minShowTimeXml)
|
if(minShowTimeXml)
|
||||||
{
|
{
|
||||||
@ -310,15 +310,15 @@ float PageBuilder::getHorizontalAlignment(xml_attribute<> *attribute, float valu
|
|||||||
}
|
}
|
||||||
else if(!str.compare("center"))
|
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"))
|
else if(!str.compare("right") || !str.compare("stretch"))
|
||||||
{
|
{
|
||||||
value = static_cast<float>(screenWidth_);
|
value = static_cast<float>(layoutWidth_);
|
||||||
}
|
}
|
||||||
else
|
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"))
|
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"))
|
else if(!str.compare("bottom") || !str.compare("stretch"))
|
||||||
{
|
{
|
||||||
value = static_cast<float>(screenHeight_);
|
value = static_cast<float>(layoutHeight_);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
value = Utils::convertFloat(str) * scaleY_;
|
value = Utils::convertFloat(str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
@ -410,7 +410,7 @@ bool PageBuilder::buildComponents(xml_node<> *layout, Page *page)
|
|||||||
std::string altImagePath;
|
std::string altImagePath;
|
||||||
altImagePath = Utils::combinePath(Configuration::absolutePath, "layouts", layoutName, std::string(src->value()));
|
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 );
|
c->setId( id );
|
||||||
xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload");
|
xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload");
|
||||||
if (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()));
|
altVideoPath = Utils::combinePath(Configuration::absolutePath, "layouts", layoutName, std::string(srcXml->value()));
|
||||||
int numLoops = numLoopsXml ? Utils::convertInt(numLoopsXml->value()) : 1;
|
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 );
|
c->setId( id );
|
||||||
xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload");
|
xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload");
|
||||||
if (menuScrollReload &&
|
if (menuScrollReload &&
|
||||||
@ -489,7 +489,7 @@ bool PageBuilder::buildComponents(xml_node<> *layout, Page *page)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
Font *font = addFont(componentXml, NULL);
|
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 );
|
c->setId( id );
|
||||||
xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload");
|
xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload");
|
||||||
if (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"))
|
for(xml_node<> *componentXml = layout->first_node("statusText"); componentXml; componentXml = componentXml->next_sibling("statusText"))
|
||||||
{
|
{
|
||||||
Font *font = addFont(componentXml, NULL);
|
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");
|
xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload");
|
||||||
if (menuScrollReload &&
|
if (menuScrollReload &&
|
||||||
(Utils::toLower(menuScrollReload->value()) == "true" ||
|
(Utils::toLower(menuScrollReload->value()) == "true" ||
|
||||||
@ -661,7 +661,7 @@ void PageBuilder::loadReloadableImages(xml_node<> *layout, std::string tagName,
|
|||||||
{
|
{
|
||||||
pluralPostfix = pluralPostfixXml->value();
|
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 );
|
c->setId( id );
|
||||||
xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload");
|
xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload");
|
||||||
if (menuScrollReload &&
|
if (menuScrollReload &&
|
||||||
@ -733,7 +733,7 @@ void PageBuilder::loadReloadableImages(xml_node<> *layout, std::string tagName,
|
|||||||
{
|
{
|
||||||
pluralPostfix = pluralPostfixXml->value();
|
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 );
|
c->setId( id );
|
||||||
xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload");
|
xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload");
|
||||||
if (menuScrollReload &&
|
if (menuScrollReload &&
|
||||||
@ -747,7 +747,7 @@ void PageBuilder::loadReloadableImages(xml_node<> *layout, std::string tagName,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
Font *font = addFont(componentXml, NULL);
|
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 );
|
c->setId( id );
|
||||||
xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload");
|
xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload");
|
||||||
if (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.
|
// on default, text will be rendered to the menu. Preload it into cache.
|
||||||
Font *font = addFont(itemDefaults, NULL);
|
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)
|
if(scrollTimeXml)
|
||||||
{
|
{
|
||||||
@ -1282,8 +1282,8 @@ void PageBuilder::buildViewInfo(xml_node<> *componentXml, ViewInfo &info, xml_no
|
|||||||
float yOriginRelative = getVerticalAlignment(yOrigin, 0);
|
float yOriginRelative = getVerticalAlignment(yOrigin, 0);
|
||||||
|
|
||||||
// the origins need to be saved as a percent since the heights and widths can be scaled
|
// the origins need to be saved as a percent since the heights and widths can be scaled
|
||||||
info.XOrigin = xOriginRelative / screenWidth_;
|
info.XOrigin = xOriginRelative / layoutWidth_;
|
||||||
info.YOrigin = yOriginRelative / screenHeight_;
|
info.YOrigin = yOriginRelative / layoutHeight_;
|
||||||
|
|
||||||
|
|
||||||
if(!height && !width)
|
if(!height && !width)
|
||||||
@ -1301,17 +1301,17 @@ void PageBuilder::buildViewInfo(xml_node<> *componentXml, ViewInfo &info, xml_no
|
|||||||
info.MinWidth = getHorizontalAlignment(minWidth, 0);
|
info.MinWidth = getHorizontalAlignment(minWidth, 0);
|
||||||
info.MaxHeight = getVerticalAlignment(maxHeight, FLT_MAX);
|
info.MaxHeight = getVerticalAlignment(maxHeight, FLT_MAX);
|
||||||
info.MaxWidth = getVerticalAlignment(maxWidth, FLT_MAX);
|
info.MaxWidth = getVerticalAlignment(maxWidth, FLT_MAX);
|
||||||
info.Alpha = alpha ? Utils::convertFloat(alpha->value()) : 1.f;
|
info.Alpha = alpha ? Utils::convertFloat(alpha->value()) : 1.f;
|
||||||
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;
|
||||||
info.Reflection = reflection ? reflection->value() : "";
|
info.Reflection = reflection ? reflection->value() : "";
|
||||||
info.ReflectionDistance = reflectionDistance ? Utils::convertInt(reflectionDistance->value()) : 0;
|
info.ReflectionDistance = reflectionDistance ? Utils::convertInt(reflectionDistance->value()) : 0;
|
||||||
info.ReflectionScale = reflectionScale ? Utils::convertFloat(reflectionScale->value()) : 0.25f;
|
info.ReflectionScale = reflectionScale ? Utils::convertFloat(reflectionScale->value()) : 0.25f;
|
||||||
info.ReflectionAlpha = reflectionAlpha ? Utils::convertFloat(reflectionAlpha->value()) : 1.f;
|
info.ReflectionAlpha = reflectionAlpha ? Utils::convertFloat(reflectionAlpha->value()) : 1.f;
|
||||||
info.ContainerX = containerX ? Utils::convertFloat(containerX->value()) * scaleX_ : 0.f;
|
info.ContainerX = containerX ? Utils::convertFloat(containerX->value()) : 0.f;
|
||||||
info.ContainerY = containerY ? Utils::convertFloat(containerY->value()) * scaleY_ : 0.f;
|
info.ContainerY = containerY ? Utils::convertFloat(containerY->value()) : 0.f;
|
||||||
info.ContainerWidth = containerWidth ? Utils::convertFloat(containerWidth->value()) * scaleX_ : -1.f;
|
info.ContainerWidth = containerWidth ? Utils::convertFloat(containerWidth->value()) : -1.f;
|
||||||
info.ContainerHeight = containerHeight ? Utils::convertFloat(containerHeight->value()) * scaleY_ : -1.f;
|
info.ContainerHeight = containerHeight ? Utils::convertFloat(containerHeight->value()) : -1.f;
|
||||||
|
|
||||||
if(fontColor)
|
if(fontColor)
|
||||||
{
|
{
|
||||||
@ -1427,8 +1427,8 @@ void PageBuilder::getAnimationEvents(xml_node<> *node, TweenSet &tweens)
|
|||||||
|
|
||||||
// x origin gets translated to a percent
|
// x origin gets translated to a percent
|
||||||
case TWEEN_PROPERTY_X_ORIGIN:
|
case TWEEN_PROPERTY_X_ORIGIN:
|
||||||
fromValue = getHorizontalAlignment(from, 0) / screenWidth_;
|
fromValue = getHorizontalAlignment(from, 0) / layoutWidth_;
|
||||||
toValue = getHorizontalAlignment(to, 0) / screenWidth_;
|
toValue = getHorizontalAlignment(to, 0) / layoutWidth_;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TWEEN_PROPERTY_HEIGHT:
|
case TWEEN_PROPERTY_HEIGHT:
|
||||||
@ -1444,8 +1444,8 @@ void PageBuilder::getAnimationEvents(xml_node<> *node, TweenSet &tweens)
|
|||||||
|
|
||||||
// y origin gets translated to a percent
|
// y origin gets translated to a percent
|
||||||
case TWEEN_PROPERTY_Y_ORIGIN:
|
case TWEEN_PROPERTY_Y_ORIGIN:
|
||||||
fromValue = getVerticalAlignment(from, 0) / screenHeight_;
|
fromValue = getVerticalAlignment(from, 0) / layoutHeight_;
|
||||||
toValue = getVerticalAlignment(to, 0) / screenHeight_;
|
toValue = getVerticalAlignment(to, 0) / layoutHeight_;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TWEEN_PROPERTY_MAX_WIDTH:
|
case TWEEN_PROPERTY_MAX_WIDTH:
|
||||||
|
|||||||
@ -46,6 +46,8 @@ private:
|
|||||||
float scaleY_;
|
float scaleY_;
|
||||||
int screenHeight_;
|
int screenHeight_;
|
||||||
int screenWidth_;
|
int screenWidth_;
|
||||||
|
int layoutHeight_;
|
||||||
|
int layoutWidth_;
|
||||||
SDL_Color fontColor_;
|
SDL_Color fontColor_;
|
||||||
std::string fontName_;
|
std::string fontName_;
|
||||||
int fontSize_;
|
int fontSize_;
|
||||||
|
|||||||
@ -59,8 +59,6 @@ public:
|
|||||||
float Angle;
|
float Angle;
|
||||||
float Alpha;
|
float Alpha;
|
||||||
unsigned int Layer;
|
unsigned int Layer;
|
||||||
float HorizontalScale;
|
|
||||||
float VerticalScale;
|
|
||||||
float BackgroundRed;
|
float BackgroundRed;
|
||||||
float BackgroundGreen;
|
float BackgroundGreen;
|
||||||
float BackgroundBlue;
|
float BackgroundBlue;
|
||||||
|
|||||||
@ -273,15 +273,15 @@ SDL_Window* SDL::getWindow( )
|
|||||||
|
|
||||||
|
|
||||||
// Render a copy of a texture
|
// 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 srcRect;
|
||||||
SDL_Rect dstRect;
|
SDL_Rect dstRect;
|
||||||
SDL_Rect srcRectCopy;
|
SDL_Rect srcRectCopy;
|
||||||
SDL_Rect dstRectCopy;
|
SDL_Rect dstRectCopy;
|
||||||
double scaleX;
|
double imageScaleX;
|
||||||
double scaleY;
|
double imageScaleY;
|
||||||
|
|
||||||
dstRect.w = dest->w;
|
dstRect.w = dest->w;
|
||||||
dstRect.h = dest->h;
|
dstRect.h = dest->h;
|
||||||
@ -317,8 +317,8 @@ bool SDL::renderCopy( SDL_Texture *texture, float alpha, SDL_Rect *src, SDL_Rect
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Define the scale
|
// Define the scale
|
||||||
scaleX = (dstRect.w > 0) ? static_cast<double>( srcRect.w ) / static_cast<double>( dstRect.w ) : 0.0;
|
imageScaleX = (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;
|
imageScaleY = (dstRect.h > 0) ? static_cast<double>( srcRect.h ) / static_cast<double>( dstRect.h ) : 0.0;
|
||||||
|
|
||||||
// Make a copy
|
// Make a copy
|
||||||
srcRectCopy.x = srcRect.x;
|
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
|
// Define source width and height
|
||||||
srcRect.w = static_cast<int>( dstRect.w * scaleX );
|
srcRect.w = static_cast<int>( dstRect.w * imageScaleX );
|
||||||
srcRect.h = static_cast<int>( dstRect.h * scaleY );
|
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_SetTextureAlphaMod( texture, static_cast<char>( alpha * 255 ) );
|
||||||
SDL_RenderCopyEx( getRenderer( ), texture, &srcRect, &dstRect, viewInfo.Angle, NULL, SDL_FLIP_NONE );
|
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" )
|
if ( viewInfo.Reflection == "top" )
|
||||||
{
|
{
|
||||||
dstRect.h = static_cast<unsigned int>( static_cast<float>(dstRect.h ) * viewInfo.ReflectionScale);
|
dstRect.h = static_cast<unsigned int>( static_cast<float>(dstRect.h ) * viewInfo.ReflectionScale);
|
||||||
dstRect.y = dstRect.y - dstRect.h - viewInfo.ReflectionDistance;
|
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_SetTextureAlphaMod( texture, static_cast<char>( viewInfo.ReflectionAlpha * alpha * 255 ) );
|
||||||
SDL_RenderCopyEx( getRenderer( ), texture, src, &dstRect, viewInfo.Angle, NULL, SDL_FLIP_VERTICAL );
|
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.y = dstRect.y + dstRect.h + viewInfo.ReflectionDistance;
|
||||||
dstRect.h = static_cast<unsigned int>( static_cast<float>(dstRect.h ) * viewInfo.ReflectionScale);
|
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_SetTextureAlphaMod( texture, static_cast<char>( viewInfo.ReflectionAlpha * alpha * 255 ) );
|
||||||
SDL_RenderCopyEx( getRenderer( ), texture, src, &dstRect, viewInfo.Angle, NULL, SDL_FLIP_VERTICAL );
|
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.w = static_cast<unsigned int>( static_cast<float>(dstRect.w ) * viewInfo.ReflectionScale);
|
||||||
dstRect.x = dstRect.x - dstRect.w - viewInfo.ReflectionDistance;
|
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_SetTextureAlphaMod( texture, static_cast<char>( viewInfo.ReflectionAlpha * alpha * 255 ) );
|
||||||
SDL_RenderCopyEx( getRenderer( ), texture, src, &dstRect, viewInfo.Angle, NULL, SDL_FLIP_HORIZONTAL );
|
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.x = dstRect.x + dstRect.w + viewInfo.ReflectionDistance;
|
||||||
dstRect.w = static_cast<unsigned int>( static_cast<float>(dstRect.w ) * viewInfo.ReflectionScale);
|
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_SetTextureAlphaMod( texture, static_cast<char>( viewInfo.ReflectionAlpha * alpha * 255 ) );
|
||||||
SDL_RenderCopyEx( getRenderer( ), texture, src, &dstRect, viewInfo.Angle, NULL, SDL_FLIP_HORIZONTAL );
|
SDL_RenderCopyEx( getRenderer( ), texture, src, &dstRect, viewInfo.Angle, NULL, SDL_FLIP_HORIZONTAL );
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,7 +32,7 @@ public:
|
|||||||
static SDL_Renderer *getRenderer( );
|
static SDL_Renderer *getRenderer( );
|
||||||
static SDL_mutex *getMutex( );
|
static SDL_mutex *getMutex( );
|
||||||
static SDL_Window *getWindow( );
|
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( )
|
static int getWindowWidth( )
|
||||||
{
|
{
|
||||||
return windowWidth_;
|
return windowWidth_;
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
std::string retrofe_version_major = "0";
|
std::string retrofe_version_major = "0";
|
||||||
std::string retrofe_version_minor = "9";
|
std::string retrofe_version_minor = "9";
|
||||||
std::string retrofe_version_build = "15";
|
std::string retrofe_version_build = "16";
|
||||||
|
|
||||||
|
|
||||||
std::string Version::getString( )
|
std::string Version::getString( )
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user