Splitted Java sources to many small files, fixed tabulation, splitted input source file from video in libSDL.

This commit is contained in:
pelya
2010-05-18 11:14:30 +03:00
parent 3ea94d2ba2
commit b973f29b35
11 changed files with 961 additions and 865 deletions

View File

@@ -0,0 +1,106 @@
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount
package de.schwardtnet.alienblaster;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.KeyEvent;
import android.view.Window;
import android.view.WindowManager;
import android.os.PowerManager;
import android.widget.TextView;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// fullscreen mode
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
TextView tv = new TextView(this);
tv.setText("Initializing");
setContentView(tv);
downloader = new DataDownloader(this, tv);
}
public void initSDL()
{
mLoadLibraryStub = new LoadLibrary();
mAudioThread = new AudioThread(this);
mGLView = new DemoGLSurfaceView(this);
setContentView(mGLView);
// Receive keyboard events
mGLView.setFocusableInTouchMode(true);
mGLView.setFocusable(true);
mGLView.requestFocus();
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
wakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, Globals.ApplicationName);
wakeLock.acquire();
}
@Override
protected void onPause() {
// TODO: if application pauses it's screen is messed up
if( wakeLock != null )
wakeLock.release();
super.onPause();
if( mGLView != null )
mGLView.onPause();
}
@Override
protected void onResume() {
if( wakeLock != null )
wakeLock.acquire();
super.onResume();
if( mGLView != null )
mGLView.onResume();
}
@Override
protected void onStop()
{
if( wakeLock != null )
wakeLock.release();
if( mAudioThread != null )
{
mAudioThread.interrupt();
try {
mAudioThread.join();
} catch( java.lang.InterruptedException e ) { };
}
if( mGLView != null )
mGLView.exitApp();
super.onStop();
finish();
}
@Override
public boolean onKeyDown(int keyCode, final KeyEvent event) {
// Overrides Back key to use in our app
if( mGLView != null )
mGLView.nativeKey( keyCode, 1 );
if( keyCode == KeyEvent.KEYCODE_BACK && !downloader.DownloadComplete )
onStop();
return true;
}
@Override
public boolean onKeyUp(int keyCode, final KeyEvent event) {
if( mGLView != null )
mGLView.nativeKey( keyCode, 0 );
return true;
}
private DemoGLSurfaceView mGLView = null;
private LoadLibrary mLoadLibraryStub = null;
private AudioThread mAudioThread = null;
private PowerManager.WakeLock wakeLock = null;
private DataDownloader downloader = null;
}