prepare android project build

This commit is contained in:
artem.budarin committed 2018-08-01 13:31:24 +05:00
1 parent b726e55f94
commit fe73d7bec9
18 files changed
+580 -225

No files matched your search

@@ -1,21 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.fishrungames.crystalofrhylil">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
android:icon="@drawable/ic_menu_template" android:label="Crystal of Rhylil">
<activity android:name="MainActivity"
android:screenOrientation="landscape"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:launchMode="singleTask"
android:configChanges="orientation|keyboardHidden"
android:noHistory="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-feature android:glEsVersion="0x00020000"/>
</manifest>
@@ -0,0 +1,142 @@
package com.fishrungames.crystalofrhylil;
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.
}
}
}
//package com.fishrungames.crystalofrhylil;
//
//
//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;
//
//
//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();
//
// JniWrapper.Update(currentTimeStamp - lastTimeStamp);
//
// lastTimeStamp = currentTimeStamp;
// }
// }
//
// public void onSurfaceChanged(GL10 gl, int width, int height)
// {
//
//
// //JniWrapper.Destroy();
//
// JniWrapper.Init(width,height);
// }
//
// public void onSurfaceCreated(GL10 gl, EGLConfig config)
// {
// //Do nothing.
// }
// }
//}
@@ -0,0 +1,38 @@
package com.fishrungames.crystalofrhylil;
public class JniWrapper
{
static {
System.loadLibrary("CrystalOfRhylil");
}
public static native void Init(int width, int height);
}
//package com.fishrungames.crystalofrhylil;
//
//public class JniWrapper
//{
// static {
// //System.loadLibrary("gnustl_shared");
// //System.loadLibrary("HalibutEngine");
// System.loadLibrary("CrystalOfRhylilLib");
// }
//
//
// public static native void Init(int width, int height);
// public static native void Update(long dt);
// public static native void StopSounds();
// public static native void Destroy();
// public static native int IsInited();
// public static native void OnTapDown(float x, float y, long time);
// public static native void OnTapUp(float x, float y, long time);
// public static native void OnTapMove(float x, float y, long time);
//
// public static native void OnFling(float velocityX, float velocityY, long time);
// public static native void OnScroll(float distanceX, float distanceY, long time);
//
// public static native void OnKeyPress(int keyCode);
//}
@@ -1,26 +1,280 @@
package com.fishrungames.crystalofrhylil;
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.widget.TextView;
import android.view.GestureDetector;
import android.view.KeyEvent;
import android.view.GestureDetector.SimpleOnGestureListener;
import android.view.MotionEvent;
public class MainActivity extends Activity {
// Used to load the 'native-lib' library on application startup.
static {
System.loadLibrary("native-lib");
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//Deprecated
//import java.lang.reflect.Field;
}
public class MainActivity extends Activity
{
/**
* A native method that is implemented by the 'native-lib' native library,
* which is packaged with this application.
*/
public native String stringFromJNI();
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("com.fishrungames.crystalofrhylil", 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);
}
}
//package com.fishrungames.crystalofrhylil;
//
//
//
////Deprecated
////import fishrungames.crystalofrhylil.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.GestureDetector.SimpleOnGestureListener;
//import android.view.KeyEvent;
//import android.view.MotionEvent;
//
//import fishrungames.salmonengineandroid.EngineWrapper;
//
//
////Deprecated
////import java.lang.reflect.Field;
//
//
//public class MainActivity extends Activity
//{
//
// GLView mView;
//
// boolean IsScrolling = false;
//
// private GestureDetector gestureDetector;
//
// @Override
// protected void onCreate(Bundle icicle)
// {
// super.onCreate(icicle);
//
// gestureDetector = new GestureDetector(new MyGestureListener());
//
// EngineWrapper.LoadSalmonEngineLibrary();
// EngineWrapper.SetActivityInstance(this);
// EngineWrapper.SetupEnviroment();
///*
// * Deprecated
// *
// try
// {
// for (Field f : R.raw.class.getFields())
// {
// FileWrapper.AddToFileMap(f.getName(), f.getInt(null));
// }
//
//
// } catch (IllegalArgumentException e)
// {
// FileWrapper.ConsoleOut("IllegalArgumentException\n");
// onStop();
// } catch (IllegalAccessException e)
// {
// FileWrapper.ConsoleOut("IllegalAccessException\n");
// onStop();
// }
//*/
// mView = new GLView(getApplication());
//
// setContentView(mView);
//
// String apkFilePath = null;
// ApplicationInfo appInfo = null;
// PackageManager packMgmr = this.getPackageManager();
// try {
// appInfo = packMgmr.getApplicationInfo("com.fishrungames.crystalofrhylil", 0);
// } catch (NameNotFoundException e) {
//
// e.printStackTrace();
// throw new RuntimeException("Unable to locate assets, aborting...");
// }
// apkFilePath = appInfo.sourceDir;
//
// EngineWrapper.SetupApkFilePath(apkFilePath);
// //FileWrapper.ConsoleOut("Out of java\n");
//
// }
//
// @Override
// protected void onPause()
// {
// JniWrapper.Destroy();
// super.onPause();
// mView.onPause();
// }
//
// @Override
// protected void onResume()
// {
// //Don't write anything here!
// super.onResume();
// mView.onResume();
// }
//
// @Override
// protected void onStop()
// {
// //Don't write anything here!
// super.onStop();
// }
//
//
// public boolean onKeyDown(int keyCode, KeyEvent event)
// {
// int ascii_keycode = keyCode;
//
// if (keyCode == KeyEvent.KEYCODE_DEL)
// {
// ascii_keycode = 8; //Hack - getUnicodeChar does not recognize backspace
// }
// else
// {
// ascii_keycode = event.getUnicodeChar();
// }
//
// JniWrapper.OnKeyPress(ascii_keycode);
// return super.onKeyDown(keyCode, event);
// }
//
// public boolean onKeyUp(int keyCode, KeyEvent event)
// {
// return true;
// }
//
// public boolean onTouchEvent(MotionEvent event)
// {
// if (gestureDetector.onTouchEvent(event))
// {
// return true;
// }
//
// if (event.getAction() == MotionEvent.ACTION_UP)
// {
// float x = event.getX();
// float y = (float) mView.getHeight() - event.getY();
//
// if (IsScrolling)
// {
// IsScrolling = false;
// }
//
// JniWrapper.OnTapUp(x, y, event.getEventTime());
//
// }
// return true;
// }
//
// class MyGestureListener extends SimpleOnGestureListener
// {
//
// @Override
// public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
// float velocityY)
// {
// JniWrapper.OnFling(velocityX, velocityY, e2.getEventTime());
// return true;
// }
//
// public boolean onScroll(MotionEvent e1, MotionEvent e2,
// float distanceX, float distanceY)
// {
// JniWrapper.OnScroll(distanceX, distanceY, e2.getEventTime());
// IsScrolling = true;
// return true;
// }
//
// public boolean onDown(MotionEvent event)
// {
//
// float x = event.getX();
// float y = (float) mView.getHeight() - event.getY();
//
// JniWrapper.OnTapDown(x, y, event.getEventTime());
//
// return true;
// }
//
// }
//
//}
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB