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
|
|
|
|
//
|
2021-09-30 18:11:56 +00:00
|
|
|
// Component containing scrollable information, used for the game
|
|
|
|
// description text in the scraper and gamelist views.
|
2020-06-28 16:39:18 +00:00
|
|
|
//
|
|
|
|
|
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-09-30 18:11:56 +00:00
|
|
|
#define AUTO_SCROLL_SPEED 4.0f
|
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:
|
2022-01-19 17:01:54 +00:00
|
|
|
ScrollableContainer();
|
2013-07-03 01:01:58 +00:00
|
|
|
|
2021-08-16 16:25:01 +00:00
|
|
|
glm::vec2 getScrollPos() const { return mScrollPos; }
|
|
|
|
void setScrollPos(const glm::vec2& pos) { mScrollPos = pos; }
|
2021-07-07 18:31:46 +00:00
|
|
|
|
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,
|
2021-09-30 18:11:56 +00:00
|
|
|
float 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;
|
2021-08-15 17:30:31 +00:00
|
|
|
void render(const glm::mat4& parentTrans) override;
|
2013-07-03 01:01:58 +00:00
|
|
|
|
|
|
|
private:
|
2021-08-16 16:25:01 +00:00
|
|
|
glm::vec2 mScrollPos;
|
|
|
|
glm::vec2 mScrollDir;
|
2021-01-05 11:52:21 +00:00
|
|
|
|
|
|
|
float mAutoScrollResetDelayConstant;
|
|
|
|
float mAutoScrollDelayConstant;
|
2021-09-30 18:11:56 +00:00
|
|
|
float mAutoScrollSpeedConstant;
|
2021-01-02 20:17:23 +00:00
|
|
|
float mResolutionModifier;
|
2021-10-14 19:59:09 +00:00
|
|
|
float mClipSpacing;
|
2021-09-30 18:11:56 +00:00
|
|
|
|
2021-01-02 20:17:23 +00:00
|
|
|
int mAutoScrollDelay;
|
|
|
|
int mAutoScrollSpeed;
|
2020-06-28 16:39:18 +00:00
|
|
|
int mAutoScrollAccumulator;
|
|
|
|
int mAutoScrollResetAccumulator;
|
2021-09-30 18:11:56 +00:00
|
|
|
int mAdjustedAutoScrollSpeed;
|
|
|
|
|
2021-01-02 20:17:23 +00:00
|
|
|
bool mAtEnd;
|
2021-09-30 18:11:56 +00:00
|
|
|
bool mUpdatedSize;
|
2013-07-03 01:01:58 +00:00
|
|
|
};
|
2017-10-31 17:12:50 +00:00
|
|
|
|
|
|
|
#endif // ES_CORE_COMPONENTS_SCROLLABLE_CONTAINER_H
|