Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@ gdbserver
.settings

# IntelliJ / Android Studio:
idea/workspace.xml
idea/tasks.xml
idea
*.iml

# Crashlytics
res/values/com_crashlytics_export_strings.xml

# build
build
10 changes: 0 additions & 10 deletions README.md

This file was deleted.

100 changes: 100 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-beta2'
}
}
apply plugin: 'com.android.library'

repositories {
jcenter()
}

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"

sourceSets.main.jni.srcDirs = [] //disable automatic ndk-build call
sourceSets.main {
jniLibs.srcDirs = ['src/main/libs']
}

defaultConfig {
minSdkVersion 9
targetSdkVersion 21
versionCode 1
versionName "1.0"
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_6
targetCompatibility JavaVersion.VERSION_1_6
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile fileTree(dir: "$buildDir/native-libs", include: 'native-libs.jar')
compile project (':andengine')
}

/**
* Задача в которой мы вызываем скрипт ndk-build для компиляции native исходников
* скрипт вызывается как команда из командной строки:
* path/to/ndk-build path/to/source/project/root
*
* До ndk-build путь абсолютный, берем из локальных настроек
* До корневой папки проекта указываем путь относительно build.gradle
*/
task('compileNative') {
def $ndkBuildScript = //путь то файла ndk-build (linux) / ndk-build.cmd (windows) относительно корня ndk
System.properties['os.name'].toLowerCase().contains('windows') ?
'ndk-build.cmd' :
'ndk-build'
def $ndkProjectRootFolder = 'src/main'
def $ndkDirPropertyName = 'ndk.dir' // Имя свойства пути до NDK в настройках
def $ndkDir = System.getenv('NDK_HOME')

// переменная для хранения настроек
Properties properties = new Properties()
def propFile = project.rootProject.file('local.properties');
// загружаем файл с настройками проекта
if(propFile.exists()) {
properties.load(propFile.newDataInputStream())
// получаем путь до корневой директории ndk
$ndkDir = properties.getProperty($ndkDirPropertyName)
}

// если не установлен то посоветуем это сделать в локальных настройках
if( $ndkDir == null)
throw new RuntimeException("Property 'ndk.dir' not found. Please specify it. \n" +
" It must be something like this in your local.properties file \n" +
" ndk.dir=path/to/your/ndk")

// вызываем на выполнение скрипт для компиляции native исходников
exec {
executable = $ndkDir + '/' + $ndkBuildScript
args = ["NDK_PROJECT_PATH=" + $ndkProjectRootFolder]
}

}

task nativeLibsToJar(type: Zip, description: 'create a jar archive of the native libs', dependsOn: 'compileNative') {
destinationDir file("$buildDir/native-libs")
baseName 'native-libs'
extension 'jar'
from fileTree(dir: 'jniLibs', include: '**/*.so')
into 'lib/'
}

tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn(nativeLibsToJar)
}
85 changes: 0 additions & 85 deletions build.xml

This file was deleted.

Binary file not shown.
Binary file removed libs/armeabi/libandenginephysicsbox2dextension.so
Binary file not shown.
Binary file removed libs/x86/libandenginephysicsbox2dextension.so
Binary file not shown.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.andengine.extension.physics.box2d;

