List of usage examples for com.badlogic.gdx.backends.android AndroidApplicationConfiguration AndroidApplicationConfiguration
AndroidApplicationConfiguration
From source file:es.danirod.rectball.android.AndroidLauncher.java
License:Open Source License
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); AndroidApplicationConfiguration config = new AndroidApplicationConfiguration(); AndroidPlatform platform = new AndroidPlatform(this); if (platform.preferences().getBoolean("fullscreen")) { config.useImmersiveMode = true;//from www.j a v a2s .c o m config.hideStatusBar = true; putFullscreen(); } if (savedInstanceState != null) { Json json = new Json(); String jsonBoard = savedInstanceState.getString("state"); if (jsonBoard != null) { GameState state = json.fromJson(GameState.class, jsonBoard); game = new RectballGame(platform, state); } else { game = new RectballGame(platform); } Log.d("Rectball", "Restoring state: " + jsonBoard); } else { game = new RectballGame(platform); Log.d("Rectball", "New execution. No restoring state needed."); } View rectballView = initializeForView(game, config); RelativeLayout layout = new RelativeLayout(this); layout.addView(rectballView); setContentView(layout); }
From source file:es.eucm.ead.android.EditorActivity.java
License:Open Source License
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (savedInstanceState != null) { consumedIntent = savedInstanceState.getBoolean(SAVED_INSTANCE_STATE_CONSUMED_INTENT); }/*from www . j av a2 s .co m*/ AndroidApplicationConfiguration config = new AndroidApplicationConfiguration(); config.useAccelerometer = false; config.useImmersiveMode = false; config.hideStatusBar = true; config.useWakelock = true; config.useCompass = false; this.listeners = new HashMap<Integer, ActivityResultListener>(); GoogleAnalytics analytics = GoogleAnalytics.getInstance(this); Tracker tracker = analytics.newTracker(R.xml.tracker); analytics.reportActivityStart(this); platform = new AndroidPlatform(getContext(), tracker); handleIntent(); initialize(new MokapApplicationListener(platform), config); // Force initialization of the clipboard. This needs to be done in the // activity thread to avoid exceptions in future accesses Gdx.app.getClipboard().getContents(); }
From source file:es.eucm.ead.engine.android.EAdEngineActivity.java
License:Open Source License
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); AndroidApplicationConfiguration config = new AndroidApplicationConfiguration(); config.useGL20 = true;// w w w. j a va2 s. c om Engine engine = new Engine(); initialize(engine, config); engine.setLoadingPath("", true); }
From source file:es.eucm.ead.engine.android.EngineActivity.java
License:Open Source License
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Read canvas width and height int canvasWidth = -1; int canvasHeight = -1; try {//from w w w . j a va2s.co m ActivityInfo ai = getPackageManager().getActivityInfo(getComponentName(), PackageManager.GET_ACTIVITIES | PackageManager.GET_META_DATA); Bundle bundle = ai.metaData; canvasWidth = bundle.getInt(CANVAS_WIDTH); canvasHeight = bundle.getInt(CANVAS_HEIGHT); } catch (Exception e) { errorReadingCanvasSize(e); } AndroidApplicationConfiguration config = new AndroidApplicationConfiguration(); if (canvasHeight > 0 && canvasWidth > 0) { config.resolutionStrategy = new FixedResolutionStrategy(canvasWidth, canvasHeight); } config.useAccelerometer = false; config.useImmersiveMode = false; config.hideStatusBar = true; config.useWakelock = true; config.useCompass = false; final EngineApplicationListener engineApplicationListener = new EngineAndroidApplicationListener(); initialize(engineApplicationListener, config); Gdx.app.postRunnable(new Runnable() { @Override public void run() { engineApplicationListener.getGameLoader().loadGame("", true); } }); }
From source file:es.eucm.ead.engine.android.MainActivity.java
License:Open Source License
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration(); cfg.useGL20 = true;// w w w .jav a 2 s .co m ReflectionClassLoader.init(new JavaReflectionClassLoader()); JavaInjector injector = new JavaInjector(Guice.createInjector(new AndroidModule(), new JavaToolsModule())); ApplicationListener engine = injector.getInstance(ApplicationListener.class); initialize(engine, cfg); }
From source file:es.eucm.ead.mockup.android.MockupActivity.java
License:Open Source License
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration(); cfg.hideStatusBar = true;//w w w.j ava 2 s . c o m cfg.useGL20 = true; cfg.useAccelerometer = false; cfg.useCompass = false; cfg.useGLSurfaceViewAPI18 = false; cfg.useImmersiveMode = true; cfg.useWakelock = false; // we need to change the default pixel format - since it does not // include an alpha channel // we need the alpha channel so the camera preview will be seen behind // the GL scene cfg.r = 8; cfg.g = 8; cfg.b = 8; cfg.a = 8; Mockup mockup = new Mockup(); initialize(mockup, cfg); this.listeners = new HashMap<Integer, ActivityResultListener>(); if (this.graphics.getView() instanceof SurfaceView) { SurfaceView glView = (SurfaceView) graphics.getView(); // force alpha channel - I'm not sure we need this as the GL surface // is already using alpha channel glView.getHolder().setFormat(PixelFormat.TRANSLUCENT); // TODO check // if it's // needed } }
From source file:eu.rubenrosado.inmisericordia.MainActivity.java
License:Open Source License
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration(); initialize(new MainGame(), cfg); }
From source file:headmade.kotlinplayground.android.AndroidLauncher.java
License:Apache License
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); AndroidApplicationConfiguration config = new AndroidApplicationConfiguration(); initialize(new KotlinPlayground(), config); }
From source file:io.piotrjastrzebski.sfg.android.AndroidLauncher.java
License:Open Source License
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // fix for launcher icon starting new activity on top of old one if ((getIntent().getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != 0) { finish();// ww w. jav a 2 s .com return; } if (isSupported()) { requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); AndroidApplicationConfiguration config = new AndroidApplicationConfiguration(); config.hideStatusBar = true; config.useAccelerometer = false; config.useCompass = false; config.useImmersiveMode = getSharedPreferences(SFGApp.PREFS, Context.MODE_PRIVATE) .getBoolean(Settings.IMMERSIVE_MODE_STATE, true); Crittercism.initialize(getApplicationContext(), getString(R.string.crittercism_id)); actionResolver = new AndroidActionResolver(this); // initialize for view so we can show add on top layout = new RelativeLayout(this); SFGApp app = new SFGApp(actionResolver); View gameView = initializeForView(app, config); layout.addView(gameView); addPremiumBanner(layout); setContentView(layout); } }
From source file:it.alcacoop.backgammon.MainActivity.java
License:Open Source License
@Override public void onCreate(Bundle savedInstanceState) { requestWindowFeature(Window.FEATURE_NO_TITLE); AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration(); cfg.useGL20 = false;/*from w ww.j av a 2 s . c o m*/ getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); RelativeLayout layout = new RelativeLayout(this); gameView = initializeForView(new GnuBackgammon(this), cfg); super.onCreate(savedInstanceState); // HELPERS INITIALIZATION PrivateDataManager.createBillingData(this); androidHelpers = new AndroidHelpers(this); accelerometerHelpers = new AccelerometerHelpers(this); adsHelpers = new ADSHelpers(this, androidHelpers.isTablet()); RelativeLayout.LayoutParams adParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); adParams.addRule(RelativeLayout.ALIGN_PARENT_TOP); adParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT); layout.addView(gameView); View adv = adsHelpers.getAdView(); if (adv != null) layout.addView(adv, adParams); LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); chatBox = inflater.inflate(R.layout.chat_box, null); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); chatBox.setVisibility(View.GONE); layout.addView(chatBox, params); scHelper = new SmartClipHelper(this); setContentView(layout); /** CHATBOX DIMS **/ int width = androidHelpers.getScreenWidth(); View s1 = findViewById(R.id.space1); View s2 = findViewById(R.id.space2); View s3 = findViewById(R.id.chat_content); ViewGroup.LayoutParams pars = s1.getLayoutParams(); pars.width = Math.round(width * 0.15f) + 7; s1.setLayoutParams(pars); pars = s2.getLayoutParams(); pars.width = Math.round(width * 0.15f) + 7; s2.setLayoutParams(pars); pars = s3.getLayoutParams(); GnuBackgammon.chatHeight = pars.height; pars.width = Math.round(width * 0.7f) - 14; s3.setLayoutParams(pars); EditText target = (EditText) findViewById(R.id.message); target.setOnEditorActionListener(this); /** CHATBOX DIMS **/ imgMgr = ImageManager.create(getApplicationContext()); }