[swell-foop/arnaudb/cursor-fixes: 1/2] Fix keyboard cursor init.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [swell-foop/arnaudb/cursor-fixes: 1/2] Fix keyboard cursor init.
- Date: Wed, 13 May 2020 20:01:48 +0000 (UTC)
commit 04da659e2b51fdfce60d8194b9fb0c28376cea87
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Wed May 13 21:16:18 2020 +0200
Fix keyboard cursor init.
Also, make cursor start at the
bottom-left tile, not at on of
its neighbors. Feeling better.
src/game-view.vala | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
---
diff --git a/src/game-view.vala b/src/game-view.vala
index f9aeeee..0f47413 100644
--- a/src/game-view.vala
+++ b/src/game-view.vala
@@ -19,7 +19,7 @@ using Config;
private class GameView : Clutter.Group
{
- private TileActor highlighted = null;
+ private TileActor? highlighted = null;
private CursorActor cursor;
private bool cursor_active = false;
@@ -66,6 +66,8 @@ private class GameView : Clutter.Group
/* Put tiles in new locations */
tiles = new TileActor [game.columns, game.rows];
+ cursor_x = 0;
+ cursor_y = 0;
place_tiles ();
width = tile_size * game.columns;
@@ -272,11 +274,22 @@ private class GameView : Clutter.Group
/* Move Keyboard cursor */
internal void cursor_move (int x, int y)
{
- cursor_active = true;
+ if (cursor_active)
+ {
+ int old_cursor_x = cursor_x;
+ int old_cursor_y = cursor_y;
+
+ cursor_x += x;
+ cursor_y += y;
+
+ if (cursor_x == old_cursor_x
+ && cursor_y == old_cursor_y)
+ return;
+ }
+ else
+ cursor_active = true;
opacity_for_connected_tiles (highlighted, 180);
- cursor_x += x;
- cursor_y += y;
highlighted = find_tile_at_position (cursor_x, cursor_y);
if (highlighted != null)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]