1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-09-15 06:52:34 +02:00

Add wrap-around key movement to menu system

This commit is contained in:
Daniel Evans 2016-06-21 19:40:00 +01:00
parent cb49e59c86
commit 8798b99394

View File

@ -147,7 +147,13 @@ public:
void move(int movement)
{
activeEntry = std::min<const int>(entries.size()-1, std::max<const int>(0, activeEntry + movement));
activeEntry += movement;
if (activeEntry >= int(entries.size())) {
activeEntry = 0;
}
else if (activeEntry < 0) {
activeEntry = entries.size() - 1;
}
}
};