This commit is contained in:
Branimir Karadžić 2015-05-30 22:11:42 -07:00
parent 38a7bc6d28
commit 44bf196b07
2 changed files with 29 additions and 19 deletions

View File

@ -210,11 +210,6 @@ BX_PRAGMA_DIAGNOSTIC_POP();
return false;
}
void cmd(const void* _userData)
{
cmdExec( (const char*)_userData);
}
int cmdMouseLock(CmdContext* /*_context*/, void* /*_userData*/, int _argc, char const* const* _argv)
{
if (_argc > 1)
@ -281,18 +276,18 @@ BX_PRAGMA_DIAGNOSTIC_POP();
static const InputBinding s_bindings[] =
{
{ entry::Key::KeyQ, entry::Modifier::LeftCtrl, 1, cmd, "exit" },
{ entry::Key::F1, entry::Modifier::None, 1, cmd, "graphics stats" },
{ entry::Key::GamepadStart, entry::Modifier::None, 1, cmd, "graphics stats" },
{ entry::Key::F1, entry::Modifier::LeftShift, 1, cmd, "graphics stats 0\ngraphics text 0" },
{ entry::Key::F3, entry::Modifier::None, 1, cmd, "graphics wireframe" },
{ entry::Key::F4, entry::Modifier::None, 1, cmd, "graphics hmd" },
{ entry::Key::F4, entry::Modifier::LeftShift, 1, cmd, "graphics hmdrecenter" },
{ entry::Key::F4, entry::Modifier::LeftCtrl, 1, cmd, "graphics hmddbg" },
{ entry::Key::F7, entry::Modifier::None, 1, cmd, "graphics vsync" },
{ entry::Key::F8, entry::Modifier::None, 1, cmd, "graphics msaa" },
{ entry::Key::F9, entry::Modifier::None, 1, cmd, "graphics flush" },
{ entry::Key::Print, entry::Modifier::None, 1, cmd, "graphics screenshot" },
{ entry::Key::KeyQ, entry::Modifier::LeftCtrl, 1, NULL, "exit" },
{ entry::Key::F1, entry::Modifier::None, 1, NULL, "graphics stats" },
{ entry::Key::GamepadStart, entry::Modifier::None, 1, NULL, "graphics stats" },
{ entry::Key::F1, entry::Modifier::LeftShift, 1, NULL, "graphics stats 0\ngraphics text 0" },
{ entry::Key::F3, entry::Modifier::None, 1, NULL, "graphics wireframe" },
{ entry::Key::F4, entry::Modifier::None, 1, NULL, "graphics hmd" },
{ entry::Key::F4, entry::Modifier::LeftShift, 1, NULL, "graphics hmdrecenter" },
{ entry::Key::F4, entry::Modifier::LeftCtrl, 1, NULL, "graphics hmddbg" },
{ entry::Key::F7, entry::Modifier::None, 1, NULL, "graphics vsync" },
{ entry::Key::F8, entry::Modifier::None, 1, NULL, "graphics msaa" },
{ entry::Key::F9, entry::Modifier::None, 1, NULL, "graphics flush" },
{ entry::Key::Print, entry::Modifier::None, 1, NULL, "graphics screenshot" },
INPUT_BINDING_END
};

View File

@ -7,6 +7,7 @@
#include "entry_p.h"
#include "input.h"
#include "cmd.h"
#include <bx/allocator.h>
#include <bx/ringbuffer.h>
@ -205,7 +206,14 @@ struct Input
if (modifiers == binding->m_modifiers
&& !m_keyboard.m_once[binding->m_key])
{
binding->m_fn(binding->m_userData);
if (NULL == binding->m_fn)
{
cmdExec( (const char*)binding->m_userData);
}
else
{
binding->m_fn(binding->m_userData);
}
m_keyboard.m_once[binding->m_key] = true;
}
}
@ -219,7 +227,14 @@ struct Input
if (down
&& modifiers == binding->m_modifiers)
{
binding->m_fn(binding->m_userData);
if (NULL == binding->m_fn)
{
cmdExec( (const char*)binding->m_userData);
}
else
{
binding->m_fn(binding->m_userData);
}
}
}
}