summaryrefslogtreecommitdiff
path: root/src/input
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-06-22 20:58:13 +0300
committerAndrei Karas <akaras@inbox.ru>2014-06-22 20:58:13 +0300
commit8ad99cc3f4dd98f0b73a2ece9323f01099a81e80 (patch)
tree33115940e6efabec34efb71e0be6b6d7dfd7e4df /src/input
parent04f47f060f94ec0e2dfc3cccf62cff167e0ecd68 (diff)
downloadmv-8ad99cc3f4dd98f0b73a2ece9323f01099a81e80.tar.gz
mv-8ad99cc3f4dd98f0b73a2ece9323f01099a81e80.tar.bz2
mv-8ad99cc3f4dd98f0b73a2ece9323f01099a81e80.tar.xz
mv-8ad99cc3f4dd98f0b73a2ece9323f01099a81e80.zip
Add profiler lines into some functions.
Diffstat (limited to 'src/input')
-rw-r--r--src/input/inputmanager.cpp18
-rw-r--r--src/input/joystick.cpp8
-rw-r--r--src/input/keyboardconfig.cpp2
3 files changed, 28 insertions, 0 deletions
diff --git a/src/input/inputmanager.cpp b/src/input/inputmanager.cpp
index 813880209..75656114f 100644
--- a/src/input/inputmanager.cpp
+++ b/src/input/inputmanager.cpp
@@ -505,6 +505,7 @@ bool InputManager::handleAssignKey(const SDL_Event &event, const int type)
bool InputManager::handleEvent(const SDL_Event &event)
{
+ BLOCK_START("InputManager::handleEvent")
switch (event.type)
{
case SDL_KEYDOWN:
@@ -512,7 +513,10 @@ bool InputManager::handleEvent(const SDL_Event &event)
keyboard.refreshActiveKeys();
updateConditionMask();
if (handleAssignKey(event, InputType::KEYBOARD))
+ {
+ BLOCK_END("InputManager::handleEvent")
return true;
+ }
keyboard.handleActicateKey(event);
// send straight to gui for certain windows
@@ -523,6 +527,7 @@ bool InputManager::handleEvent(const SDL_Event &event)
guiInput->pushInput(event);
if (gui)
gui->handleInput();
+ BLOCK_END("InputManager::handleEvent")
return true;
}
break;
@@ -539,7 +544,10 @@ bool InputManager::handleEvent(const SDL_Event &event)
updateConditionMask();
// joystick.handleActicateButton(event);
if (handleAssignKey(event, InputType::JOYSTICK))
+ {
+ BLOCK_END("InputManager::handleEvent")
return true;
+ }
break;
}
case SDL_JOYBUTTONUP:
@@ -573,21 +581,30 @@ bool InputManager::handleEvent(const SDL_Event &event)
{
const bool res = gui->handleInput();
if (res && event.type == SDL_KEYDOWN)
+ {
+ BLOCK_END("InputManager::handleEvent")
return true;
+ }
}
switch (event.type)
{
case SDL_KEYDOWN:
if (triggerAction(keyboard.getActionVector(event)))
+ {
+ BLOCK_END("InputManager::handleEvent")
return true;
+ }
break;
case SDL_JOYBUTTONDOWN:
if (joystick && joystick->validate())
{
if (triggerAction(joystick->getActionVector(event)))
+ {
return true;
+ BLOCK_END("InputManager::handleEvent")
+ }
}
break;
#ifdef ANDROID
@@ -602,6 +619,7 @@ bool InputManager::handleEvent(const SDL_Event &event)
break;
}
+ BLOCK_END("InputManager::handleEvent")
return false;
}
diff --git a/src/input/joystick.cpp b/src/input/joystick.cpp
index 1357bc608..b7d34e6ec 100644
--- a/src/input/joystick.cpp
+++ b/src/input/joystick.cpp
@@ -159,15 +159,20 @@ void Joystick::setNumber(const int n)
void Joystick::logic()
{
+ BLOCK_START("Joystick::logic")
// When calibrating, don't bother the outside with our state
if (mCalibrating)
{
doCalibration();
+ BLOCK_END("Joystick::logic")
return;
};
if (!mEnabled || !mCalibrated)
+ {
+ BLOCK_END("Joystick::logic")
return;
+ }
mDirection = 0;
@@ -228,6 +233,7 @@ void Joystick::logic()
for (int i = 0; i < mButtonsNumber; i++)
mActiveButtons[i] = false;
}
+ BLOCK_END("Joystick::logic")
}
void Joystick::startCalibration()
@@ -345,6 +351,7 @@ bool Joystick::validate() const
void Joystick::handleRepeat(const int time)
{
+ BLOCK_START("Joystick::handleRepeat")
FOR_EACH (KeyTimeMapIter, it, mKeyTimeMap)
{
bool repeat(false);
@@ -365,6 +372,7 @@ void Joystick::handleRepeat(const int time)
}
}
}
+ BLOCK_END("Joystick::handleRepeat")
}
void Joystick::resetRepeat(const int key)
diff --git a/src/input/keyboardconfig.cpp b/src/input/keyboardconfig.cpp
index 49bcb831f..7642e260c 100644
--- a/src/input/keyboardconfig.cpp
+++ b/src/input/keyboardconfig.cpp
@@ -250,6 +250,7 @@ void KeyboardConfig::handleDeActicateKey(const int key)
void KeyboardConfig::handleRepeat(const int time)
{
+ BLOCK_START("KeyboardConfig::handleRepeat")
FOR_EACH (KeyTimeMapIter, it, mKeyTimeMap)
{
bool repeat(false);
@@ -275,6 +276,7 @@ void KeyboardConfig::handleRepeat(const int time)
}
}
}
+ BLOCK_END("KeyboardConfig::handleRepeat")
}
void KeyboardConfig::resetRepeat(const int key)