Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1292)

Side by Side Diff: sky/examples/game/lib/game_box.dart

Issue 1180553002: Ink splashes should start at the touch point (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Use more specific types for GameBox and SpriteBox Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 part of game; 1 part of game;
2 2
3 const double _steeringThreshold = 20.0; 3 const double _steeringThreshold = 20.0;
4 const double _steeringMax = 50.0; 4 const double _steeringMax = 50.0;
5 5
6 class GameBox extends SpriteBox { 6 class GameBox extends SpriteBox {
7 7
8 GameBox(GameWorld game) : super(game, SpriteBoxTransformMode.letterbox); 8 GameBox(GameWorld game) : super(game, SpriteBoxTransformMode.letterbox);
9 9
10 GameWorld get _gameWorld => this.rootNode; 10 GameWorld get _gameWorld => this.rootNode;
11 11
12 // Handle pointers 12 // Handle pointers
13 int _firstPointer = -1; 13 int _firstPointer = -1;
14 int _secondPointer = -1; 14 int _secondPointer = -1;
15 Vector2 _firstPointerDownPos; 15 Vector2 _firstPointerDownPos;
16 16
17 void handleEvent(Event event) { 17 void handleEvent(Event event, BoxHitTestData data) {
18 if (event is PointerEvent) { 18 if (event is PointerEvent) {
19 Vector2 pointerPos = new Vector2(event.x, event.y); 19 Vector2 pointerPos = new Vector2(event.x, event.y);
20 int pointer = event.pointer; 20 int pointer = event.pointer;
21 21
22 switch (event.type) { 22 switch (event.type) {
23 case 'pointerdown': 23 case 'pointerdown':
24 if (_firstPointer == -1) { 24 if (_firstPointer == -1) {
25 // Assign the first pointer 25 // Assign the first pointer
26 _firstPointer = pointer; 26 _firstPointer = pointer;
27 _firstPointerDownPos = pointerPos; 27 _firstPointerDownPos = pointerPos;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 _gameWorld.controlThrust(null); 62 _gameWorld.controlThrust(null);
63 } 63 }
64 break; 64 break;
65 default: 65 default:
66 break; 66 break;
67 } 67 }
68 } 68 }
69 } 69 }
70 70
71 } 71 }
OLDNEW
« no previous file with comments | « no previous file | sky/examples/game/lib/sprite_box.dart » ('j') | sky/sdk/lib/framework/rendering/object.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698