diff options
author | Juan Linietsky <reduzio@gmail.com> | 2017-05-20 12:38:03 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2017-05-20 17:05:38 -0300 |
commit | 5b3709d3096df737b8bb2344446be818b0389bfe (patch) | |
tree | 649a0989b1494f3c4687d59e503310f4e6bbeb40 /core/io | |
parent | 93f9a83062dbe74474a4a7928758c5cf5588238e (diff) |
Removal of InputEvent as built-in Variant type..
this might cause bugs I haven't found yet..
Diffstat (limited to 'core/io')
-rw-r--r-- | core/io/marshalls.cpp | 137 | ||||
-rw-r--r-- | core/io/resource_format_binary.cpp | 14 |
2 files changed, 0 insertions, 151 deletions
diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp index fd14011a81..dccf70ad7a 100644 --- a/core/io/marshalls.cpp +++ b/core/io/marshalls.cpp @@ -365,66 +365,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int r_variant = (Object *)NULL; } break; - case Variant::INPUT_EVENT: { - - InputEvent ie; - - ie.type = decode_uint32(&buf[0]); - ie.device = decode_uint32(&buf[4]); - - if (r_len) - (*r_len) += 12; - - switch (ie.type) { - - case InputEvent::KEY: { - - uint32_t mods = decode_uint32(&buf[12]); - if (mods & KEY_MASK_SHIFT) - ie.key.mod.shift = true; - if (mods & KEY_MASK_CTRL) - ie.key.mod.control = true; - if (mods & KEY_MASK_ALT) - ie.key.mod.alt = true; - if (mods & KEY_MASK_META) - ie.key.mod.meta = true; - ie.key.scancode = decode_uint32(&buf[16]); - - if (r_len) - (*r_len) += 8; - - } break; - case InputEvent::MOUSE_BUTTON: { - - ie.mouse_button.button_index = decode_uint32(&buf[12]); - if (r_len) - (*r_len) += 4; - - } break; - case InputEvent::JOYPAD_BUTTON: { - - ie.joy_button.button_index = decode_uint32(&buf[12]); - if (r_len) - (*r_len) += 4; - } break; - case InputEvent::SCREEN_TOUCH: { - - ie.screen_touch.index = decode_uint32(&buf[12]); - if (r_len) - (*r_len) += 4; - } break; - case InputEvent::JOYPAD_MOTION: { - - ie.joy_motion.axis = decode_uint32(&buf[12]); - ie.joy_motion.axis_value = decode_float(&buf[16]); - if (r_len) - (*r_len) += 8; - } break; - } - - r_variant = ie; - - } break; case Variant::DICTIONARY: { ERR_FAIL_COND_V(len < 4, ERR_INVALID_DATA); @@ -1055,83 +995,6 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len) { case Variant::OBJECT: { } break; - case Variant::INPUT_EVENT: { - - InputEvent ie = p_variant; - - if (buf) { - - encode_uint32(ie.type, &buf[0]); - encode_uint32(ie.device, &buf[4]); - encode_uint32(0, &buf[8]); - } - - int llen = 12; - - switch (ie.type) { - - case InputEvent::KEY: { - - if (buf) { - - uint32_t mods = 0; - if (ie.key.mod.shift) - mods |= KEY_MASK_SHIFT; - if (ie.key.mod.control) - mods |= KEY_MASK_CTRL; - if (ie.key.mod.alt) - mods |= KEY_MASK_ALT; - if (ie.key.mod.meta) - mods |= KEY_MASK_META; - - encode_uint32(mods, &buf[llen]); - encode_uint32(ie.key.scancode, &buf[llen + 4]); - } - llen += 8; - - } break; - case InputEvent::MOUSE_BUTTON: { - - if (buf) { - - encode_uint32(ie.mouse_button.button_index, &buf[llen]); - } - llen += 4; - } break; - case InputEvent::JOYPAD_BUTTON: { - - if (buf) { - - encode_uint32(ie.joy_button.button_index, &buf[llen]); - } - llen += 4; - } break; - case InputEvent::SCREEN_TOUCH: { - - if (buf) { - - encode_uint32(ie.screen_touch.index, &buf[llen]); - } - llen += 4; - } break; - case InputEvent::JOYPAD_MOTION: { - - if (buf) { - - int axis = ie.joy_motion.axis; - encode_uint32(axis, &buf[llen]); - encode_float(ie.joy_motion.axis_value, &buf[llen + 4]); - } - llen += 8; - } break; - } - - if (buf) - encode_uint32(llen, &buf[8]); - r_len += llen; - - // not supported - } break; case Variant::DICTIONARY: { Dictionary d = p_variant; diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index 4ad3d261b2..26b53c2a31 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -359,13 +359,6 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) { } } break; - case VARIANT_INPUT_EVENT: { - - InputEvent ev; - ev.type = f->get_32(); //will only work for null though. - r_v = ev; - - } break; case VARIANT_DICTIONARY: { uint32_t len = f->get_32(); @@ -1446,13 +1439,6 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant &p_property, } } break; - case Variant::INPUT_EVENT: { - - f->store_32(VARIANT_INPUT_EVENT); - InputEvent event = p_property; - f->store_32(0); //event type none, nothing else suported for now. - - } break; case Variant::DICTIONARY: { f->store_32(VARIANT_DICTIONARY); |