mirror of
https://github.com/godotengine/godot.git
synced 2024-11-22 04:06:14 +00:00
Make Input Actions config not affect the editor
This commit is contained in:
parent
cee94b6119
commit
64fd75d91a
@ -28,6 +28,7 @@
|
||||
/*************************************************************************/
|
||||
#include "input_map.h"
|
||||
#include "globals.h"
|
||||
#include "os/keyboard.h"
|
||||
|
||||
InputMap *InputMap::singleton=NULL;
|
||||
|
||||
@ -319,6 +320,67 @@ void InputMap::load_from_globals() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void InputMap::load_default() {
|
||||
|
||||
InputEvent key;
|
||||
key.type=InputEvent::KEY;
|
||||
|
||||
add_action("input/ui_accept");
|
||||
key.key.scancode=KEY_RETURN;
|
||||
action_add_event("input/ui_accept",key);
|
||||
key.key.scancode=KEY_ENTER;
|
||||
action_add_event("input/ui_accept",key);
|
||||
key.key.scancode=KEY_SPACE;
|
||||
action_add_event("input/ui_accept",key);
|
||||
|
||||
add_action("input/ui_select");
|
||||
key.key.scancode=KEY_SPACE;
|
||||
action_add_event("input/ui_select",key);
|
||||
|
||||
add_action("input/ui_cancel");
|
||||
key.key.scancode=KEY_ESCAPE;
|
||||
action_add_event("input/ui_cancel",key);
|
||||
|
||||
add_action("input/ui_focus_next");
|
||||
key.key.scancode=KEY_TAB;
|
||||
action_add_event("input/ui_focus_next",key);
|
||||
|
||||
add_action("input/ui_focus_prev");
|
||||
key.key.scancode=KEY_TAB;
|
||||
key.key.mod.shift=true;
|
||||
action_add_event("input/ui_focus_prev",key);
|
||||
key.key.mod.shift=false;
|
||||
|
||||
add_action("input/ui_left");
|
||||
key.key.scancode=KEY_LEFT;
|
||||
action_add_event("input/ui_left",key);
|
||||
|
||||
add_action("input/ui_right");
|
||||
key.key.scancode=KEY_RIGHT;
|
||||
action_add_event("input/ui_right",key);
|
||||
|
||||
add_action("input/ui_up");
|
||||
key.key.scancode=KEY_UP;
|
||||
action_add_event("input/ui_up",key);
|
||||
|
||||
add_action("input/ui_down");
|
||||
key.key.scancode=KEY_DOWN;
|
||||
action_add_event("input/ui_down",key);
|
||||
|
||||
|
||||
add_action("input/ui_page_up");
|
||||
key.key.scancode=KEY_PAGEUP;
|
||||
action_add_event("input/ui_page_up",key);
|
||||
|
||||
add_action("input/ui_page_down");
|
||||
key.key.scancode=KEY_PAGEDOWN;
|
||||
action_add_event("input/ui_page_down",key);
|
||||
|
||||
// set("display/orientation", "landscape");
|
||||
|
||||
|
||||
}
|
||||
|
||||
InputMap::InputMap() {
|
||||
|
@ -74,6 +74,7 @@ public:
|
||||
|
||||
|
||||
void load_from_globals();
|
||||
void load_default();
|
||||
|
||||
InputMap();
|
||||
};
|
||||
|
@ -688,7 +688,10 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas
|
||||
|
||||
#endif
|
||||
|
||||
input_map->load_from_globals();
|
||||
if (editor)
|
||||
input_map->load_default(); //keys for editor
|
||||
else
|
||||
input_map->load_from_globals(); //keys for game
|
||||
|
||||
if (video_driver=="") // specified in engine.cfg
|
||||
video_driver=_GLOBAL_DEF("display/driver",Variant((const char*)OS::get_singleton()->get_video_driver_name(0)));
|
||||
|
Loading…
Reference in New Issue
Block a user