| Index: sky/examples/game/lib/game_demo_box.dart
|
| diff --git a/sky/examples/game/lib/game_demo_box.dart b/sky/examples/game/lib/game_demo_box.dart
|
| index 58716a1d14b8b728fb75a1108047248c2aa84fb7..2b9f0c4d325651b3ec27e0231ee9bc46418af3e0 100644
|
| --- a/sky/examples/game/lib/game_demo_box.dart
|
| +++ b/sky/examples/game/lib/game_demo_box.dart
|
| @@ -14,66 +14,66 @@ class GameDemoBox extends SpriteBox {
|
| int _secondPointer = -1;
|
| Point _firstPointerDownPos;
|
|
|
| - void handleEvent(Event event, BoxHitTestEntry entry) {
|
| - if (event is PointerEvent) {
|
| - Point pointerPos = new Point(event.x, event.y);
|
| - int pointer = event.pointer;
|
| -
|
| - switch (event.type) {
|
| - case 'pointerdown':
|
| - if (_firstPointer == -1) {
|
| - // Assign the first pointer
|
| - _firstPointer = pointer;
|
| - _firstPointerDownPos = pointerPos;
|
| - }
|
| - else if (_secondPointer == -1) {
|
| - // Assign second pointer
|
| - _secondPointer = pointer;
|
| - _gameWorld.controlFire();
|
| - }
|
| - else {
|
| - // There is a pointer used for steering, let's fire instead
|
| - _gameWorld.controlFire();
|
| - }
|
| - break;
|
| - case 'pointermove':
|
| - if (pointer == _firstPointer) {
|
| - // Handle turning control
|
| - double joystickX = 0.0;
|
| - double deltaX = pointerPos.x - _firstPointerDownPos.x;
|
| - if (deltaX > _steeringThreshold || deltaX < -_steeringThreshold) {
|
| - joystickX = (deltaX - _steeringThreshold)/(_steeringMax - _steeringThreshold);
|
| - if (joystickX > 1.0) joystickX = 1.0;
|
| - if (joystickX < -1.0) joystickX = -1.0;
|
| - }
|
| -
|
| - double joystickY = 0.0;
|
| - double deltaY = pointerPos.y - _firstPointerDownPos.y;
|
| - if (deltaY > _steeringThreshold || deltaY < -_steeringThreshold) {
|
| - joystickY = (deltaY - _steeringThreshold)/(_steeringMax - _steeringThreshold);
|
| - if (joystickY > 1.0) joystickY = 1.0;
|
| - if (joystickY < -1.0) joystickY = -1.0;
|
| - }
|
| -
|
| - _gameWorld.controlSteering(joystickX, joystickY);
|
| - }
|
| - break;
|
| - case 'pointerup':
|
| - case 'pointercancel':
|
| - if (pointer == _firstPointer) {
|
| - // Un-assign the first pointer
|
| - _firstPointer = -1;
|
| - _firstPointerDownPos = null;
|
| - _gameWorld.controlSteering(0.0, 0.0);
|
| - }
|
| - else if (pointer == _secondPointer) {
|
| - _secondPointer = -1;
|
| - }
|
| - break;
|
| - default:
|
| - break;
|
| - }
|
| - }
|
| - }
|
| +// void handleEvent(Event event, BoxHitTestEntry entry) {
|
| +// if (event is PointerEvent) {
|
| +// Point pointerPos = new Point(event.x, event.y);
|
| +// int pointer = event.pointer;
|
| +//
|
| +// switch (event.type) {
|
| +// case 'pointerdown':
|
| +// if (_firstPointer == -1) {
|
| +// // Assign the first pointer
|
| +// _firstPointer = pointer;
|
| +// _firstPointerDownPos = pointerPos;
|
| +// }
|
| +// else if (_secondPointer == -1) {
|
| +// // Assign second pointer
|
| +// _secondPointer = pointer;
|
| +// _gameWorld.controlFire();
|
| +// }
|
| +// else {
|
| +// // There is a pointer used for steering, let's fire instead
|
| +// _gameWorld.controlFire();
|
| +// }
|
| +// break;
|
| +// case 'pointermove':
|
| +// if (pointer == _firstPointer) {
|
| +// // Handle turning control
|
| +// double joystickX = 0.0;
|
| +// double deltaX = pointerPos.x - _firstPointerDownPos.x;
|
| +// if (deltaX > _steeringThreshold || deltaX < -_steeringThreshold) {
|
| +// joystickX = (deltaX - _steeringThreshold)/(_steeringMax - _steeringThreshold);
|
| +// if (joystickX > 1.0) joystickX = 1.0;
|
| +// if (joystickX < -1.0) joystickX = -1.0;
|
| +// }
|
| +//
|
| +// double joystickY = 0.0;
|
| +// double deltaY = pointerPos.y - _firstPointerDownPos.y;
|
| +// if (deltaY > _steeringThreshold || deltaY < -_steeringThreshold) {
|
| +// joystickY = (deltaY - _steeringThreshold)/(_steeringMax - _steeringThreshold);
|
| +// if (joystickY > 1.0) joystickY = 1.0;
|
| +// if (joystickY < -1.0) joystickY = -1.0;
|
| +// }
|
| +//
|
| +// _gameWorld.controlSteering(joystickX, joystickY);
|
| +// }
|
| +// break;
|
| +// case 'pointerup':
|
| +// case 'pointercancel':
|
| +// if (pointer == _firstPointer) {
|
| +// // Un-assign the first pointer
|
| +// _firstPointer = -1;
|
| +// _firstPointerDownPos = null;
|
| +// _gameWorld.controlSteering(0.0, 0.0);
|
| +// }
|
| +// else if (pointer == _secondPointer) {
|
| +// _secondPointer = -1;
|
| +// }
|
| +// break;
|
| +// default:
|
| +// break;
|
| +// }
|
| +// }
|
| +// }
|
|
|
| }
|
|
|