mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-25 23:55:38 +00:00
Added a new fastScrolling property to the carousel.
This commit is contained in:
parent
5f66cb80d8
commit
fbd804460c
|
@ -169,6 +169,7 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
|
||||||
{"reflectionsOpacity", FLOAT},
|
{"reflectionsOpacity", FLOAT},
|
||||||
{"reflectionsFalloff", FLOAT},
|
{"reflectionsFalloff", FLOAT},
|
||||||
{"unfocusedItemOpacity", FLOAT},
|
{"unfocusedItemOpacity", FLOAT},
|
||||||
|
{"fastScrolling", BOOLEAN},
|
||||||
{"defaultLogo", PATH}, // For backward compatibility with legacy themes.
|
{"defaultLogo", PATH}, // For backward compatibility with legacy themes.
|
||||||
{"logoSize", NORMALIZED_PAIR}, // For backward compatibility with legacy themes.
|
{"logoSize", NORMALIZED_PAIR}, // For backward compatibility with legacy themes.
|
||||||
{"logoScale", FLOAT}, // For backward compatibility with legacy themes.
|
{"logoScale", FLOAT}, // For backward compatibility with legacy themes.
|
||||||
|
|
|
@ -25,39 +25,6 @@ enum class ListLoopType {
|
||||||
LIST_NEVER_LOOP
|
LIST_NEVER_LOOP
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ScrollTier {
|
|
||||||
int length; // How long we stay on this tier before going to the next.
|
|
||||||
int scrollDelay; // How long between scrolls.
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ScrollTierList {
|
|
||||||
const int count;
|
|
||||||
const ScrollTier* tiers;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Default scroll tiers.
|
|
||||||
// clang-format off
|
|
||||||
const ScrollTier QUICK_SCROLL_TIERS[] = {
|
|
||||||
{500, 500},
|
|
||||||
{1200, 114},
|
|
||||||
{0, 16}
|
|
||||||
};
|
|
||||||
const ScrollTierList LIST_SCROLL_STYLE_QUICK = {
|
|
||||||
3,
|
|
||||||
QUICK_SCROLL_TIERS
|
|
||||||
};
|
|
||||||
|
|
||||||
const ScrollTier SLOW_SCROLL_TIERS[] = {
|
|
||||||
{500, 500},
|
|
||||||
{0, 200}
|
|
||||||
};
|
|
||||||
|
|
||||||
const ScrollTierList LIST_SCROLL_STYLE_SLOW = {
|
|
||||||
2,
|
|
||||||
SLOW_SCROLL_TIERS
|
|
||||||
};
|
|
||||||
// clang-format on
|
|
||||||
|
|
||||||
template <typename EntryData, typename UserData> class IList : public virtual GuiComponent
|
template <typename EntryData, typename UserData> class IList : public virtual GuiComponent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -68,9 +35,54 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
struct ScrollTier {
|
||||||
|
int length; // How long we stay on this tier before going to the next.
|
||||||
|
int scrollDelay; // How long between scrolls.
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ScrollTierList {
|
||||||
|
int count;
|
||||||
|
const ScrollTier* tiers;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Default scroll tiers.
|
||||||
|
// clang-format off
|
||||||
|
static inline const ScrollTier QUICK_SCROLL_TIERS[3] {
|
||||||
|
{500, 500},
|
||||||
|
{1200, 114},
|
||||||
|
{0, 16}
|
||||||
|
};
|
||||||
|
|
||||||
|
static inline const ScrollTierList LIST_SCROLL_STYLE_QUICK {
|
||||||
|
3,
|
||||||
|
QUICK_SCROLL_TIERS
|
||||||
|
};
|
||||||
|
|
||||||
|
static inline const ScrollTier MEDIUM_SCROLL_TIERS[3] {
|
||||||
|
{500, 500},
|
||||||
|
{1100, 180},
|
||||||
|
{0, 80}
|
||||||
|
};
|
||||||
|
|
||||||
|
static inline const ScrollTierList LIST_SCROLL_STYLE_MEDIUM {
|
||||||
|
3,
|
||||||
|
MEDIUM_SCROLL_TIERS
|
||||||
|
};
|
||||||
|
|
||||||
|
static inline const ScrollTier SLOW_SCROLL_TIERS[2] {
|
||||||
|
{500, 500},
|
||||||
|
{0, 200}
|
||||||
|
};
|
||||||
|
|
||||||
|
static inline const ScrollTierList LIST_SCROLL_STYLE_SLOW {
|
||||||
|
2,
|
||||||
|
SLOW_SCROLL_TIERS
|
||||||
|
};
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
Window* mWindow;
|
Window* mWindow;
|
||||||
std::vector<Entry> mEntries;
|
std::vector<Entry> mEntries;
|
||||||
const ScrollTierList& mTierList;
|
ScrollTierList mTierList;
|
||||||
const ListLoopType mLoopType;
|
const ListLoopType mLoopType;
|
||||||
int mCursor;
|
int mCursor;
|
||||||
int mLastCursor;
|
int mLastCursor;
|
||||||
|
|
|
@ -199,7 +199,7 @@ private:
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
CarouselComponent<T>::CarouselComponent()
|
CarouselComponent<T>::CarouselComponent()
|
||||||
: IList<CarouselEntry, T> {LIST_SCROLL_STYLE_SLOW,
|
: IList<CarouselEntry, T> {IList<CarouselEntry, T>::LIST_SCROLL_STYLE_SLOW,
|
||||||
(std::is_same_v<T, SystemData*> ?
|
(std::is_same_v<T, SystemData*> ?
|
||||||
ListLoopType::LIST_ALWAYS_LOOP :
|
ListLoopType::LIST_ALWAYS_LOOP :
|
||||||
ListLoopType::LIST_PAUSE_AT_END_ON_JUMP)}
|
ListLoopType::LIST_PAUSE_AT_END_ON_JUMP)}
|
||||||
|
@ -1614,6 +1614,9 @@ void CarouselComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
||||||
if (elem->has("unfocusedItemOpacity"))
|
if (elem->has("unfocusedItemOpacity"))
|
||||||
mUnfocusedItemOpacity =
|
mUnfocusedItemOpacity =
|
||||||
glm::clamp(elem->get<float>("unfocusedItemOpacity"), 0.1f, 1.0f);
|
glm::clamp(elem->get<float>("unfocusedItemOpacity"), 0.1f, 1.0f);
|
||||||
|
|
||||||
|
if (elem->has("fastScrolling") && elem->get<bool>("fastScrolling"))
|
||||||
|
List::mTierList = IList<CarouselEntry, T>::LIST_SCROLL_STYLE_MEDIUM;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Legacy themes.
|
// Legacy themes.
|
||||||
|
|
|
@ -198,7 +198,8 @@ private:
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GridComponent<T>::GridComponent()
|
GridComponent<T>::GridComponent()
|
||||||
: IList<GridEntry, T> {LIST_SCROLL_STYLE_SLOW, ListLoopType::LIST_PAUSE_AT_END}
|
: IList<GridEntry, T> {IList<GridEntry, T>::LIST_SCROLL_STYLE_SLOW,
|
||||||
|
ListLoopType::LIST_PAUSE_AT_END}
|
||||||
, mRenderer {Renderer::getInstance()}
|
, mRenderer {Renderer::getInstance()}
|
||||||
, mEntryOffset {0.0f}
|
, mEntryOffset {0.0f}
|
||||||
, mScrollPos {0.0f}
|
, mScrollPos {0.0f}
|
||||||
|
|
|
@ -159,8 +159,9 @@ private:
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
TextListComponent<T>::TextListComponent()
|
TextListComponent<T>::TextListComponent()
|
||||||
: IList<TextListData, T> {(std::is_same_v<T, SystemData*> ? LIST_SCROLL_STYLE_SLOW :
|
: IList<TextListData, T> {(std::is_same_v<T, SystemData*> ?
|
||||||
LIST_SCROLL_STYLE_QUICK),
|
IList<TextListData, T>::LIST_SCROLL_STYLE_SLOW :
|
||||||
|
IList<TextListData, T>::LIST_SCROLL_STYLE_QUICK),
|
||||||
ListLoopType::LIST_PAUSE_AT_END}
|
ListLoopType::LIST_PAUSE_AT_END}
|
||||||
, mRenderer {Renderer::getInstance()}
|
, mRenderer {Renderer::getInstance()}
|
||||||
, mCamOffset {0.0f}
|
, mCamOffset {0.0f}
|
||||||
|
|
Loading…
Reference in a new issue