From: Perttu Ahola Date: Sun, 29 May 2011 18:13:29 +0000 (+0300) Subject: invert_mouse config option X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=9f7c21a0b48285fe03bef1060557f6e75976d625;p=zefram%2Fminetest%2Fminetest_engine.git invert_mouse config option --HG-- extra : rebase_source : 2695ad71185244cefbcf6e3e28ba1ab5e54c882f --- diff --git a/doc/changelog.txt b/doc/changelog.txt index cb3594a9..e886370a 100644 --- a/doc/changelog.txt +++ b/doc/changelog.txt @@ -14,6 +14,7 @@ X: - Player passwords - All textures first searched from texture_path - Map directory ("map") has been renamed to "world" (just rename it to load an old world) +- Mouse inversion (invert_mouse) 2011-04-24: - Smooth lighting with simple ambient occlusion diff --git a/minetest.conf.example b/minetest.conf.example index 5e639322..1a1dbe0f 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -42,6 +42,8 @@ #keymap_special1 = KEY_KEY_E #keymap_print_debug_stacks = KEY_KEY_P +#invert_mouse = false + # The desired FPS #wanted_fps = 30 diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 1d758a2a..6fcdc1db 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -65,6 +65,7 @@ void set_default_settings() g_settings.setDefault("free_move", "false"); g_settings.setDefault("continuous_forward", "false"); g_settings.setDefault("fast_move", "false"); + g_settings.setDefault("invert_mouse", "false"); // Server stuff g_settings.setDefault("enable_experimental", "false"); diff --git a/src/game.cpp b/src/game.cpp index cc758be7..6932b45f 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -894,6 +894,8 @@ void the_game( core::list frametime_log; float damage_flash_timer = 0; + + bool invert_mouse = g_settings.getBool("invert_mouse"); /* Main loop @@ -1306,6 +1308,8 @@ void the_game( else{ s32 dx = input->getMousePos().X - displaycenter.X; s32 dy = input->getMousePos().Y - displaycenter.Y; + if(invert_mouse) + dy = -dy; //std::cout<<"window active, pos difference "<