import org.andengine.engine.handler.IUpdateHandler;
import org.andengine.entity.shape.IAreaShape;
import org.andengine.entity.shape.IShape;
import org.andengine.entity.shape.IShape;
import org.andengine.extension.physics.box2d.util.constants.PhysicsConstants;
import org.andengine.util.math.MathUtils;
Expand Down Expand Up @@ -39,19 +39,19 @@ public class PhysicsConnector implements IUpdateHandler, PhysicsConstants {
// Constructors
// ===========================================================

public PhysicsConnector(final IAreaShape pAreaShape, final Body pBody) {
public PhysicsConnector(final IShape pAreaShape, final Body pBody) {
this(pAreaShape, pBody, true, true);
}

public PhysicsConnector(final IAreaShape pAreaShape, final Body pBody, final float pPixelToMeterRatio) {
public PhysicsConnector(final IShape pAreaShape, final Body pBody, final float pPixelToMeterRatio) {
this(pAreaShape, pBody, true, true, pPixelToMeterRatio);
}

public PhysicsConnector(final IAreaShape pAreaShape, final Body pBody, final boolean pUdatePosition, final boolean pUpdateRotation) {
public PhysicsConnector(final IShape pAreaShape, final Body pBody, final boolean pUdatePosition, final boolean pUpdateRotation) {
this(pAreaShape, pBody, pUdatePosition, pUpdateRotation, PIXEL_TO_METER_RATIO_DEFAULT);
}

public PhysicsConnector(final IAreaShape pAreaShape, final Body pBody, final boolean pUdatePosition, final boolean pUpdateRotation, final float pPixelToMeterRatio) {
public PhysicsConnector(final IShape pAreaShape, final Body pBody, final boolean pUdatePosition, final boolean pUpdateRotation, final float pPixelToMeterRatio) {
this.mShape = pAreaShape;
this.mBody = pBody;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import java.util.List;

import org.andengine.entity.primitive.Line;
import org.andengine.entity.shape.IAreaShape;
import org.andengine.entity.shape.IShape;
import org.andengine.entity.shape.IShape;
import org.andengine.extension.physics.box2d.util.constants.PhysicsConstants;
import org.andengine.util.Constants;
Expand Down Expand Up @@ -76,11 +76,11 @@ public static FixtureDef createFixtureDef(final float pDensity, final float pEla
return fixtureDef;
}

public static Body createBoxBody(final PhysicsWorld pPhysicsWorld, final IAreaShape pAreaShape, final BodyType pBodyType, final FixtureDef pFixtureDef) {
public static Body createBoxBody(final PhysicsWorld pPhysicsWorld, final IShape pAreaShape, final BodyType pBodyType, final FixtureDef pFixtureDef) {
return PhysicsFactory.createBoxBody(pPhysicsWorld, pAreaShape, pBodyType, pFixtureDef, PIXEL_TO_METER_RATIO_DEFAULT);
}

public static Body createBoxBody(final PhysicsWorld pPhysicsWorld, final IAreaShape pAreaShape, final BodyType pBodyType, final FixtureDef pFixtureDef, final float pPixelToMeterRatio) {
public static Body createBoxBody(final PhysicsWorld pPhysicsWorld, final IShape pAreaShape, final BodyType pBodyType, final FixtureDef pFixtureDef, final float pPixelToMeterRatio) {
final float[] sceneCenterCoordinates = pAreaShape.getSceneCenterCoordinates();
final float centerX = sceneCenterCoordinates[Constants.VERTEX_INDEX_X];
final float centerY = sceneCenterCoordinates[Constants.VERTEX_INDEX_Y];
Expand Down Expand Up @@ -125,11 +125,11 @@ public static Body createBoxBody(final PhysicsWorld pPhysicsWorld, final float p
return boxBody;
}

public static Body createCircleBody(final PhysicsWorld pPhysicsWorld, final IAreaShape pAreaShape, final BodyType pBodyType, final FixtureDef pFixtureDef) {
public static Body createCircleBody(final PhysicsWorld pPhysicsWorld, final IShape pAreaShape, final BodyType pBodyType, final FixtureDef pFixtureDef) {
return PhysicsFactory.createCircleBody(pPhysicsWorld, pAreaShape, pBodyType, pFixtureDef, PIXEL_TO_METER_RATIO_DEFAULT);
}

public static Body createCircleBody(final PhysicsWorld pPhysicsWorld, final IAreaShape pAreaShape, final BodyType pBodyType, final FixtureDef pFixtureDef, final float pPixelToMeterRatio) {
public static Body createCircleBody(final PhysicsWorld pPhysicsWorld, final IShape pAreaShape, final BodyType pBodyType, final FixtureDef pFixtureDef, final float pPixelToMeterRatio) {
final float[] sceneCenterCoordinates = pAreaShape.getSceneCenterCoordinates();
final float centerX = sceneCenterCoordinates[Constants.VERTEX_INDEX_X];
final float centerY = sceneCenterCoordinates[Constants.VERTEX_INDEX_Y];
Expand Down Expand Up @@ -177,11 +177,11 @@ public static Body createLineBody(final PhysicsWorld pPhysicsWorld, final Line p
}

public static Body createLineBody(final PhysicsWorld pPhysicsWorld, final Line pLine, final FixtureDef pFixtureDef, final float pPixelToMeterRatio) {
final float[] sceneCoordinates = pLine.convertLocalToSceneCoordinates(0, 0);
final float[] sceneCoordinates = pLine.convertLocalCoordinatesToSceneCoordinates(0, 0);
final float x1 = sceneCoordinates[Constants.VERTEX_INDEX_X];
final float y1 = sceneCoordinates[Constants.VERTEX_INDEX_Y];

pLine.convertLocalToSceneCoordinates(pLine.getX2() - pLine.getX1(), pLine.getY2() - pLine.getY1());
pLine.convertLocalCoordinatesToSceneCoordinates(pLine.getX2() - pLine.getX1(), pLine.getY2() - pLine.getY1());
final float x2 = sceneCoordinates[Constants.VERTEX_INDEX_X];
final float y2 = sceneCoordinates[Constants.VERTEX_INDEX_Y];

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions src/main/obj/local/armeabi-v7a/libstdc++.a
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!<arch>
Binary file not shown.
Loading