move to AS
This commit is contained in:
1 parent
ec1d8a4332
commit
3f8caf2574
136 files changed
+3861
No files matched your search
+91
@@ -0,0 +1,91 @@
|
||||
package fishrungames.doublehitballs;
|
||||
|
||||
import fishrungames.salmonengineandroid.EngineWrapper;
|
||||
//Deprecated
|
||||
//import fishrungames.doublehitballs.R;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.PackageManager.NameNotFoundException;
|
||||
import android.os.Bundle;
|
||||
import android.view.GestureDetector;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.GestureDetector.SimpleOnGestureListener;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
//Deprecated
|
||||
//import java.lang.reflect.Field;
|
||||
|
||||
|
||||
public class GL2JNIActivity extends Activity
|
||||
{
|
||||
|
||||
GLView mView;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle icicle)
|
||||
{
|
||||
|
||||
super.onCreate(icicle);
|
||||
|
||||
EngineWrapper.LoadSalmonEngineLibrary();
|
||||
EngineWrapper.SetActivityInstance(this);
|
||||
EngineWrapper.SetupEnviroment();
|
||||
|
||||
String apkFilePath = null;
|
||||
ApplicationInfo appInfo = null;
|
||||
PackageManager packMgmr = this.getPackageManager();
|
||||
try {
|
||||
appInfo = packMgmr.getApplicationInfo("fishrungames.DoubleHitBalls", 0);
|
||||
} catch (NameNotFoundException e) {
|
||||
|
||||
e.printStackTrace();
|
||||
|
||||
throw new RuntimeException("Unable to locate assets, aborting...");
|
||||
}
|
||||
apkFilePath = appInfo.sourceDir;
|
||||
|
||||
EngineWrapper.SetupApkFilePath(apkFilePath);
|
||||
|
||||
mView = new GLView(getApplication());
|
||||
|
||||
setContentView(mView);
|
||||
|
||||
EngineWrapper.SetView(mView);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause()
|
||||
{
|
||||
EngineWrapper.CallDestroy();
|
||||
super.onPause();
|
||||
mView.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume()
|
||||
{
|
||||
super.onResume();
|
||||
mView.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop()
|
||||
{
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
public boolean onTouchEvent (MotionEvent event)
|
||||
{
|
||||
EngineWrapper.ProcessTouchEvent(event);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event)
|
||||
{
|
||||
EngineWrapper.ProcessKeyDown(keyCode, event);
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
package fishrungames.doublehitballs;
|
||||
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
import android.content.Context;
|
||||
import android.opengl.GLSurfaceView;
|
||||
|
||||
import javax.microedition.khronos.egl.EGLConfig;
|
||||
import javax.microedition.khronos.opengles.GL10;
|
||||
|
||||
import fishrungames.salmonengineandroid.GLViewAncestor;
|
||||
import fishrungames.salmonengineandroid.EngineWrapper;
|
||||
|
||||
class GLView extends GLViewAncestor
|
||||
{
|
||||
static long lastTimeStamp;
|
||||
static boolean gameIsInited = false;
|
||||
|
||||
public GLView(Context context)
|
||||
{
|
||||
//Change this method? Don't forget to change method below!
|
||||
super(context);
|
||||
init(false, 0, 0);
|
||||
}
|
||||
|
||||
public GLView(Context context, boolean translucent, int depth, int stencil)
|
||||
{
|
||||
//Change this method? Don't forget to change method above!
|
||||
super(context);
|
||||
init(translucent, depth, stencil);
|
||||
}
|
||||
|
||||
public void init(boolean translucent, int depth, int stencil)
|
||||
{
|
||||
super.init(translucent, depth, stencil);
|
||||
setRenderer(new Renderer());
|
||||
Calendar c = Calendar.getInstance();
|
||||
lastTimeStamp = c.getTimeInMillis();
|
||||
gameIsInited = true;
|
||||
}
|
||||
|
||||
private static class Renderer implements GLSurfaceView.Renderer
|
||||
{
|
||||
public void onDrawFrame(GL10 gl)
|
||||
{
|
||||
if (gameIsInited)
|
||||
{
|
||||
Calendar c = Calendar.getInstance();
|
||||
|
||||
long currentTimeStamp = c.getTimeInMillis();
|
||||
|
||||
EngineWrapper.Update(currentTimeStamp - lastTimeStamp);
|
||||
|
||||
lastTimeStamp = currentTimeStamp;
|
||||
}
|
||||
}
|
||||
|
||||
public void onSurfaceChanged(GL10 gl, int width, int height)
|
||||
{
|
||||
JniWrapper.Init(width,height);
|
||||
}
|
||||
|
||||
public void onSurfaceCreated(GL10 gl, EGLConfig config)
|
||||
{
|
||||
//Do nothing.
|
||||
}
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package fishrungames.doublehitballs;
|
||||
|
||||
public class JniWrapper
|
||||
{
|
||||
static {
|
||||
System.loadLibrary("DoubleHitBalls");
|
||||
}
|
||||
|
||||
|
||||
public static native void Init(int width, int height);
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user