private void updateGamePad() { ArrayList<InputDevice> gameControlers = gamepad.getGameControllers(); if (gameControlers.size() == 0) { mPadView.setVisibility(View.INVISIBLE); mTextGamePadName.setText("GamePadList: no gamepad connected!"); } else { mPadView.setVisibility(View.VISIBLE); mTextGamePadName.setText("GamePadList: " + gameControlers.get(0).getName()); } updateProgressBarValue(mProgressBarLX, gamePadInput.gamePadAxis.leftControleStickX); updateProgressBarValue(mProgressBarLY, gamePadInput.gamePadAxis.leftControleStickY); updateProgressBarValue(mProgressBarRX, gamePadInput.gamePadAxis.rightControleStickX); updateProgressBarValue(mProgressBarRY, gamePadInput.gamePadAxis.rightControleStickY); updateProgressBarValue(mProgressBarDX, gamePadInput.gamePadAxis.dpadControleStickX); updateProgressBarValue(mProgressBarDY, gamePadInput.gamePadAxis.dpadControleStickY); updateToggleButton(mTogleA, gamePadInput.isKeyDown(GamePadInput.GamePadKey.A)); updateToggleButton(mTogleB, gamePadInput.isKeyDown(GamePadInput.GamePadKey.B)); updateToggleButton(mTogleX, gamePadInput.isKeyDown(GamePadInput.GamePadKey.X)); updateToggleButton(mTogleY, gamePadInput.isKeyDown(GamePadInput.GamePadKey.Y)); updateToggleButton(mTogleL1, gamePadInput.isKeyDown(GamePadInput.GamePadKey.L1)); updateToggleButton(mTogleL2, gamePadInput.isKeyDown(GamePadInput.GamePadKey.L2)); updateToggleButton(mTogleR1, gamePadInput.isKeyDown(GamePadInput.GamePadKey.R1)); updateToggleButton(mTogleR2, gamePadInput.isKeyDown(GamePadInput.GamePadKey.R2)); updateToggleButton(mTogleStart, gamePadInput.isKeyDown(GamePadInput.GamePadKey.START)); updateToggleButton(mTogleSelect, gamePadInput.isKeyDown(GamePadInput.GamePadKey.SELECT)); updateToggleButton(mTogleCL, gamePadInput.isKeyDown(GamePadInput.GamePadKey.THUMBL)); updateToggleButton(mTogleCR, gamePadInput.isKeyDown(GamePadInput.GamePadKey.THUMBR)); }
public GamePadInput.GamePadKey onKey(int keyCode, KeyEvent event, boolean down) { GamePadInput.GamePadKey ret = gamePadInput.onKey(keyCode, event, down); if (ret != null) updateGamePad(); return ret; }
public GamePadInput.GamePadAxis onGenericMotionEvent(MotionEvent event) { GamePadInput.GamePadAxis ret = gamePadInput.onGenericMotionEvent(event); if (ret != null) updateGamePad(); return ret; }