Merge pull request #7272 from Dhilan007/v3-gc0627

Add missing file for game controller support
This commit is contained in:
minggo 2014-07-01 18:02:24 +08:00
commit 206eea60f5
4 changed files with 23 additions and 60 deletions

View File

@ -0,0 +1,16 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-16
android.library.reference.1=../java
android.library=true

View File

@ -10,4 +10,4 @@
# Project target.
target=android-10
android.library.reference.1=../../../cocos/platform/android/ControllerDelegate
android.library.reference.1=../../../cocos/platform/android/ControllerAutoAdapter

View File

@ -23,14 +23,10 @@ THE SOFTWARE.
****************************************************************************/
package org.cocos2dx.game_controller_test;
import java.util.ArrayList;
import org.cocos2dx.lib.GameControllerActivity;
import org.cocos2dx.lib.GameControllerHelper.ControllerListener;
//import org.cocos2dx.lib.GameControllerHelper.ControllerListener;
import android.bluetooth.BluetoothDevice;
import android.os.Bundle;
import android.util.Log;
public class AppActivity extends GameControllerActivity {
@ -42,61 +38,12 @@ public class AppActivity extends GameControllerActivity {
//Automatic adaptation for connect controller.
//Supported Platform: Nibiru / Moga / Ouya TV
//mControllerHelper.setControllerListener(controllerListener);
mControllerHelper.connectController();
this.connectController();
//Manually specify an adapter.
//setGameControllerInstance(new GameControllerNibiru());
//setGameControllerInstance(new GameControllerMoga());
//setGameControllerInstance(new GameControllerOuya());
//Requirements: using libControllerDriveAdapter project
//this.connectController(DRIVERTYPE_NIBIRU);
//this.connectController(DRIVERTYPE_MOGA);
//this.connectController(DRIVERTYPE_OUYA);
}
ControllerListener controllerListener = new ControllerListener() {
@Override
public void onDownloadConfigStarted() {
Log.w("controllerListener", "onDownloadDepsFinished");
}
@Override
public void onDownloadConfigFinished(boolean isSuccess) {
//If download failed
Log.w("controllerListener", "onDownloadConfigFinished:" + isSuccess);
}
@Override
public void onControllerDiscoveryStarted() {
Log.w("controllerListener", "onControllerDiscoveryStarted");
}
@Override
public void onControllerDiscoveryFinish(ArrayList<BluetoothDevice> devices) {
Log.w("controllerListener", "onControllerDiscoveryFinish");
}
@Override
public void onDownloadDepsStarted() {
Log.w("controllerListener", "onDownloadDepsStarted");
}
@Override
public void onDownloadDepsProgress(int bytesWritten, int totalSize) {
Log.w("controllerListener", "onDownloadDepsProgress");
}
@Override
public void onDownloadDepsFinished(boolean isSuccess) {
Log.w("controllerListener", "");
}
@Override
public void onInstallDriver(String filePath) {
Log.w("controllerListener", "onInstallDriver");
}
@Override
public void onConnectController() {
Log.w("controllerListener", "onConnectController");
}
};
}