diff options
author | Stijn Buys <ingar@osirion.org> | 2016-07-31 14:14:25 +0200 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2016-07-31 14:14:25 +0200 |
commit | 6817dec0b405b325a2762e352ad2a5916c24542a (patch) | |
tree | a61a1b756c4ffa18c2a8c9ce874a9ae4cdf591e0 /src/client/input.cc | |
parent | b9205ba21a5663d1aa57b1b1213bea5ecbf1c073 (diff) |
Added reset_controls function to revert to the default keyboard configuration,
don't override unbound keys with default binds.
Diffstat (limited to 'src/client/input.cc')
-rw-r--r-- | src/client/input.cc | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/client/input.cc b/src/client/input.cc index 7edc1c2..8b40216 100644 --- a/src/client/input.cc +++ b/src/client/input.cc @@ -254,6 +254,15 @@ void func_unbind(std::string const &args) } } +void func_reset_controls(std::string const &args) +{ + if (keyboard) + { + keyboard->unbindall(); + keyboard->load_defaults(); + } +} + //--- input functions --------------------------------------------- void init() @@ -302,8 +311,8 @@ void init() func = core::Func::add("unbind", func_unbind); func->set_info("[key] unbind a key"); - func = core::Func::add("unbindall", func_unbind); - func->set_info("unbind all keys"); + func = core::Func::add("reset_controls", func_reset_controls); + func->set_info("load default controls"); func = core::Func::add("view_next", func_view_next); func->set_info("switch to next view"); @@ -329,7 +338,8 @@ void shutdown() core::Func::remove("bind"); core::Func::remove("unbind"); - core::Func::remove("unbindall"); + + core::Func::remove("reset_controls"); core::Func::remove("screenshot"); |