1 /******************************************************************************* 2 * Copyright 2011 See AUTHORS file. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 ******************************************************************************/ 16 17 package com.badlogic.gdx.backends.android; 18 19 import android.media.SoundPool; 20 21 import com.badlogic.gdx.Graphics; 22 import com.badlogic.gdx.audio.Sound; 23 import com.badlogic.gdx.backends.android.surfaceview.FillResolutionStrategy; 24 import com.badlogic.gdx.backends.android.surfaceview.ResolutionStrategy; 25 26 /** Class defining the configuration of an {@link AndroidApplication}. Allows you to disable the use of the accelerometer to save 27 * battery among other things. 28 * @author mzechner */ 29 public class AndroidApplicationConfiguration { 30 /** number of bits per color channel **/ 31 public int r = 5, g = 6, b = 5, a = 0; 32 33 /** number of bits for depth and stencil buffer **/ 34 public int depth = 16, stencil = 0; 35 36 /** number of samples for CSAA/MSAA, 2 is a good value **/ 37 public int numSamples = 0; 38 39 /** whether to use the accelerometer. default: true **/ 40 public boolean useAccelerometer = true; 41 42 /** whether to use the gyroscope. default: false **/ 43 public boolean useGyroscope = false; 44 45 /** whether to use the compass. default: true **/ 46 public boolean useCompass = true; 47 48 /** the time in milliseconds to sleep after each event in the touch handler, set this to 16ms to get rid of touch flooding on 49 * pre Android 2.0 devices. default: 0 **/ 50 public int touchSleepTime = 0; 51 52 /** whether to keep the screen on and at full brightness or not while running the application. default: false */ 53 public boolean useWakelock = false; 54 55 /** hide status bar buttons on Android 4.x and higher (API 14+). Doesn't work if "android:targetSdkVersion" less 11 or if API 56 * less 14. default: false **/ 57 public boolean hideStatusBar = false; 58 59 /** whether to disable Android audio support. default: false */ 60 public boolean disableAudio = false; 61 62 /** the maximum number of {@link Sound} instances that can be played simultaneously, sets the corresponding {@link SoundPool} 63 * constructor argument. */ 64 public int maxSimultaneousSounds = 16; 65 66 /** the {@link ResolutionStrategy}. default: {@link FillResolutionStrategy} **/ 67 public ResolutionStrategy resolutionStrategy = new FillResolutionStrategy(); 68 69 /** if the app is a livewallpaper, whether it should get full touch events **/ 70 public boolean getTouchEventsForLiveWallpaper = false; 71 72 /** set this to true to enable Android 4.4 KitKat's 'Immersive mode' **/ 73 public boolean useImmersiveMode = false; 74 75 /** Experimental, whether to enable OpenGL ES 3 if supported. If not supported it will fall-back to OpenGL ES 2.0. 76 * When GL ES 3* is enabled, {@link com.badlogic.gdx.Gdx#gl30} can be used to access its functionality. Requires at least Android 4.3 (API level 18). 77 * @deprecated this option is currently experimental and not yet fully supported, expect issues. */ 78 @Deprecated public boolean useGL30 = false; 79 80 /** whether to use {@link com.badlogic.gdx.backends.android.surfaceview.GLSurfaceView20API18} in place of the classic 81 * {@link com.badlogic.gdx.backends.android.surfaceview.GLSurfaceView20} on Android API 10 and lower. 82 * In case this is true {@link com.badlogic.gdx.backends.android.surfaceview.GLSurfaceView20API18} will be used. 83 * This implementation properly supports attach to and detach from window. default: false */ 84 public boolean useGLSurfaceView20API18 = false; 85 } 86