Disabled InputCommand processing while you fiddle with editor UI elements

This commit is contained in:
2016-03-07 17:53:32 +01:00
parent b000bb2597
commit 8bcb15a128
2 changed files with 10 additions and 6 deletions
+9 -5
View File
@@ -45,7 +45,7 @@ void InputProxy::Update(double dt)
}
}
void InputProxy::Process()
void InputProxy::Process(bool suppressNewEvents /*= false*/)
{
for (auto& pair : m_CommandHandlers) {
const std::string& command = pair.first;
@@ -62,8 +62,10 @@ void InputProxy::Process()
e.PlayerID = -1;
e.Command = command;
e.Value = currentValue;
m_EventBroker->Publish(e);
//LOG_DEBUG("Input: Published command %s=%f for player %i", e.Command.c_str(), e.Value, e.PlayerID);
if (!suppressNewEvents || e.Value == 0) {
m_EventBroker->Publish(e);
LOG_DEBUG("Input: Published command %s=%f for player %i", e.Command.c_str(), e.Value, e.PlayerID);
}
m_LastCommandValues[command] = currentValue;
}
}
@@ -78,8 +80,10 @@ void InputProxy::Process()
e.Value += value;
}
//e.Value = std::max(-1.f, std::min(e.Value, 1.f));
m_EventBroker->Publish(e);
//LOG_DEBUG("Input: Published command %s=%f for player %i", e.Command.c_str(), e.Value, e.PlayerID);
if (!suppressNewEvents || e.Value == 0) {
m_EventBroker->Publish(e);
LOG_DEBUG("Input: Published command %s=%f for player %i", e.Command.c_str(), e.Value, e.PlayerID);
}
}
m_CommandQueue.clear();
}
+1 -1
View File
@@ -218,7 +218,7 @@ void Game::Tick()
PerformanceTimer::StartTimerAndStopPrevious("InputProxy");
m_InputProxy->Update(dt);
m_EventBroker->Swap();
m_InputProxy->Process();
m_InputProxy->Process(ImGui::GetIO().WantCaptureKeyboard || ImGui::GetIO().WantCaptureMouse);
m_EventBroker->Swap();
PerformanceTimer::StartTimerAndStopPrevious("SoundManager");