move to AS

This commit is contained in:
shakurov.airat committed 2017-01-10 17:43:06 +05:00
1 parent ec1d8a4332
commit 3f8caf2574
136 files changed
+3861

No files matched your search

@@ -0,0 +1,26 @@
package fishrungames.salmonandroidtemplate;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("fishrungames.salmonandroidtemplate", appContext.getPackageName());
}
}
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
**
** Copyright 2009, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="fishrungames.doublehitballs" android:versionCode="7" android:versionName="1.0.6">
<application
android:icon="@drawable/ic_menu_template" android:label="Double Hit Balls">
<activity android:name="GL2JNIActivity"
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"/>
<uses-sdk android:minSdkVersion="8"/>
</manifest>
@@ -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);
}
}
@@ -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.
}
}
}
@@ -0,0 +1,12 @@
package fishrungames.doublehitballs;
public class JniWrapper
{
static {
System.loadLibrary("DoubleHitBalls");
}
public static native void Init(int width, int height);
}
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

@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
**
** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->
<!-- This file contains resource definitions for displayed strings, allowing
them to be changed based on the locale and options. -->
<resources>
<!-- Simple strings. -->
<string name="gl2jni_activity">GL2JNI</string>
</resources>
@@ -0,0 +1,17 @@
package fishrungames.salmonandroidtemplate;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}