Skip to content

start go-to mode on left button long press, execute go-to on left button release - #1142

Open
mikes-wandering wants to merge 2 commits into
C7-Game:Developmentfrom
mikes-wandering:mouse-goto-action
Open

mikes-wandering wants to merge 2 commits into
C7-Game:Developmentfrom
mikes-wandering:mouse-goto-action

Conversation

@mikes-wandering

Copy link
Copy Markdown

The original Civ3 lets you start go-to mode with a left button long press. It executes the go-to when the left button is released. This request implements this functionality.

DoubleClickHandler.cs has been extended to handle all sequences arising from left click actions, and therefore renamed as LeftClickHandler.cs.

This uses the Godot _Process method to measure elapsed times. This method is called by Godot about 60 times / second and provides a simple mechanism to measure time, accurately enough for mouse actions, without managing Timers.

The logic to determine mouse events is placed in MouseAction.cs, with tests in MouseActionTest.cs. The logic is complex enough that I wanted tests for it. These classes are in C7Engine and EngineTests, because Godot and xUnit don't play nicely without an additional test framework. I put them in new folders called GameAction, because they didn't seem to fit in any existing folders, but I can put them elsewhere if you want.

…ton release

- DoubleClickHandler.cs extended to handle all left click actions, renamed LeftClickHandler.cs
- event logic in MouseAction.cs and tests in MouseActionTest.cs
- event handling in Game.cs
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