Adjusted the game description text scrolling parameters.

This commit is contained in:
Leon Styhre 2021-01-17 10:17:41 +01:00
parent b6e29d503c
commit 8b18022752
3 changed files with 14 additions and 7 deletions

View file

@ -65,7 +65,13 @@ GuiScraperSearch::GuiScraperSearch(
// Selected result description and container.
mDescContainer = std::make_shared<ScrollableContainer>(mWindow);
mDescContainer->setScrollParameters(1500, 1000, 11, AUTO_WIDTH_MOD);
// Adjust the game description text scrolling parameters depending on the search type.
if (mSearchType == NEVER_AUTO_ACCEPT)
mDescContainer->setScrollParameters(1500, 1500, 11, AUTO_WIDTH_MOD);
else
mDescContainer->setScrollParameters(4000, 1500, 11, AUTO_WIDTH_MOD);
mResultDesc = std::make_shared<TextComponent>(mWindow, "Result desc",
Font::get(FONT_SIZE_SMALL), 0x777777FF);
mDescContainer->addChild(mResultDesc.get());

View file

@ -60,8 +60,9 @@ void ScrollableContainer::setAutoScroll(bool autoScroll)
}
}
void ScrollableContainer::setScrollParameters(float autoScrollResetDelayConstant,
float autoScrollDelayConstant, int autoScrollSpeedConstant, float autoWidthModConstant)
void ScrollableContainer::setScrollParameters(float autoScrollDelayConstant,
float autoScrollResetDelayConstant, int autoScrollSpeedConstant,
float autoWidthModConstant)
{
mAutoScrollResetDelayConstant = autoScrollResetDelayConstant;
mAutoScrollDelayConstant = autoScrollDelayConstant;

View file

@ -10,9 +10,9 @@
#ifndef ES_CORE_COMPONENTS_SCROLLABLE_CONTAINER_H
#define ES_CORE_COMPONENTS_SCROLLABLE_CONTAINER_H
#define AUTO_SCROLL_RESET_DELAY 3500.0f // Time before resetting to top after we reach the bottom.
#define AUTO_SCROLL_DELAY 2000.0f // Time to wait before we start to scroll.
#define AUTO_SCROLL_SPEED 38 // Relative scrolling speed (lower is faster).
#define AUTO_SCROLL_DELAY 2400.0f // Time to wait before we start to scroll.
#define AUTO_SCROLL_RESET_DELAY 4000.0f // Time before resetting to top after we reach the bottom.
#define AUTO_SCROLL_SPEED 48 // Relative scrolling speed (lower is faster).
#define AUTO_WIDTH_MOD 350.0f // Line width modifier to use to calculate scrolling speed.
#include "GuiComponent.h"
@ -25,7 +25,7 @@ public:
Vector2f getScrollPos() const;
void setScrollPos(const Vector2f& pos);
void setAutoScroll(bool autoScroll);
void setScrollParameters(float autoScrollResetDelayConstant, float autoScrollDelayConstant,
void setScrollParameters(float autoScrollDelayConstant, float autoScrollResetDelayConstant,
int autoScrollSpeedConstant, float autoWidthModConstant) override;
void reset();