-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Have a setting so the right mouse button can open the action menu #63
Have a setting so the right mouse button can open the action menu #63
Conversation
a34d779
to
e68b123
Compare
device/globals/global_vm.gd
Outdated
@@ -101,7 +101,7 @@ func drag_end(): | |||
printt("********** dragging ends") | |||
if hover_object != null && !hover_object.inventory: | |||
printt("calling clicked") | |||
get_tree().call_group_flags(SceneTree.GROUP_CALL_DEFAULT, "game", "clicked", hover_object, hover_object.get_position()) | |||
get_tree().call_group_flags(SceneTree.GROUP_CALL_DEFAULT, "game", "clicked", hover_object, hover_object.get_position(), null) # null for the `input_event` argument |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make clicked()
default to null
instead if the argument isn't present.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the input_event
argument that is.
e68b123
to
3112551
Compare
device/globals/background.gd
Outdated
@@ -5,7 +5,7 @@ export var action = "walk" | |||
func input(event): | |||
if event is InputEventMouseButton && event.pressed: | |||
if (event.button_index == 1): | |||
get_tree().call_group_flags(SceneTree.GROUP_CALL_DEFAULT, "game", "clicked", self, get_position() + Vector2(event.position.x, event.position.y)) | |||
get_tree().call_group_flags(SceneTree.GROUP_CALL_DEFAULT, "game", "clicked", self, get_position() + Vector2(event.position.x, event.position.y), event) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vector2(event.position.x, event.position.y)
is better written as event.position
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should also pass the event object from the equivalent function call in background_area.gd:
https://github.com/godotengine/escoria/blob/master/device/globals/background_area.gd#L10
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my defense I offer the court that the original Vector2
code wasn't mine, though I plead guilty of not having fixed it ;)
Of course it should be clearer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe you. 🙂 This script has remained unchanged since Escoria was open sourced in August 2016, so my guess is, at some point the x and y coordinates were separate properties of the event object, making it necessary to wrap them in a Vector2D
type.
device/globals/game.gd
Outdated
@@ -108,7 +108,19 @@ func clicked(obj, pos): | |||
get_tree().call_group_flags(SceneTree.GROUP_CALL_DEFAULT, "hud", "set_tooltip", "") | |||
|
|||
elif obj.use_action_menu && action_menu != null: | |||
spawn_action_menu(obj) | |||
if ProjectSettings.get_setting("escoria/ui/right_mouse_button_action_menu"): | |||
if input_event.button_index == 2: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to use BUTTON_RIGHT
than 2
for clarity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There were other instances of referring to the buttons by numbers; I'll take a moment to see if I can hunt them down.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, that would be awesome. 😄 Not strictly related to this branch of course, but I appreciate the extra effort.
3112551
to
ac8764e
Compare
I believe I addressed the issues now |
Remember to check that this doesn't cause any regressions with no action menu and the verb menu enabled instead. |
ac8764e
to
cc22835
Compare
This PR has a conflict in a comment now. |
Last time I use GitHub to fix a conflict, the tree became a mess :/ the problem is fixed and hopefull Git will figure out the history so it doesn't suck too hard. Meaning I hope I don't need to put effort into cleaning up GH's mess and that this can be merged ;) |
97641ef
to
3cab1c8
Compare
Works well in my testing, and some of this code is needed for a two-click-interface as well. Thanks for the contribution, @mjtorn. 🙂 |
This makes for a more latter-day SCUMM experience.