Hardware cursor implementation for Godot Engine 2.1

- Remove all references to the variable 'custom_mouse_cursor_hotspot' and 'custom_mouse_cursor' from the project settings.
- Indeed, to implement a custom cursor we need to define a sprite for each 'state' of the cursor. Using those variables in the projects settings would define only the _main_ cursor.
- Cleanup the VirtualServer (Remove references to cursor_set_visible, cursor_set_texture and cursor_set_pos)
- Cleanup the Input (set_mouse_in_window should not be used anymore)
- Update the documentation
- Implement it for windows, X11, Javascript, BB 10, OSx, iOS, server, android
- NOT IMPLEMENTED FOR WINRT (As of today, I'm not able to implement this one, this post might help)
- NOT IMPLEMENTED FOR HAIKU (Support of this platform seems perfunctory)
- Build it for Windows, Android and OSX
This commit is contained in:
Xavier Sellier
2017-12-01 00:32:43 -05:00
parent db262f80be
commit 377fdc1e33
36 changed files with 335 additions and 264 deletions

View File

@@ -81,13 +81,32 @@ void Input::_bind_methods() {
ObjectTypeDB::bind_method(_MD("warp_mouse_pos", "to"), &Input::warp_mouse_pos);
ObjectTypeDB::bind_method(_MD("action_press", "action"), &Input::action_press);
ObjectTypeDB::bind_method(_MD("action_release", "action"), &Input::action_release);
ObjectTypeDB::bind_method(_MD("set_custom_mouse_cursor", "image:Texture", "hotspot"), &Input::set_custom_mouse_cursor, DEFVAL(Vector2()));
ObjectTypeDB::bind_method(_MD("set_custom_mouse_cursor", "image:Texture", "shape", "hotspot"), &Input::set_custom_mouse_cursor, DEFVAL(CURSOR_ARROW), DEFVAL(Vector2()));
ObjectTypeDB::bind_method(_MD("parse_input_event", "event"), &Input::parse_input_event);
BIND_CONSTANT(MOUSE_MODE_VISIBLE);
BIND_CONSTANT(MOUSE_MODE_HIDDEN);
BIND_CONSTANT(MOUSE_MODE_CAPTURED);
// Those constants are used to change the mouse texture for given cursor shapes
BIND_CONSTANT(CURSOR_ARROW);
BIND_CONSTANT(CURSOR_IBEAM);
BIND_CONSTANT(CURSOR_POINTING_HAND);
BIND_CONSTANT(CURSOR_CROSS);
BIND_CONSTANT(CURSOR_WAIT);
BIND_CONSTANT(CURSOR_BUSY);
BIND_CONSTANT(CURSOR_DRAG);
BIND_CONSTANT(CURSOR_CAN_DROP);
BIND_CONSTANT(CURSOR_FORBIDDEN);
BIND_CONSTANT(CURSOR_VSIZE);
BIND_CONSTANT(CURSOR_HSIZE);
BIND_CONSTANT(CURSOR_BDIAGSIZE);
BIND_CONSTANT(CURSOR_FDIAGSIZE);
BIND_CONSTANT(CURSOR_MOVE);
BIND_CONSTANT(CURSOR_VSPLIT);
BIND_CONSTANT(CURSOR_HSPLIT);
BIND_CONSTANT(CURSOR_HELP);
ADD_SIGNAL(MethodInfo("joy_connection_changed", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::BOOL, "connected")));
}