Permalink
Browse files

* Allow disabling all keybinds too.

  • Loading branch information...
1 parent b5644d9 commit e885046b796127caa0ba6a36f4f1277b7a0532e9 @bobbens committed Mar 7, 2011
Showing with 28 additions and 0 deletions.
  1. +11 −0 src/input.c
  2. +1 −0 src/input.h
  3. +16 −0 src/nlua_naev.c
View
@@ -354,6 +354,17 @@ void input_enableAll (void)
/**
+ * @brief Disables all the keybinds.
+ */
+void input_disableAll (void)
+{
+ int i;
+ for (i=0; strcmp(keybind_info[i][0],"end"); i++)
+ input_keybinds[i].disabled = 1;
+}
+
+
+/**
* @brief Enables or disables a keybind.
*/
void input_toggleEnable( const char *key, int enable )
View
@@ -45,6 +45,7 @@ const char *input_keyAlreadyBound( KeybindType type, int key, SDLMod mod );
*/
SDLMod input_translateMod( SDLMod mod );
void input_enableAll (void);
+void input_disableAll (void);
void input_toggleEnable( const char *key, int enable );
/*
View
@@ -26,11 +26,13 @@ static int naev_lang( lua_State *L );
static int naev_keyGet( lua_State *L );
static int naev_keyEnable( lua_State *L );
static int naev_keyEnableAll( lua_State *L );
+static int naev_keyDisableAll( lua_State *L );
static const luaL_reg naev_methods[] = {
{ "lang", naev_lang },
{ "keyGet", naev_keyGet },
{ "keyEnable", naev_keyEnable },
{ "keyEnableAll", naev_keyEnableAll },
+ { "keyDisableAll", naev_keyDisableAll },
{0,0}
}; /**< NAEV Lua methods. */
@@ -175,4 +177,18 @@ static int naev_keyEnableAll( lua_State *L )
}
+/**
+ * @brief Disables all inputs.
+ *
+ * @usage naev.keyDisableAll() -- Disables all inputs
+ * @luafunc keyDisableAll()
+ */
+static int naev_keyDisableAll( lua_State *L )
+{
+ (void) L;
+ input_disableAll();
+ return 0;
+}
+
+

0 comments on commit e885046

Please sign in to comment.