Android Open Source - Gallery97 Gdx App






From Project

Back to project page Gallery97.

License

The source code is released under:

GNU General Public License

If you think the Android project Gallery97 listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package pl.kacprzak.klub97;
//from   w  w w .j  a v a 2 s  . c o  m
import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorManager;
import android.os.Bundle;
import android.util.Log;
import android.view.WindowManager;

import com.badlogic.gdx.backends.android.AndroidApplication;
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;

public class GdxApp extends AndroidApplication {

  public SensorManager sensorManager;
  public InputListener inputListener;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    
    sensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
    inputListener = new InputListener();
                
    AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
    initialize(new MieszkanieStart(), cfg);
    Log.e("my log", "App initialised.");
    //setContentView(R.layout.activity_gdx_app);
  }

     @Override
      public void onStop() {
          super.onStop();
          sensorManager.unregisterListener(inputListener);
      }

      @Override
      protected void onPause() {
          super.onPause();
      }

      @Override
      public void onResume() {
          super.onResume();
          
          sensorManager.registerListener(inputListener, 
          sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), 
          SensorManager.SENSOR_DELAY_GAME);
      
      sensorManager.registerListener(inputListener, 
          sensorManager.getDefaultSensor(Sensor.TYPE_GYROSCOPE), 
          SensorManager.SENSOR_DELAY_GAME);
      
      sensorManager.registerListener(inputListener, 
          sensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD), 
          SensorManager.SENSOR_DELAY_GAME);
      
          sensorManager.registerListener(inputListener,
                  sensorManager.getDefaultSensor(Sensor.TYPE_LINEAR_ACCELERATION),
                  SensorManager.SENSOR_DELAY_GAME);
      }
}




Java Source Code List

pl.kacprzak.klub97.AbstractScreen.java
pl.kacprzak.klub97.GdxApp.java
pl.kacprzak.klub97.InputListener.java
pl.kacprzak.klub97.LoadingScreen.java
pl.kacprzak.klub97.MieszkanieScreen.java
pl.kacprzak.klub97.MieszkanieStart.java
pl.kacprzak.klub97.MovementEngine.java