diff options
author | Juan Linietsky <reduzio@gmail.com> | 2016-06-04 21:31:29 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2016-06-04 21:31:47 -0300 |
commit | 007efb6a20dcaa9230f1cfdc1cda92db24c5510f (patch) | |
tree | db29be67ba32768ba96037d06c82cb8f1ac7f1c2 /core | |
parent | 279b7921e8dc8feb44a7650b983f6b3878a01d14 (diff) |
-customizable shortcuts in editor
-editor settings now save to .tres instead of .xml
-buttons can now hold a shortcut
Diffstat (limited to 'core')
-rw-r--r-- | core/variant_parser.cpp | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/core/variant_parser.cpp b/core/variant_parser.cpp index 8bd1fddfad..e2786b8099 100644 --- a/core/variant_parser.cpp +++ b/core/variant_parser.cpp @@ -2011,7 +2011,44 @@ Error VariantWriter::write(const Variant& p_variant, StoreStringFunc p_store_str } break; case Variant::INPUT_EVENT: { - p_store_string_func(p_store_string_ud,"InputEvent()"); //will be added later + String str="InputEvent("; + + InputEvent ev=p_variant; + switch(ev.type) { + case InputEvent::KEY: { + + str+="KEY,"+itos(ev.key.scancode); + String mod; + if (ev.key.mod.alt) + mod+="A"; + if (ev.key.mod.shift) + mod+="S"; + if (ev.key.mod.control) + mod+="C"; + if (ev.key.mod.meta) + mod+="M"; + + if (mod!=String()) + str+=","+mod; + } break; + case InputEvent::MOUSE_BUTTON: { + + str+="MBUTTON,"+itos(ev.mouse_button.button_index); + } break; + case InputEvent::JOYSTICK_BUTTON: { + str+="JBUTTON,"+itos(ev.joy_button.button_index); + + } break; + case InputEvent::JOYSTICK_MOTION: { + str+="JAXIS,"+itos(ev.joy_motion.axis)+","+itos(ev.joy_motion.axis_value); + } break; + default: {} + } + + str+=")"; + + p_store_string_func(p_store_string_ud,str); //will be added later + } break; case Variant::DICTIONARY: { |