示例#1
0
 // Sensor events
 public void enableSensor(int sensortype, boolean enabled) {
   // TODO: This uses getDefaultSensor - what if we have >1 accels?
   if (enabled) {
     mSensorManager.registerListener(
         this, mSensorManager.getDefaultSensor(sensortype), SensorManager.SENSOR_DELAY_GAME, null);
   } else {
     mSensorManager.unregisterListener(this, mSensorManager.getDefaultSensor(sensortype));
   }
 }
示例#2
0
 @Override
 protected void onResume() {
   super.onResume();
   mView.onResume();
   mSensorManager.registerListener(this, mAccelerometer, SensorManager.SENSOR_DELAY_NORMAL);
   GodotLib.focusin();
 }
示例#3
0
 @Override
 protected void onPause() {
   super.onPause();
   mView.onPause();
   mSensorManager.unregisterListener(this);
   GodotLib.focusout();
 }
示例#4
0
  private void initializeGodot() {

    if (expansion_pack_path != null) {

      String[] new_cmdline;
      int cll = 0;
      if (command_line != null) {
        Log.d("GODOT", "initializeGodot: command_line: is not null");
        new_cmdline = new String[command_line.length + 2];
        cll = command_line.length;
        for (int i = 0; i < command_line.length; i++) {
          new_cmdline[i] = command_line[i];
        }
      } else {
        Log.d("GODOT", "initializeGodot: command_line: is null");
        new_cmdline = new String[2];
      }

      new_cmdline[cll] = "-main_pack";
      new_cmdline[cll + 1] = expansion_pack_path;
      command_line = new_cmdline;
    }

    io = new GodotIO(this);
    io.unique_id = Secure.getString(getContentResolver(), Secure.ANDROID_ID);
    GodotLib.io = io;
    Log.d("GODOT", "command_line is null? " + ((command_line == null) ? "yes" : "no"));
    /*if(command_line != null){
        Log.d("GODOT", "Command Line:");
        for(int w=0;w <command_line.length;w++){
            Log.d("GODOT","   " + command_line[w]);
        }
    }*/
    GodotLib.initialize(this, io.needsReloadHooks(), command_line);
    mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
    mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
    mSensorManager.registerListener(this, mAccelerometer, SensorManager.SENSOR_DELAY_GAME);

    result_callback = null;

    mPaymentsManager = PaymentsManager.createManager(this).initService();
    godot_initialized = true;
  }
示例#5
0
  @Override
  protected void onCreate(Bundle icicle) {

    super.onCreate(icicle);

    Window window = getWindow();
    window.addFlags(
        WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
            | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

    io = new GodotIO(this);
    io.unique_id = Secure.getString(getContentResolver(), Secure.ANDROID_ID);
    GodotLib.io = io;
    GodotLib.initialize(this, io.needsReloadHooks());
    mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
    mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
    mSensorManager.registerListener(this, mAccelerometer, SensorManager.SENSOR_DELAY_NORMAL);

    result_callback = null;

    //	instanceSingleton( new GodotFacebook(this) );

  }
示例#6
0
  @Override
  protected void onPause() {
    super.onPause();
    if (!godot_initialized) {
      if (null != mDownloaderClientStub) {
        mDownloaderClientStub.disconnect(this);
      }
      return;
    }
    mView.onPause();
    mSensorManager.unregisterListener(this);
    GodotLib.focusout();

    for (int i = 0; i < singleton_count; i++) {
      singletons[i].onMainPause();
    }
  }
示例#7
0
  @Override
  protected void onResume() {
    super.onResume();
    if (!godot_initialized) {
      if (null != mDownloaderClientStub) {
        mDownloaderClientStub.connect(this);
      }
      return;
    }

    mView.onResume();
    mSensorManager.registerListener(this, mAccelerometer, SensorManager.SENSOR_DELAY_NORMAL);
    GodotLib.focusin();

    for (int i = 0; i < singleton_count; i++) {

      singletons[i].onMainResume();
    }
  }