diff options
Diffstat (limited to 'main')
-rw-r--r-- | main/input_default.cpp | 23 | ||||
-rw-r--r-- | main/input_default.h | 4 | ||||
-rw-r--r-- | main/tests/test_gdscript.cpp | 24 |
3 files changed, 28 insertions, 23 deletions
diff --git a/main/input_default.cpp b/main/input_default.cpp index e9f1eeff6a..6c3252ad1a 100644 --- a/main/input_default.cpp +++ b/main/input_default.cpp @@ -623,7 +623,8 @@ bool InputDefault::is_emulating_mouse_from_touch() const { return emulate_mouse_from_touch; } -Input::CursorShape InputDefault::get_default_cursor_shape() { +Input::CursorShape InputDefault::get_default_cursor_shape() const { + return default_shape; } @@ -638,6 +639,11 @@ void InputDefault::set_default_cursor_shape(CursorShape p_shape) { parse_input_event(mm); } +Input::CursorShape InputDefault::get_current_cursor_shape() const { + + return (Input::CursorShape)OS::get_singleton()->get_cursor_shape(); +} + void InputDefault::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) { if (Engine::get_singleton()->is_editor_hint()) return; @@ -645,21 +651,6 @@ void InputDefault::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_sh OS::get_singleton()->set_custom_mouse_cursor(p_cursor, (OS::CursorShape)p_shape, p_hotspot); } -void InputDefault::set_mouse_in_window(bool p_in_window) { - /* no longer supported, leaving this for reference to anyone who might want to implement hardware cursors - if (custom_cursor.is_valid()) { - - if (p_in_window) { - set_mouse_mode(MOUSE_MODE_HIDDEN); - VisualServer::get_singleton()->cursor_set_visible(true); - } else { - set_mouse_mode(MOUSE_MODE_VISIBLE); - VisualServer::get_singleton()->cursor_set_visible(false); - } - } - */ -} - void InputDefault::accumulate_input_event(const Ref<InputEvent> &p_event) { ERR_FAIL_COND(p_event.is_null()); diff --git a/main/input_default.h b/main/input_default.h index 79a90cc4a4..f9b4cbbd57 100644 --- a/main/input_default.h +++ b/main/input_default.h @@ -242,10 +242,10 @@ public: void set_emulate_mouse_from_touch(bool p_emulate); virtual bool is_emulating_mouse_from_touch() const; - virtual CursorShape get_default_cursor_shape(); + virtual CursorShape get_default_cursor_shape() const; virtual void set_default_cursor_shape(CursorShape p_shape); + virtual CursorShape get_current_cursor_shape() const; virtual void set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape = Input::CURSOR_ARROW, const Vector2 &p_hotspot = Vector2()); - virtual void set_mouse_in_window(bool p_in_window); void parse_mapping(String p_mapping); void joy_button(int p_device, int p_button, bool p_pressed); diff --git a/main/tests/test_gdscript.cpp b/main/tests/test_gdscript.cpp index 8c60b79200..87bd640001 100644 --- a/main/tests/test_gdscript.cpp +++ b/main/tests/test_gdscript.cpp @@ -289,6 +289,11 @@ static String _parser_expr(const GDScriptParser::Node *p_expr) { } } break; + case GDScriptParser::Node::TYPE_CAST: { + const GDScriptParser::CastNode *cast_node = static_cast<const GDScriptParser::CastNode *>(p_expr); + txt = _parser_expr(cast_node->source_node) + " as " + cast_node->cast_type.to_string(); + + } break; case GDScriptParser::Node::TYPE_NEWLINE: { //skippie @@ -669,6 +674,17 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String incr += 2; } break; + case GDScriptFunction::OPCODE_CAST_TO_SCRIPT: { + + txt += " cast "; + txt += DADDR(3); + txt += "="; + txt += DADDR(1); + txt += " as "; + txt += DADDR(2); + incr += 4; + + } break; case GDScriptFunction::OPCODE_CONSTRUCT: { Variant::Type t = Variant::Type(code[ip + 1]); @@ -1018,19 +1034,17 @@ MainLoop *test(TestType p_type) { return NULL; } - GDScript *script = memnew(GDScript); + Ref<GDScript> gds; + gds.instance(); GDScriptCompiler gdc; - err = gdc.compile(&parser, script); + err = gdc.compile(&parser, gds.ptr()); if (err) { print_line("Compile Error:\n" + itos(gdc.get_error_line()) + ":" + itos(gdc.get_error_column()) + ":" + gdc.get_error()); - memdelete(script); return NULL; } - Ref<GDScript> gds = Ref<GDScript>(script); - Ref<GDScript> current = gds; while (current.is_valid()) { |