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

+1
View File
@@ -0,0 +1 @@
/build
+100
View File
@@ -0,0 +1,100 @@
# Sets the minimum version of CMake required to build the native
# library. You should either keep the default value or only pass a
# value of 3.4.0 or lower.
cmake_minimum_required(VERSION 3.4.1)
# Creates and names a library, sets it as either STATIC
# or SHARED, and provides the relative paths to its source code.
# You can define multiple libraries, and CMake builds it for you.
# Gradle automatically packages shared libraries with your APK.
add_definitions(-DTARGET_ANDROID)
set(BOOST_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../boost_1_63_0)
set(BOOST_GIL_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/boost-gil-extension)
set(ZIP_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/julienr-libzip-android/jni)
set(LIBPNG_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/libpng_1.4.1_android)
set(LIBJPEG_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/jpeg-9")
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../../engine)
include_directories(${BOOST_PATH})
include_directories(${LIBPNG_PATH})
include_directories(${LIBJPEG_PATH})
include_directories(${ZIP_PATH})
include_directories(${BOOST_GIL_PATH})
add_library( engine
SHARED
IMPORTED )
set_target_properties( # Specifies the target library.
engine
# Specifies the parameter you want to define.
PROPERTIES IMPORTED_LOCATION
# Provides the path to the library you want to import.
${CMAKE_CURRENT_SOURCE_DIR}/build/intermediates/exploded-aar/proj.android-studio/SalmonEngineAndroid/unspecified/jni/${ANDROID_ABI}/libengine.so )
add_library( # Sets the name of the library.
DoubleHitBalls
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
# Associated headers in the same location as their source
# file are automatically included.
${CMAKE_CURRENT_SOURCE_DIR}/../../game/android_api.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../game/main_code.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../game/creditscode.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../game/gamecode.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../game/loadingcode.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../game/menucode.cpp
)
# Searches for a specified prebuilt library and stores the path as a
# variable. Because system libraries are included in the search path by
# default, you only need to specify the name of the public NDK library
# you want to add. CMake verifies that the library exists before
# completing its build.
find_library( # Sets the name of the path variable.
log-lib
# Specifies the name of the NDK library that
# you want CMake to locate.
log )
find_library( # Sets the name of the path variable.
GLESv2-lib
# Specifies the name of the NDK library that
# you want CMake to locate.
GLESv2 )
# Specifies libraries CMake should link to your target library. You
# can link multiple libraries, such as libraries you define in the
# build script, prebuilt third-party libraries, or system libraries.
target_link_libraries( # Specifies the target library.
DoubleHitBalls
# Links the target library to the log library
# included in the NDK.
${log-lib} ${GLESv2-lib} engine )
+46
View File
@@ -0,0 +1,46 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
defaultConfig {
applicationId "fishrungames.DoubleHitBalls"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
cppFlags "-std=c++11 -frtti -fexceptions -fsigned-char -Wno-c++11-narrowing"
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
sourceSets {
main {
assets.srcDirs = ['../../assets/']
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.1'
testCompile 'junit:junit:4.12'
compile project(':SalmonEngineAndroid')
}
+17
View File
@@ -0,0 +1,17 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in C:\Android\sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
@@ -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);
}
}