void animateFrame() { long currentStepTime = SystemClock.uptimeMillis(); step(currentStepTime); Handler handler = getHandler(); if (handler != null) { handler.postAtTime(mAnimationRunnable, currentStepTime + ANIMATION_TIME_STEP); invalidate(); } }
void animateFrame() { long currentStepTime = SystemClock.uptimeMillis(); step(currentStepTime); Handler handler = getHandler(); if (handler != null) { handler.postAtTime(mAnimationRunnable, currentStepTime + ANIMATION_TIME_STEP); invalidate(); } }
private void processJoystickInput(MotionEvent event, int historyPos) { // Get joystick position. // Many game pads with two joysticks report the position of the second joystick // using the Z and RZ axes so we also handle those. // In a real game, we would allow the user to configure the axes manually. float x = getCenteredAxis(event, mLastInputDevice, MotionEvent.AXIS_X, historyPos); if (x == 0) { x = getCenteredAxis(event, mLastInputDevice, MotionEvent.AXIS_HAT_X, historyPos); } if (x == 0) { x = getCenteredAxis(event, mLastInputDevice, MotionEvent.AXIS_Z, historyPos); } float y = getCenteredAxis(event, mLastInputDevice, MotionEvent.AXIS_Y, historyPos); if (y == 0) { y = getCenteredAxis(event, mLastInputDevice, MotionEvent.AXIS_HAT_Y, historyPos); } if (y == 0) { y = getCenteredAxis(event, mLastInputDevice, MotionEvent.AXIS_RZ, historyPos); } // Set the ship heading. mShip.setHeading(x, y); step(historyPos < 0 ? event.getEventTime() : event.getHistoricalEventTime(historyPos)); }
private void processJoystickInput(MotionEvent event, int historyPos) { // Get joystick position. // Many game pads with two joysticks report the position of the second joystick // using the Z and RZ axes so we also handle those. // In a real game, we would allow the user to configure the axes manually. float x = getCenteredAxis(event, mLastInputDevice, MotionEvent.AXIS_X, historyPos); if (x == 0) { x = getCenteredAxis(event, mLastInputDevice, MotionEvent.AXIS_HAT_X, historyPos); } if (x == 0) { x = getCenteredAxis(event, mLastInputDevice, MotionEvent.AXIS_Z, historyPos); } float y = getCenteredAxis(event, mLastInputDevice, MotionEvent.AXIS_Y, historyPos); if (y == 0) { y = getCenteredAxis(event, mLastInputDevice, MotionEvent.AXIS_HAT_Y, historyPos); } if (y == 0) { y = getCenteredAxis(event, mLastInputDevice, MotionEvent.AXIS_RZ, historyPos); } // Set the ship heading. mShip.setHeading(x, y); step(historyPos < 0 ? event.getEventTime() : event.getHistoricalEventTime(historyPos)); }
step(event.getEventTime()); return true;
step(event.getEventTime()); return true;
step(event.getEventTime()); return true;
step(event.getEventTime()); return true;