Example usage for com.badlogic.gdx.backends.android AndroidApplicationConfiguration AndroidApplicationConfiguration

List of usage examples for com.badlogic.gdx.backends.android AndroidApplicationConfiguration AndroidApplicationConfiguration

Introduction

In this page you can find the example usage for com.badlogic.gdx.backends.android AndroidApplicationConfiguration AndroidApplicationConfiguration.

Prototype

AndroidApplicationConfiguration

Source Link

Usage

From source file:org.ams.testapps.android.cardhouse.CardHouse.java

License:Open Source License

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
    initialize(new org.ams.testapps.paintandphysics.cardhouse.CardHouseGameMenu(), config);
}

From source file:org.artoolkit.ar.base.ARActivity.java

License:Open Source License

@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
@Override//from   w w  w  .jav a 2s.com
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    config = new AndroidApplicationConfiguration();

    //      initialize(new GDXRenderer(), config);
    config.a = 8;
    config.r = 8;
    config.g = 8;
    config.b = 8;
    config.depth = 16;
    config.stencil = 0;
    gdxRenderer = new GDXRenderer();
    initializeForView(gdxRenderer, config);

    // This needs to be done just only the very first time the application is run,
    // or whenever a new preference is added (e.g. after an application upgrade).
    PreferenceManager.setDefaultValues(this, R.xml.preferences, false);

    // Correctly configures the activity window for running AR in a layer
    // on top of the camera preview. This includes entering 
    // fullscreen landscape mode and enabling transparency. 
    boolean needActionBar = false;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
            if (!ViewConfiguration.get(this).hasPermanentMenuKey())
                needActionBar = true;
        } else {
            needActionBar = true;
        }
    }
    if (needActionBar) {
        requestWindowFeature(Window.FEATURE_ACTION_BAR);
    } else {
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    }
    getWindow().setFormat(PixelFormat.TRANSLUCENT);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

    AndroidUtils.reportDisplayInformation(this);
}

From source file:org.catrobat.catroid.stage.StageActivity.java

License:Open Source License

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.d(TAG, "onCreate()");

    numberOfSpritesCloned = 0;/*  w  w w .j ava2 s. c  om*/
    setupAskHandler();

    if (ProjectManager.getInstance().isCurrentProjectLandscapeMode()) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    } else {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    }

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

    stageListener = new StageListener();
    stageDialog = new StageDialog(this, stageListener, R.style.stage_dialog);
    calculateScreenSizes();

    // need we this here?
    configuration = new AndroidApplicationConfiguration();
    configuration.r = configuration.g = configuration.b = configuration.a = 8;

    initialize(stageListener, configuration);

    if (graphics.getView() instanceof SurfaceView) {
        SurfaceView glView = (SurfaceView) graphics.getView();
        glView.getHolder().setFormat(PixelFormat.TRANSLUCENT);
    }

    pendingIntent = PendingIntent.getActivity(this, 0,
            new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);

    nfcAdapter = NfcAdapter.getDefaultAdapter(this);
    Log.d(TAG, "onCreate()");

    if (nfcAdapter == null) {
        Log.d(TAG, "could not get nfc adapter :(");
    }

    ServiceProvider.getService(CatroidService.BLUETOOTH_DEVICE_SERVICE).initialise();

    stageAudioFocus = new StageAudioFocus(this);

    CameraManager.getInstance().setStageActivity(this);

    BackgroundWaitHandler.reset();
    SnackbarUtil.showHintSnackbar(this, R.string.hint_stage);
}

From source file:org.gearvrf.plugins.widget.GVRWidgetPluginActivity.java

License:Apache License

/**
 * This method has to be called in the {@link Activity#onCreate(Bundle)}
 * method. It sets up all the things necessary to get input, render via
 * OpenGL and so on. Uses a default {@link AndroidApplicationConfiguration}.
 * /*  ww w  .  jav  a2  s . c o m*/
 * @param listener
 *            the {@link ApplicationListener} implementing the program logic
 **/
public void initialize(ApplicationListener listener) {
    AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
    initialize(listener, config, null);
}

