Ejemplo n.º 1
0
  @Override
  public Engine onLoadEngine() {
    // this.mCamera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
    // return new Engine(new EngineOptions(true, ScreenOrientation.LANDSCAPE, new
    // RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), this.mCamera));
    context = this.getApplicationContext();

    Camera camera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
    DisplayMetrics dm = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(dm);

    final EngineOptions options =
        new EngineOptions(
                true,
                ScreenOrientation.LANDSCAPE,
                new RatioResolutionPolicy((float) dm.widthPixels, (float) dm.heightPixels),
                camera)
            .setWakeLockOptions(WakeLockOptions.SCREEN_ON);

    options.getRenderOptions().disableExtensionVertexBufferObjects();

    options.getTouchOptions().setRunOnUpdateThread(true);

    mEngine = new Engine(options);
    return mEngine;
  }
Ejemplo n.º 2
0
 @Override
 public Engine onLoadEngine() {
   Toast.makeText(this, "Touch the screen to add boxes.", Toast.LENGTH_LONG).show();
   this.mCamera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
   this.mChaseCamera =
       new BoundCamera(
           0, 0, CAMERA_WIDTH / 2, CAMERA_HEIGHT / 2, 0, CAMERA_WIDTH, 0, CAMERA_HEIGHT);
   final EngineOptions engineOptions =
       new EngineOptions(
           true,
           ScreenOrientation.LANDSCAPE,
           new RatioResolutionPolicy(CAMERA_WIDTH * 2, CAMERA_HEIGHT),
           this.mCamera);
   engineOptions.getTouchOptions().setRunOnUpdateThread(true);
   return new SingleSceneSplitScreenEngine(engineOptions, this.mChaseCamera);
 }
Ejemplo n.º 3
0
  @Override
  public Engine onLoadEngine() {
    this.camera = new BoundCamera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
    this.camera.setBounds(0, WORLD_WIDTH, 0, WORLD_HEIGHT);
    this.camera.setBoundsEnabled(true);
    this.camera.setHUD(new HUD());

    EngineOptions options =
        new EngineOptions(
            true, // Fullscreen
            ScreenOrientation.LANDSCAPE,
            new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT),
            this.camera);
    options.setNeedsMusic(true);
    options.setNeedsSound(true);
    return new Engine(options);
  }
  @Override
  public Engine onLoadEngine() {
    Toast.makeText(
            this,
            "Touch the screen to add objects. Touch an object to remove it",
            Toast.LENGTH_LONG)
        .show();
    final Camera camera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
    final EngineOptions engineOptions =
        new EngineOptions(
            true,
            ScreenOrientation.LANDSCAPE,
            new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT),
            camera);
    engineOptions.getTouchOptions().setRunOnUpdateThread(true);

    return new Engine(engineOptions);
  }
Ejemplo n.º 5
0
  private void applyEngineOptions(final EngineOptions pEngineOptions) {
    if (pEngineOptions.isFullscreen()) {
      ActivityUtils.requestFullscreen(this);
    }

    if (pEngineOptions.needsMusic() || pEngineOptions.needsSound()) {
      this.setVolumeControlStream(AudioManager.STREAM_MUSIC);
    }

    switch (pEngineOptions.getScreenOrientation()) {
      case LANDSCAPE:
        this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
        break;
      case PORTRAIT:
        this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        break;
    }
  }