Skip to content
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

Merged
merged 1 commit into from
Feb 22, 2018

Conversation

mjtorn
Copy link
Collaborator

@mjtorn mjtorn commented Feb 20, 2018

This makes for a more latter-day SCUMM experience.

@mjtorn mjtorn force-pushed the gh-mjtorn-rmb-action-menu branch 2 times, most recently from a34d779 to e68b123 Compare February 20, 2018 13:16
@@ -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
Copy link
Collaborator

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.

Copy link
Collaborator

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.

@mjtorn mjtorn force-pushed the gh-mjtorn-rmb-action-menu branch from e68b123 to 3112551 Compare February 20, 2018 14:47
@@ -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)
Copy link
Collaborator

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

Copy link
Collaborator

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

Copy link
Collaborator Author

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.

Copy link
Collaborator

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.

@@ -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:
Copy link
Collaborator

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.

Copy link
Collaborator Author

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.

Copy link
Collaborator

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.

@mjtorn mjtorn force-pushed the gh-mjtorn-rmb-action-menu branch from 3112551 to ac8764e Compare February 21, 2018 06:55
@mjtorn
Copy link
Collaborator Author

mjtorn commented Feb 21, 2018

I believe I addressed the issues now

@fleskesvor
Copy link
Collaborator

Remember to check that this doesn't cause any regressions with no action menu and the verb menu enabled instead.

@mjtorn mjtorn force-pushed the gh-mjtorn-rmb-action-menu branch from ac8764e to cc22835 Compare February 21, 2018 07:24
@fleskesvor
Copy link
Collaborator

This PR has a conflict in a comment now.

@mjtorn
Copy link
Collaborator Author

mjtorn commented Feb 21, 2018

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 ;)

@mjtorn mjtorn force-pushed the gh-mjtorn-rmb-action-menu branch from 97641ef to 3cab1c8 Compare February 22, 2018 14:37
@fleskesvor
Copy link
Collaborator

Works well in my testing, and some of this code is needed for a two-click-interface as well. Thanks for the contribution, @mjtorn. 🙂

@fleskesvor fleskesvor merged commit 2bc6f86 into godot-escoria:master Feb 22, 2018
@mjtorn mjtorn deleted the gh-mjtorn-rmb-action-menu branch February 23, 2018 07:39
dploeger added a commit that referenced this pull request Nov 23, 2021
Some further fixes

fixes #71
fixes #63
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants