2020-09-17 20:00:07 +00:00
|
|
|
// SPDX-License-Identifier: MIT
|
2020-06-28 16:39:18 +00:00
|
|
|
//
|
2020-09-17 20:00:07 +00:00
|
|
|
// EmulationStation Desktop Edition
|
2020-06-28 16:39:18 +00:00
|
|
|
// ScrollableContainer.h
|
|
|
|
//
|
|
|
|
// Area containing scrollable information, for example the game description
|
|
|
|
// text container in the detailed, video and grid views.
|
|
|
|
//
|
|
|
|
|
2017-10-31 17:12:50 +00:00
|
|
|
#ifndef ES_CORE_COMPONENTS_SCROLLABLE_CONTAINER_H
|
|
|
|
#define ES_CORE_COMPONENTS_SCROLLABLE_CONTAINER_H
|
2013-07-03 01:01:58 +00:00
|
|
|
|
2021-01-17 21:02:22 +00:00
|
|
|
// Time in ms to wait before scrolling starts.
|
|
|
|
#define AUTO_SCROLL_DELAY 4500.0f
|
|
|
|
// Time in ms before resetting to the top after we reach the bottom.
|
|
|
|
#define AUTO_SCROLL_RESET_DELAY 7000.0f
|
|
|
|
// Relative scrolling speed (lower is faster).
|
2021-01-18 23:11:02 +00:00
|
|
|
#define AUTO_SCROLL_SPEED 90
|
2021-01-05 11:52:21 +00:00
|
|
|
|
2014-06-20 01:30:09 +00:00
|
|
|
#include "GuiComponent.h"
|
2013-07-03 01:01:58 +00:00
|
|
|
|
|
|
|
class ScrollableContainer : public GuiComponent
|
|
|
|
{
|
|
|
|
public:
|
2020-06-28 16:39:18 +00:00
|
|
|
ScrollableContainer(Window* window);
|
2013-07-03 01:01:58 +00:00
|
|
|
|
2021-07-07 18:31:46 +00:00
|
|
|
Vector2f getScrollPos() const { return mScrollPos; }
|
|
|
|
void setScrollPos(const Vector2f& pos) { mScrollPos = pos; }
|
|
|
|
|
2020-06-28 16:39:18 +00:00
|
|
|
void setAutoScroll(bool autoScroll);
|
2021-07-07 18:31:46 +00:00
|
|
|
void setScrollParameters(float autoScrollDelayConstant,
|
|
|
|
float autoScrollResetDelayConstant,
|
|
|
|
int autoScrollSpeedConstant) override;
|
2020-06-28 16:39:18 +00:00
|
|
|
void reset();
|
2013-07-03 01:01:58 +00:00
|
|
|
|
2020-06-28 16:39:18 +00:00
|
|
|
void update(int deltaTime) override;
|
|
|
|
void render(const Transform4x4f& parentTrans) override;
|
2013-07-03 01:01:58 +00:00
|
|
|
|
|
|
|
private:
|
2020-06-28 16:39:18 +00:00
|
|
|
Vector2f getContentSize();
|
|
|
|
|
|
|
|
Vector2f mScrollPos;
|
|
|
|
Vector2f mScrollDir;
|
2021-01-05 11:52:21 +00:00
|
|
|
|
2021-01-18 23:11:02 +00:00
|
|
|
float mFontSize;
|
|
|
|
float mSmallFontSize;
|
|
|
|
|
2021-01-05 11:52:21 +00:00
|
|
|
float mAutoScrollResetDelayConstant;
|
|
|
|
float mAutoScrollDelayConstant;
|
|
|
|
int mAutoScrollSpeedConstant;
|
|
|
|
|
2021-01-02 20:17:23 +00:00
|
|
|
float mResolutionModifier;
|
|
|
|
int mAutoScrollDelay;
|
|
|
|
int mAutoScrollSpeed;
|
2020-06-28 16:39:18 +00:00
|
|
|
int mAutoScrollAccumulator;
|
|
|
|
int mAutoScrollResetAccumulator;
|
2021-01-02 20:17:23 +00:00
|
|
|
bool mAtEnd;
|
2013-07-03 01:01:58 +00:00
|
|
|
};
|
2017-10-31 17:12:50 +00:00
|
|
|
|
|
|
|
#endif // ES_CORE_COMPONENTS_SCROLLABLE_CONTAINER_H
|