AndroidApplication extends Activity implements Application
首先继承了android的Activity,并实现了Application接口
public void initialize (ApplicationListener listener, AndroidApplicationConfiguration config)
{
//创建2D的渲染对象
graphics = new AndroidGraphics(this, config, config.resolutionStrategy == null ? new FillResolutionStrategy() : config.resolutionStrategy);
//创建输入对象
input = new AndroidInput(this, graphics.view, config);
//创建音频对象
audio = new AndroidAudio(this);
//创建文件操作对象
files = new AndroidFiles(this.getAssets());
this.listener = listener;
this.handler = new Handler();
Gdx.app = this;
Gdx.input = this.getInput();
Gdx.audio = this.getAudio();
Gdx.files = this.getFiles();
Gdx.graphics = this.getGraphics();
//设置全屏模式
try
{
//没标题
requestWindowFeature(Window.FEATURE_NO_TITLE);
}
catch (Exception ex)
{
log("AndroidApplication", "Content already displayed, cannot request FEATURE_NO_TITLE", ex);
}
//设置全屏模式
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
//也可以用下面的清除Flag
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
//设置运行的显示View
//DefaultGLSurfaceView
setContentView(graphics.getView(), createLayoutParams());
createWakeLock(config);