mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 14:30:35 +02:00
Added a const variable for readability
This commit is contained in:
parent
7cbb19551a
commit
9f66eeb37f
1 changed files with 6 additions and 2 deletions
|
@ -25,6 +25,8 @@ const float FADE_SPEED = 0.08f;
|
||||||
// Used to animate the magnification windows
|
// Used to animate the magnification windows
|
||||||
const float MAG_SPEED = 0.08f;
|
const float MAG_SPEED = 0.08f;
|
||||||
|
|
||||||
|
const quint64 MSECS_TO_USECS = 1000ULL;
|
||||||
|
|
||||||
// Fast helper functions
|
// Fast helper functions
|
||||||
inline float max(float a, float b) {
|
inline float max(float a, float b) {
|
||||||
return (a > b) ? a : b;
|
return (a > b) ? a : b;
|
||||||
|
@ -334,7 +336,7 @@ void ApplicationOverlay::renderControllerPointers() {
|
||||||
MyAvatar* myAvatar = application->getAvatar();
|
MyAvatar* myAvatar = application->getAvatar();
|
||||||
|
|
||||||
//Static variables used for storing controller state
|
//Static variables used for storing controller state
|
||||||
static quint64 pressedTime[3] = { 0, 0, 0 };
|
static quint64 pressedTime[3] = { 0ULL, 0ULL, 0ULL };
|
||||||
static bool isPressed[3] = { false, false, false };
|
static bool isPressed[3] = { false, false, false };
|
||||||
static bool stateWhenPressed[3] = { false, false, false };
|
static bool stateWhenPressed[3] = { false, false, false };
|
||||||
static bool triggerPressed[3] = { false, false, false };
|
static bool triggerPressed[3] = { false, false, false };
|
||||||
|
@ -372,7 +374,9 @@ void ApplicationOverlay::renderControllerPointers() {
|
||||||
isPressed[index] = false;
|
isPressed[index] = false;
|
||||||
//If the button was only pressed for < 250 ms
|
//If the button was only pressed for < 250 ms
|
||||||
//then disable it.
|
//then disable it.
|
||||||
if (usecTimestampNow() - pressedTime[index] < 250000) {
|
|
||||||
|
const int MAX_BUTTON_PRESS_TIME = 250 * MSECS_TO_USECS;
|
||||||
|
if (usecTimestampNow() - pressedTime[index] < MAX_BUTTON_PRESS_TIME) {
|
||||||
_magActive[index] = !stateWhenPressed[index];
|
_magActive[index] = !stateWhenPressed[index];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue