Sdk/Application: Give/clear console focus when enabling/disabling it

This commit is contained in:
Jérôme Leclercq 2018-04-12 13:42:54 +02:00
parent 26f0a9fec9
commit 42b4759680
1 changed files with 13 additions and 1 deletions

View File

@ -209,7 +209,19 @@ namespace Ndk
overlay->keyPressedSlot.Connect(eventHandler.OnKeyPressed, [&consoleRef] (const Nz::EventHandler*, const Nz::WindowEvent::KeyEvent& event) overlay->keyPressedSlot.Connect(eventHandler.OnKeyPressed, [&consoleRef] (const Nz::EventHandler*, const Nz::WindowEvent::KeyEvent& event)
{ {
if (event.code == Nz::Keyboard::F9) if (event.code == Nz::Keyboard::F9)
consoleRef.Show(!consoleRef.IsVisible()); {
// Toggle console visibility and focus
if (consoleRef.IsVisible())
{
consoleRef.ClearFocus();
consoleRef.Show(false);
}
else
{
consoleRef.Show(true);
consoleRef.SetFocus();
}
}
}); });
overlay->resizedSlot.Connect(info.renderTarget->OnRenderTargetSizeChange, [&consoleRef] (const Nz::RenderTarget* renderTarget) overlay->resizedSlot.Connect(info.renderTarget->OnRenderTargetSizeChange, [&consoleRef] (const Nz::RenderTarget* renderTarget)