From source file:org.gearvrf.plugins.widget.GVRWidgetPluginActivity.java

License:Apache License

/**
 * This method has to be called in the {@link Activity#onCreate(Bundle)}
 * method. It sets up all the things necessary to get input, render via
 * OpenGL and so on. Uses a default {@link AndroidApplicationConfiguration}.
 * <p>// w  w w.  j  av  a2s  .co  m
 * Note: you have to add the returned view to your layout!
 * 
 * @param listener
 *            the {@link ApplicationListener} implementing the program logic
 * @return the GLSurfaceView of the application
 */
public View initializeForView(ApplicationListener listener) {
    AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
    return initializeForView(listener, config, null);
}

From source file:org.gearvrf.plugins.widget.GVRWidgetPluginActivity.java

License:Apache License

private void doResume(GVRWidget widget) {
    mWidgetView = (GLSurfaceView) initializeForView(widget, new AndroidApplicationConfiguration(), mEGLContext);

    addContentView(mWidgetView, createLayoutParams());
    Gdx.app = this;
    Gdx.input = this.getInput();
    Gdx.audio = this.getAudio();
    Gdx.files = this.getFiles();
    Gdx.graphics = this.getGraphics();
    Gdx.net = this.getNet();
    mGraphics.setFramebuffer(mViewWidth, mViewHeight);

    mInputDispatcher.getInput().onResume();
    if (mGraphics != null) {
        mGraphics.onResumeGLSurfaceView();
    }// w  w w  .j a v  a  2 s . co  m

    if (!mFirstResume) {
        mGraphics.resume();
    } else
        mFirstResume = false;

    this.mIsWaitingForAudio = true;
    if (this.mWasFocusChanged == 1 || this.mWasFocusChanged == -1) {
        // this.audio.resume();
        this.mIsWaitingForAudio = false;
    }
}

From source file:org.oscim.android.test.GdxActivity.java

License:Open Source License

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    AndroidGraphics.init();/*from   ww  w.  ja  va 2 s .co m*/
    GdxAssets.init("");
    GLAdapter.init(new AndroidGL());

    DisplayMetrics metrics = getResources().getDisplayMetrics();
    CanvasAdapter.dpi = (int) (metrics.scaledDensity * CanvasAdapter.DEFAULT_DPI);
    Tile.SIZE = Tile.calculateTileSize();

    AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
    cfg.stencil = 8;
    //cfg.numSamples = 2;

    new SharedLibraryLoader().load("vtm-jni");

    initialize(new GdxMapAndroid(), cfg);
    mPrefs = new MapPreferences(GdxActivity.class.getName(), this);
}

From source file:org.oscim.android.test.GdxMapActivity.java

License:Open Source License

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    AndroidGraphics.init();/*from   w w  w.j  a v  a 2  s  .  c  o  m*/
    GdxAssets.init("");
    GLAdapter.init(new AndroidGL());

    DisplayMetrics metrics = getResources().getDisplayMetrics();
    CanvasAdapter.dpi = (int) (metrics.scaledDensity * CanvasAdapter.DEFAULT_DPI);
    Tile.SIZE = Tile.calculateTileSize();

    AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
    cfg.stencil = 8;
    cfg.numSamples = 2;

    new SharedLibraryLoader().load("vtm-jni");

    initialize(new GdxMapAndroid(), cfg);
}

From source file:org.oscim.gdx.MainActivity.java

License:Open Source License

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    AndroidGraphics.init();//from   ww  w .  j a  va  2s .  c  om
    GdxAssets.init("");
    GLAdapter.init(new AndroidGL());
    Tile.SIZE = 400;

    AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
    cfg.stencil = 8;

    new SharedLibraryLoader().load("vtm-jni");

    initialize(new GdxMapAndroid(), cfg);
}

From source file:org.zapylaev.game.truetennis.android.TrueTennisMainActivity.java

License:Open Source License

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
    config.useGL20 = true;/*  www .  j  av a 2s.c  o m*/
    initialize(new TrueTennisMain(), config);
}