mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2025-12-12 17:58:53 +01:00
render scrolling text only if necessary
Signed-off-by: Vincent-FK <vincent.buso@funkey-project.com>
This commit is contained in:
parent
ebc035c869
commit
5b51c7de41
@ -59,6 +59,7 @@ ReloadableScrollingText::ReloadableScrollingText(Configuration &config, bool sys
|
||||
, displayOffset_(displayOffset)
|
||||
, scrollForward_(true)
|
||||
, needScrolling_(true)
|
||||
, needRender_(false)
|
||||
|
||||
{
|
||||
text_.clear( );
|
||||
@ -99,6 +100,8 @@ void ReloadableScrollingText::update(float dt)
|
||||
{
|
||||
currentPosition_ += scrollingSpeed_ * dt * scaleY_;
|
||||
}
|
||||
|
||||
needRender_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -141,6 +144,7 @@ void ReloadableScrollingText::initializeFonts( )
|
||||
|
||||
void ReloadableScrollingText::reloadTexture( )
|
||||
{
|
||||
needRender_ = true;
|
||||
|
||||
if (direction_ == "horizontal")
|
||||
{
|
||||
@ -730,6 +734,7 @@ void ReloadableScrollingText::draw( )
|
||||
{
|
||||
waitEndTime_ = endTime_;
|
||||
scrollForward_ = false;
|
||||
needRender_ = true;
|
||||
}
|
||||
else if(!scrollForward_ &&
|
||||
waitEndTime_ <= 0 &&
|
||||
@ -738,6 +743,7 @@ void ReloadableScrollingText::draw( )
|
||||
waitStartTime_ = startTime_;
|
||||
currentPosition_ = -startPosition_ * scaleX_;
|
||||
scrollForward_ = true;
|
||||
needRender_ = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -959,8 +965,9 @@ bool ReloadableScrollingText::mustRender( )
|
||||
{
|
||||
if ( Component::mustRender( ) ) return true;
|
||||
|
||||
if (!text_.empty( ) && baseViewInfo.Alpha > 0.0f)
|
||||
if (!text_.empty( ) && baseViewInfo.Alpha > 0.0f && needRender_)
|
||||
{
|
||||
needRender_ = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -65,4 +65,5 @@ private:
|
||||
int displayOffset_;
|
||||
bool scrollForward_;
|
||||
bool needScrolling_;
|
||||
bool needRender_;
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user