mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 17:26:01 +08:00
Added Android example project. Thanks Luis Mende!
This commit is contained in:
parent
a624c637c7
commit
42564828d4
8
spine-cocos2dx/example/proj.android/.classpath
Normal file
8
spine-cocos2dx/example/proj.android/.classpath
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="gen"/>
|
||||
<classpathentry kind="output" path="bin/classes"/>
|
||||
</classpath>
|
||||
109
spine-cocos2dx/example/proj.android/.cproject
Normal file
109
spine-cocos2dx/example/proj.android/.cproject
Normal file
@ -0,0 +1,109 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
|
||||
<storageModule moduleId="org.eclipse.cdt.core.settings">
|
||||
<cconfiguration id="0.756827735">
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.756827735" moduleId="org.eclipse.cdt.core.settings" name="Default">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactName="${ProjName}" buildProperties="" description="" errorParsers="org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.VCErrorParser;org.eclipse.cdt.core.CWDLocator" id="0.756827735" name="Default" parent="org.eclipse.cdt.build.core.prefbase.cfg">
|
||||
<folderInfo id="0.756827735." name="/" resourcePath="">
|
||||
<toolChain errorParsers="" id="org.eclipse.cdt.build.core.prefbase.toolchain.294545719" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain">
|
||||
<targetPlatform id="org.eclipse.cdt.build.core.prefbase.toolchain.294545719.993860072" name=""/>
|
||||
<builder arguments="${ProjDirPath}/build_native.sh" buildPath="${ProjDirPath}" command="bash" enabledIncrementalBuild="true" errorParsers="org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.CWDLocator" id="org.eclipse.cdt.build.core.settings.default.builder.1648661634" incrementalBuildTarget="" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="false" stopOnErr="true" superClass="org.eclipse.cdt.build.core.settings.default.builder">
|
||||
<outputEntries>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="outputPath" name=""/>
|
||||
</outputEntries>
|
||||
</builder>
|
||||
<tool errorParsers="org.eclipse.cdt.core.VCErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GLDErrorParser" id="org.eclipse.cdt.build.core.settings.holder.libs.1844369373" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs">
|
||||
<option id="org.eclipse.cdt.build.core.settings.holder.libfiles.628519629" name="Library Files" superClass="org.eclipse.cdt.build.core.settings.holder.libfiles" valueType="libFiles">
|
||||
<listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="../libcocos2dx.a"/>
|
||||
</option>
|
||||
<option id="org.eclipse.cdt.build.core.settings.holder.libpaths.1705781501" name="Library Paths" superClass="org.eclipse.cdt.build.core.settings.holder.libpaths" valueType="libPaths">
|
||||
<listOptionValue builtIn="false" value="${NDK_ROOT}/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a"/>
|
||||
</option>
|
||||
</tool>
|
||||
<tool errorParsers="org.eclipse.cdt.core.VCErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GLDErrorParser" id="org.eclipse.cdt.build.core.settings.holder.991472034" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder">
|
||||
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.1413805376" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/jni""/>
|
||||
<listOptionValue builtIn="false" value="${NDK_ROOT}/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/lib/gcc/arm-linux-androideabi/4.4.3/include"/>
|
||||
<listOptionValue builtIn="false" value="${NDK_ROOT}/sources/cxx-stl/gnu-libstdc++/4.6/include"/>
|
||||
<listOptionValue builtIn="false" value="${NDK_ROOT}/sources/cxx-stl/system/include"/>
|
||||
<listOptionValue builtIn="false" value="${NDK_ROOT}/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include"/>
|
||||
<listOptionValue builtIn="false" value="${NDK_ROOT}/platforms/android-8/arch-arm/usr/include"/>
|
||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/../../cocos2dx""/>
|
||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/../../cocos2dx/include""/>
|
||||
</option>
|
||||
<option id="org.eclipse.cdt.build.core.settings.holder.symbols.1267721019" name="Symbols" superClass="org.eclipse.cdt.build.core.settings.holder.symbols" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="COCOS2DX_ROOT=${ProjDirPath}/../../../"/>
|
||||
</option>
|
||||
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1052916547" languageId="org.eclipse.cdt.core.assembly" languageName="Assembly" sourceContentType="org.eclipse.cdt.core.asmSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
|
||||
</tool>
|
||||
<tool errorParsers="org.eclipse.cdt.core.VCErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GLDErrorParser" id="org.eclipse.cdt.build.core.settings.holder.2035290044" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder">
|
||||
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.898748423" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value="${NDK_ROOT}/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/lib/gcc/arm-linux-androideabi/4.4.3/include"/>
|
||||
<listOptionValue builtIn="false" value="${ProjDirPath}/../../cocos2dx/include"/>
|
||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/jni""/>
|
||||
<listOptionValue builtIn="false" value="${ProjDirPath}/../../cocos2dx"/>
|
||||
<listOptionValue builtIn="false" value="${NDK_ROOT}/sources/cxx-stl/gnu-libstdc++/4.6/include"/>
|
||||
<listOptionValue builtIn="false" value="${NDK_ROOT}/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include"/>
|
||||
<listOptionValue builtIn="false" value="${NDK_ROOT}/sources/cxx-stl/stlport/stlport"/>
|
||||
<listOptionValue builtIn="false" value="${NDK_ROOT}/platforms/android-8/arch-arm/usr/include"/>
|
||||
</option>
|
||||
<option id="org.eclipse.cdt.build.core.settings.holder.symbols.1267721019" name="Symbols" superClass="org.eclipse.cdt.build.core.settings.holder.symbols" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="COCOS2DX_ROOT=${ProjDirPath}/../../../"/>
|
||||
</option>
|
||||
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.944632859" languageId="org.eclipse.cdt.core.g++" languageName="GNU C++" sourceContentType="org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
|
||||
</tool>
|
||||
<tool errorParsers="org.eclipse.cdt.core.VCErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GLDErrorParser" id="org.eclipse.cdt.build.core.settings.holder.731367497" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder">
|
||||
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.1548475709" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/jni""/>
|
||||
<listOptionValue builtIn="false" value="${ProjDirPath}/../../cocos2dx/include"/>
|
||||
<listOptionValue builtIn="false" value="${NDK_ROOT}/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/lib/gcc/arm-linux-androideabi/4.4.3/include"/>
|
||||
<listOptionValue builtIn="false" value="${ProjDirPath}/../../cocos2dx"/>
|
||||
<listOptionValue builtIn="false" value="${NDK_ROOT}/sources/cxx-stl/stlport/stlport"/>
|
||||
<listOptionValue builtIn="false" value="${NDK_ROOT}/platforms/android-8/arch-arm/usr/include"/>
|
||||
</option>
|
||||
<option id="org.eclipse.cdt.build.core.settings.holder.symbols.1267721019" name="Symbols" superClass="org.eclipse.cdt.build.core.settings.holder.symbols" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="COCOS2DX_ROOT=${ProjDirPath}/../../../"/>
|
||||
</option>
|
||||
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1615206779" languageId="org.eclipse.cdt.core.gcc" languageName="GNU C" sourceContentType="org.eclipse.cdt.core.cSource,org.eclipse.cdt.core.cHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
|
||||
</tool>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry excluding="cocos2dx|scripting|extensions|Classes" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="cocos2dx"/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="scripting"/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="extensions"/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Classes"/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
</cconfiguration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<project id="MyProject.null.190811507" name="MyProject"/>
|
||||
</storageModule>
|
||||
<storageModule moduleId="scannerConfiguration">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
<scannerConfigBuildInfo instanceId="0.756827735">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
</scannerConfigBuildInfo>
|
||||
</storageModule>
|
||||
<storageModule moduleId="refreshScope" versionNumber="1">
|
||||
<resource resourceType="PROJECT" workspacePath="/com.esotericsoftware.spinecocos2dx.SpineCocos2Dx"/>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||
</cproject>
|
||||
131
spine-cocos2dx/example/proj.android/.project
Normal file
131
spine-cocos2dx/example/proj.android/.project
Normal file
@ -0,0 +1,131 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>SpineCocos2Dx</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
||||
<triggers>clean,full,incremental,</triggers>
|
||||
<arguments>
|
||||
<dictionary>
|
||||
<key>?children?</key>
|
||||
<value>?name?=outputEntries\|?children?=?name?=entry\\\\\\\|\\\|\||</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>?name?</key>
|
||||
<value></value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.append_environment</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
|
||||
<value>all</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.buildArguments</key>
|
||||
<value>${ProjDirPath}/build_native.sh</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.buildCommand</key>
|
||||
<value>bash</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.buildLocation</key>
|
||||
<value>${ProjDirPath}</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
|
||||
<value>clean</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.contents</key>
|
||||
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
|
||||
<value>false</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
|
||||
<value></value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.stopOnError</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
|
||||
<value>false</value>
|
||||
</dictionary>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
|
||||
<triggers>full,incremental,</triggers>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||
<nature>org.eclipse.cdt.core.ccnature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
||||
</natures>
|
||||
<linkedResources>
|
||||
<link>
|
||||
<name>Classes</name>
|
||||
<type>2</type>
|
||||
<locationURI>COCOS2DX/projects/SpineCocos2Dx/Classes</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>cocos2dx</name>
|
||||
<type>2</type>
|
||||
<locationURI>COCOS2DX/cocos2dx</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>extensions</name>
|
||||
<type>2</type>
|
||||
<locationURI>COCOS2DX/extensions</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>scripting</name>
|
||||
<type>2</type>
|
||||
<locationURI>COCOS2DX/scripting</locationURI>
|
||||
</link>
|
||||
</linkedResources>
|
||||
</projectDescription>
|
||||
@ -0,0 +1,11 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
||||
30
spine-cocos2dx/example/proj.android/AndroidManifest.xml
Normal file
30
spine-cocos2dx/example/proj.android/AndroidManifest.xml
Normal file
@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.esotericsoftware.spinecocos2dx"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
|
||||
<uses-sdk android:minSdkVersion="8"/>
|
||||
<uses-feature android:glEsVersion="0x00020000" />
|
||||
|
||||
<application android:label="@string/app_name"
|
||||
android:icon="@drawable/icon">
|
||||
|
||||
<activity android:name=".SpineCocos2Dx"
|
||||
android:label="@string/app_name"
|
||||
android:screenOrientation="landscape"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
||||
android:configChanges="orientation">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
<supports-screens android:largeScreens="true"
|
||||
android:smallScreens="true"
|
||||
android:anyDensity="true"
|
||||
android:normalScreens="true"/>
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
</manifest>
|
||||
82
spine-cocos2dx/example/proj.android/README.md
Normal file
82
spine-cocos2dx/example/proj.android/README.md
Normal file
@ -0,0 +1,82 @@
|
||||
## Prerequisites:
|
||||
|
||||
* Android NDK
|
||||
* Android SDK **OR** Eclipse ADT Bundle
|
||||
* Android AVD target installed
|
||||
|
||||
## Building project
|
||||
|
||||
There are two ways of building Android projects.
|
||||
|
||||
1. Eclipse
|
||||
2. Command Line
|
||||
|
||||
### Import Project in Eclipse
|
||||
|
||||
#### Features:
|
||||
|
||||
1. Complete workflow from Eclipse, including:
|
||||
a. Build C++.
|
||||
b. Clean C++.
|
||||
c. Build and Run whole project.
|
||||
d. Logcat view.
|
||||
e. Debug Java code.
|
||||
f. Javascript editor.
|
||||
g. Project management.
|
||||
2. True C++ editing, including:
|
||||
a. Code completion.
|
||||
b. Jump to definition.
|
||||
c. Refactoring tools etc.
|
||||
d. Quick open C++ files.
|
||||
|
||||
|
||||
#### Setup Eclipse Environment
|
||||
|
||||
|
||||
**NOTE:** This step needs to be done only once to setup the Eclipse environment for cocos2d-x projects. Skip this section if you've done this before.
|
||||
|
||||
1. Download Eclipse ADT bundle from [Google](http://developer.android.com/sdk/index.html)
|
||||
|
||||
**OR**
|
||||
|
||||
Install Eclipse with Java. Add ADT and CDT plugins.
|
||||
|
||||
2. Set up Variables:
|
||||
1. Path Variable **COCOS2DX**:
|
||||
A. Eclipse->Preferences->General->Workspace->**Linked Resources**
|
||||
B. Click **New** button to add a Path Variable **COCOS2DX** pointing to the root cocos2d-x directory (Directory containing cocos2dx/ external/ tools/ scripting/ etc.).
|
||||
|
||||
2. C/C++ Environment Variable **NDK_ROOT**:
|
||||
A. Eclipse->Preferences->General->C/C++->Build->**Environment**.
|
||||
B. Click **Add** button and add a new variable **NDK_ROOT** pointing to the root NDK directory.
|
||||
|
||||
3. Import libcocos2dx library project:
|
||||
1. File->new->Project..->Android Project From Existing Code.
|
||||
2. Click **Browse** button and open cocos2d-x/cocos2dx/platform/android/java directory.
|
||||
3. Click **Finish** to add project.
|
||||
|
||||
|
||||
|
||||
#### Adding and running from Eclipse
|
||||
|
||||
|
||||
1. File->new->Project..->Android Project From Existing Code
|
||||
2. **Browse** to cocos2d-x/cocos2dx/projects/Name Of Project/proj.android/ directory.
|
||||
3. Add the project
|
||||
4. Click **Run** or **Debug** to compile C++ followed by Java and to run on connected device or emulator.
|
||||
|
||||
|
||||
### Running project from Command Line
|
||||
|
||||
1. `cd cocos2d-x/projects/Name Of Project/proj.android/`
|
||||
2. `export NDK_ROOT=/path/to/ndk`
|
||||
3. `./build_native.sh`
|
||||
4. `ant debug install`
|
||||
5. If step 4 results in sdk.dir missing error then follow step 6-8.
|
||||
6. `android list target`
|
||||
7. `android update project -p . -t (id from step 6)`
|
||||
8. `android update project -p cocos2d-x/cocos2dx/platform/android/java/ -t (id from step 6)`
|
||||
|
||||
|
||||
|
||||
|
||||
17
spine-cocos2dx/example/proj.android/ant.properties
Normal file
17
spine-cocos2dx/example/proj.android/ant.properties
Normal file
@ -0,0 +1,17 @@
|
||||
# This file is used to override default values used by the Ant build system.
|
||||
#
|
||||
# This file must be checked into Version Control Systems, as it is
|
||||
# integral to the build system of your project.
|
||||
|
||||
# This file is only used by the Ant script.
|
||||
|
||||
# You can use this to override default values such as
|
||||
# 'source.dir' for the location of your java source folder and
|
||||
# 'out.dir' for the location of your output folder.
|
||||
|
||||
# You can also use it define how the release builds are signed by declaring
|
||||
# the following properties:
|
||||
# 'key.store' for the location of your keystore and
|
||||
# 'key.alias' for the name of the key to use.
|
||||
# The password will be asked during the build when you use the 'release' target.
|
||||
|
||||
83
spine-cocos2dx/example/proj.android/build.xml
Normal file
83
spine-cocos2dx/example/proj.android/build.xml
Normal file
@ -0,0 +1,83 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="SpineCocos2Dx" default="help">
|
||||
|
||||
<!-- The local.properties file is created and updated by the 'android' tool.
|
||||
It contains the path to the SDK. It should *NOT* be checked into
|
||||
Version Control Systems. -->
|
||||
<property file="local.properties" />
|
||||
|
||||
<!-- The ant.properties file can be created by you. It is only edited by the
|
||||
'android' tool to add properties to it.
|
||||
This is the place to change some Ant specific build properties.
|
||||
Here are some properties you may want to change/update:
|
||||
|
||||
source.dir
|
||||
The name of the source directory. Default is 'src'.
|
||||
out.dir
|
||||
The name of the output directory. Default is 'bin'.
|
||||
|
||||
For other overridable properties, look at the beginning of the rules
|
||||
files in the SDK, at tools/ant/build.xml
|
||||
|
||||
Properties related to the SDK location or the project target should
|
||||
be updated using the 'android' tool with the 'update' action.
|
||||
|
||||
This file is an integral part of the build system for your
|
||||
application and should be checked into Version Control Systems.
|
||||
|
||||
-->
|
||||
<property file="ant.properties" />
|
||||
|
||||
<!-- The project.properties file is created and updated by the 'android'
|
||||
tool, as well as ADT.
|
||||
|
||||
This contains project specific properties such as project target, and library
|
||||
dependencies. Lower level build properties are stored in ant.properties
|
||||
(or in .classpath for Eclipse projects).
|
||||
|
||||
This file is an integral part of the build system for your
|
||||
application and should be checked into Version Control Systems. -->
|
||||
<loadproperties srcFile="project.properties" />
|
||||
|
||||
<!-- quick check on sdk.dir -->
|
||||
<fail
|
||||
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var"
|
||||
unless="sdk.dir"
|
||||
/>
|
||||
|
||||
<!--
|
||||
Import per project custom build rules if present at the root of the project.
|
||||
This is the place to put custom intermediary targets such as:
|
||||
-pre-build
|
||||
-pre-compile
|
||||
-post-compile (This is typically used for code obfuscation.
|
||||
Compiled code location: ${out.classes.absolute.dir}
|
||||
If this is not done in place, override ${out.dex.input.absolute.dir})
|
||||
-post-package
|
||||
-post-build
|
||||
-pre-clean
|
||||
-->
|
||||
<import file="custom_rules.xml" optional="true" />
|
||||
|
||||
<!-- Import the actual build file.
|
||||
|
||||
To customize existing targets, there are two options:
|
||||
- Customize only one target:
|
||||
- copy/paste the target into this file, *before* the
|
||||
<import> task.
|
||||
- customize it to your needs.
|
||||
- Customize the whole content of build.xml
|
||||
- copy/paste the content of the rules files (minus the top node)
|
||||
into this file, replacing the <import> task.
|
||||
- customize to your needs.
|
||||
|
||||
***********************
|
||||
****** IMPORTANT ******
|
||||
***********************
|
||||
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
|
||||
in order to avoid having your file be overridden by tools such as "android update project"
|
||||
-->
|
||||
<!-- version-tag: 1 -->
|
||||
<import file="${sdk.dir}/tools/ant/build.xml" />
|
||||
|
||||
</project>
|
||||
79
spine-cocos2dx/example/proj.android/build_native.sh
Normal file
79
spine-cocos2dx/example/proj.android/build_native.sh
Normal file
@ -0,0 +1,79 @@
|
||||
APPNAME="SpineCocos2Dx"
|
||||
|
||||
NDK_ROOT="[NDK PATH IN HERE]"
|
||||
|
||||
# options
|
||||
|
||||
buildexternalsfromsource=
|
||||
|
||||
usage(){
|
||||
cat << EOF
|
||||
usage: $0 [options]
|
||||
|
||||
Build C/C++ code for $APPNAME using Android NDK
|
||||
|
||||
OPTIONS:
|
||||
-s Build externals from source
|
||||
-h this help
|
||||
EOF
|
||||
}
|
||||
|
||||
while getopts "sh" OPTION; do
|
||||
case "$OPTION" in
|
||||
s)
|
||||
buildexternalsfromsource=1
|
||||
;;
|
||||
h)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# paths
|
||||
|
||||
if [ -z "${NDK_ROOT+aaa}" ];then
|
||||
echo "please define NDK_ROOT"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
# ... use paths relative to current directory
|
||||
COCOS2DX_ROOT="$DIR/../../../.."
|
||||
APP_ROOT="$DIR/.."
|
||||
APP_ANDROID_ROOT="$DIR"
|
||||
|
||||
echo "NDK_ROOT = $NDK_ROOT"
|
||||
echo "COCOS2DX_ROOT = $COCOS2DX_ROOT"
|
||||
echo "APP_ROOT = $APP_ROOT"
|
||||
echo "APP_ANDROID_ROOT = $APP_ANDROID_ROOT"
|
||||
|
||||
# make sure assets is exist
|
||||
if [ -d "$APP_ANDROID_ROOT"/assets ]; then
|
||||
rm -rf "$APP_ANDROID_ROOT"/assets
|
||||
fi
|
||||
|
||||
mkdir "$APP_ANDROID_ROOT"/assets
|
||||
|
||||
# copy resources
|
||||
for file in "$APP_ROOT"/Resources/*
|
||||
do
|
||||
if [ -d "$file" ]; then
|
||||
cp -rf "$file" "$APP_ANDROID_ROOT"/assets
|
||||
fi
|
||||
|
||||
if [ -f "$file" ]; then
|
||||
cp "$file" "$APP_ANDROID_ROOT"/assets
|
||||
fi
|
||||
done
|
||||
|
||||
# run ndk-build
|
||||
if [[ "$buildexternalsfromsource" ]]; then
|
||||
echo "Building external dependencies from source"
|
||||
"$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \
|
||||
"NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/source"
|
||||
else
|
||||
echo "Using prebuilt externals"
|
||||
"$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \
|
||||
"NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/prebuilt"
|
||||
fi
|
||||
38
spine-cocos2dx/example/proj.android/jni/Android.mk
Normal file
38
spine-cocos2dx/example/proj.android/jni/Android.mk
Normal file
@ -0,0 +1,38 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := cocos2dcpp_shared
|
||||
|
||||
LOCAL_MODULE_FILENAME := libcocos2dcpp
|
||||
|
||||
# Sources
|
||||
LOCAL_SRC_FILES := hellocpp/main.cpp \
|
||||
../../Classes/AppDelegate.cpp \
|
||||
../../Classes/ExampleLayer.cpp
|
||||
|
||||
SRC_LIST := $(wildcard $(LOCAL_PATH)/../../../../../spine-runtimes/spine-c/src/spine/*.c)
|
||||
LOCAL_SRC_FILES += $(SRC_LIST:$(LOCAL_PATH)/%=%)
|
||||
|
||||
SRC_LIST := $(wildcard $(LOCAL_PATH)/../../../../../spine-runtimes/spine-cocos2dx/src/spine/*.cpp)
|
||||
LOCAL_SRC_FILES += $(SRC_LIST:$(LOCAL_PATH)/%=%)
|
||||
|
||||
# Headers
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes \
|
||||
../../../../spine-runtimes/spine-c/include \
|
||||
../../../../spine-runtimes/spine-cocos2dx/src
|
||||
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES += cocos2dx_static
|
||||
#LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static
|
||||
#LOCAL_WHOLE_STATIC_LIBRARIES += box2d_static
|
||||
#LOCAL_WHOLE_STATIC_LIBRARIES += chipmunk_static
|
||||
#LOCAL_WHOLE_STATIC_LIBRARIES += cocos_extension_static
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
$(call import-module,cocos2dx)
|
||||
#$(call import-module,cocos2dx/platform/third_party/android/prebuilt/libcurl)
|
||||
#$(call import-module,CocosDenshion/android)
|
||||
#$(call import-module,extensions)
|
||||
#$(call import-module,external/Box2D)
|
||||
#$(call import-module,external/chipmunk)
|
||||
2
spine-cocos2dx/example/proj.android/jni/Application.mk
Normal file
2
spine-cocos2dx/example/proj.android/jni/Application.mk
Normal file
@ -0,0 +1,2 @@
|
||||
APP_STL := gnustl_static
|
||||
APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -DCOCOS2D_DEBUG=1
|
||||
45
spine-cocos2dx/example/proj.android/jni/hellocpp/main.cpp
Normal file
45
spine-cocos2dx/example/proj.android/jni/hellocpp/main.cpp
Normal file
@ -0,0 +1,45 @@
|
||||
#include "AppDelegate.h"
|
||||
#include "cocos2d.h"
|
||||
#include "CCEventType.h"
|
||||
#include "platform/android/jni/JniHelper.h"
|
||||
#include <jni.h>
|
||||
#include <android/log.h>
|
||||
|
||||
#define LOG_TAG "main"
|
||||
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__)
|
||||
|
||||
using namespace cocos2d;
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
||||
jint JNI_OnLoad(JavaVM *vm, void *reserved)
|
||||
{
|
||||
JniHelper::setJavaVM(vm);
|
||||
|
||||
return JNI_VERSION_1_4;
|
||||
}
|
||||
|
||||
void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thiz, jint w, jint h)
|
||||
{
|
||||
if (!CCDirector::sharedDirector()->getOpenGLView())
|
||||
{
|
||||
CCEGLView *view = CCEGLView::sharedOpenGLView();
|
||||
view->setFrameSize(w, h);
|
||||
|
||||
AppDelegate *pAppDelegate = new AppDelegate();
|
||||
CCApplication::sharedApplication()->run();
|
||||
}
|
||||
else
|
||||
{
|
||||
ccDrawInit();
|
||||
ccGLInvalidateStateCache();
|
||||
|
||||
CCShaderCache::sharedShaderCache()->reloadDefaultShaders();
|
||||
CCTextureCache::reloadAllTextures();
|
||||
CCNotificationCenter::sharedNotificationCenter()->postNotification(EVNET_COME_TO_FOREGROUND, NULL);
|
||||
CCDirector::sharedDirector()->setGLDefaultValues();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
20
spine-cocos2dx/example/proj.android/proguard-project.txt
Normal file
20
spine-cocos2dx/example/proj.android/proguard-project.txt
Normal file
@ -0,0 +1,20 @@
|
||||
# To enable ProGuard in your project, edit project.properties
|
||||
# to define the proguard.config property as described in that file.
|
||||
#
|
||||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in ${sdk.dir}/tools/proguard/proguard-android.txt
|
||||
# You can edit the include path and order by changing the ProGuard
|
||||
# include property in project.properties.
|
||||
#
|
||||
# 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 *;
|
||||
#}
|
||||
13
spine-cocos2dx/example/proj.android/project.properties
Normal file
13
spine-cocos2dx/example/proj.android/project.properties
Normal file
@ -0,0 +1,13 @@
|
||||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must be checked in Version Control Systems.
|
||||
#
|
||||
# To customize properties used by the Ant build system use,
|
||||
# "ant.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
|
||||
# Project target.
|
||||
target=android-8
|
||||
|
||||
android.library.reference.1=../../cocos2dx/platform/android/java
|
||||
BIN
spine-cocos2dx/example/proj.android/res/drawable-hdpi/icon.png
Normal file
BIN
spine-cocos2dx/example/proj.android/res/drawable-hdpi/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
BIN
spine-cocos2dx/example/proj.android/res/drawable-ldpi/icon.png
Normal file
BIN
spine-cocos2dx/example/proj.android/res/drawable-ldpi/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.2 KiB |
BIN
spine-cocos2dx/example/proj.android/res/drawable-mdpi/icon.png
Normal file
BIN
spine-cocos2dx/example/proj.android/res/drawable-mdpi/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.4 KiB |
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">SpineCocos2Dx</string>
|
||||
</resources>
|
||||
@ -0,0 +1,48 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2010-2011 cocos2d-x.org
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
package com.esotericsoftware.spinecocos2dx;
|
||||
|
||||
import org.cocos2dx.lib.Cocos2dxActivity;
|
||||
import org.cocos2dx.lib.Cocos2dxGLSurfaceView;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
public class SpineCocos2Dx extends Cocos2dxActivity{
|
||||
|
||||
protected void onCreate(Bundle savedInstanceState){
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
public Cocos2dxGLSurfaceView onCreateView() {
|
||||
Cocos2dxGLSurfaceView glSurfaceView = new Cocos2dxGLSurfaceView(this);
|
||||
// SpineCocos2Dx should create stencil buffer
|
||||
glSurfaceView.setEGLConfigChooser(5, 6, 5, 0, 16, 8);
|
||||
|
||||
return glSurfaceView;
|
||||
}
|
||||
|
||||
static {
|
||||
System.loadLibrary("cocos2dcpp");
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user