mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2026-03-29 16:22:40 +02:00
Fixed scrolling text issues regarding startTime, endTime, and startPosition.
This commit is contained in:
@@ -104,7 +104,14 @@ void ScrollingText::freeGraphicsMemory( )
|
|||||||
void ScrollingText::reloadTexture( )
|
void ScrollingText::reloadTexture( )
|
||||||
{
|
{
|
||||||
|
|
||||||
currentPosition_ = -startPosition_ * scaleX_;
|
if (direction_ == "horizontal")
|
||||||
|
{
|
||||||
|
currentPosition_ = -startPosition_ * scaleX_;
|
||||||
|
}
|
||||||
|
else if (direction_ == "vertical")
|
||||||
|
{
|
||||||
|
currentPosition_ = -startPosition_ * scaleY_;
|
||||||
|
}
|
||||||
waitStartTime_ = startTime_;
|
waitStartTime_ = startTime_;
|
||||||
waitEndTime_ = 0.0f;
|
waitEndTime_ = 0.0f;
|
||||||
|
|
||||||
@@ -467,12 +474,17 @@ void ScrollingText::draw( )
|
|||||||
// Print reformatted text
|
// Print reformatted text
|
||||||
rect.y = static_cast<int>( yOrigin );
|
rect.y = static_cast<int>( yOrigin );
|
||||||
|
|
||||||
|
if (currentPosition_ < 0)
|
||||||
|
{
|
||||||
|
rect.y -= static_cast<int>( currentPosition_ );
|
||||||
|
}
|
||||||
|
|
||||||
// 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 * scaleY_ <= imageMaxHeight && startPosition_ == 0.0f)
|
||||||
{
|
{
|
||||||
currentPosition_ = 0.0f;
|
currentPosition_ = 0.0f;
|
||||||
startTime_ = 0.0f;
|
waitStartTime_ = 0.0f;
|
||||||
endTime_ = 0.0f;
|
waitEndTime_ = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned int l = 0; l < text.size( ); ++l)
|
for (unsigned int l = 0; l < text.size( ); ++l)
|
||||||
|
|||||||
Reference in New Issue
Block a user