From 6817dec0b405b325a2762e352ad2a5916c24542a Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 31 Jul 2016 14:14:25 +0200 Subject: Added reset_controls function to revert to the default keyboard configuration, don't override unbound keys with default binds. --- src/client/input.cc | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/client/input.cc') 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"); -- cgit v1.2.3