[lightsoff] Handle touch event for the arrows
- From: Yosef Or Boczko <yoseforb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [lightsoff] Handle touch event for the arrows
- Date: Tue, 13 May 2014 17:12:55 +0000 (UTC)
commit 4d8f4b1aa8a1b17df4e7d624426ced050c834f8d
Author: Yosef Or Boczko <yoseforb src gnome org>
Date: Tue May 13 13:33:03 2014 +0300
Handle touch event for the arrows
https://bugzilla.gnome.org/show_bug.cgi?id=730054
src/game-view.vala | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/src/game-view.vala b/src/game-view.vala
index 6407e8b..c868559 100644
--- a/src/game-view.vala
+++ b/src/game-view.vala
@@ -103,6 +103,7 @@ public class GameView : Clutter.Group
left_arrow.anchor_gravity = Clutter.Gravity.CENTER;
left_arrow.reactive = true;
left_arrow.button_release_event.connect (left_arrow_button_release_cb);
+ left_arrow.touch_event.connect (left_arrow_touch_event_cb);
left_arrow.set_position ((score_view.x - score_view.anchor_x) / 2, score_view.y + (score_view.height
/ 2) - 10);
add_child (left_arrow);
@@ -110,6 +111,7 @@ public class GameView : Clutter.Group
right_arrow.anchor_gravity = Clutter.Gravity.CENTER;
right_arrow.reactive = true;
right_arrow.button_release_event.connect (right_arrow_button_release_cb);
+ right_arrow.touch_event.connect (right_arrow_touch_event_cb);
right_arrow.rotation_angle_y = 180;
right_arrow.set_position (real_board_width - left_arrow.x, score_view.y + (score_view.height / 2) -
10);
add_child (right_arrow);
@@ -178,6 +180,18 @@ public class GameView : Clutter.Group
level_changed (current_level);
}
+ private bool left_arrow_touch_event_cb (Clutter.Actor actor, Clutter.Event event)
+ {
+ swap_board (-1);
+ return false;
+ }
+
+ private bool right_arrow_touch_event_cb (Clutter.Actor actor, Clutter.Event event)
+ {
+ swap_board (1);
+ return false;
+ }
+
private bool left_arrow_button_release_cb (Clutter.Actor actor, Clutter.ButtonEvent event)
{
swap_board (-1);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]