mirror of https://github.com/axmolengine/axmol.git
Add the base sample code for ads
This commit is contained in:
parent
d762283c9b
commit
78c1cb809e
|
@ -0,0 +1,50 @@
|
||||||
|
#include "AppDelegate.h"
|
||||||
|
#include "HelloWorldScene.h"
|
||||||
|
|
||||||
|
USING_NS_CC;
|
||||||
|
|
||||||
|
AppDelegate::AppDelegate() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
AppDelegate::~AppDelegate()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AppDelegate::applicationDidFinishLaunching() {
|
||||||
|
// initialize director
|
||||||
|
CCDirector* pDirector = CCDirector::sharedDirector();
|
||||||
|
CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();
|
||||||
|
|
||||||
|
pDirector->setOpenGLView(pEGLView);
|
||||||
|
|
||||||
|
// turn on display FPS
|
||||||
|
pDirector->setDisplayStats(true);
|
||||||
|
|
||||||
|
// set FPS. the default value is 1.0/60 if you don't call this
|
||||||
|
pDirector->setAnimationInterval(1.0 / 60);
|
||||||
|
|
||||||
|
// create a scene. it's an autorelease object
|
||||||
|
CCScene *pScene = HelloWorld::scene();
|
||||||
|
|
||||||
|
// run
|
||||||
|
pDirector->runWithScene(pScene);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This function will be called when the app is inactive. When comes a phone call,it's be invoked too
|
||||||
|
void AppDelegate::applicationDidEnterBackground() {
|
||||||
|
CCDirector::sharedDirector()->stopAnimation();
|
||||||
|
|
||||||
|
// if you use SimpleAudioEngine, it must be pause
|
||||||
|
// SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();
|
||||||
|
}
|
||||||
|
|
||||||
|
// this function will be called when the app is active again
|
||||||
|
void AppDelegate::applicationWillEnterForeground() {
|
||||||
|
CCDirector::sharedDirector()->startAnimation();
|
||||||
|
|
||||||
|
// if you use SimpleAudioEngine, it must resume here
|
||||||
|
// SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic();
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
#ifndef _APP_DELEGATE_H_
|
||||||
|
#define _APP_DELEGATE_H_
|
||||||
|
|
||||||
|
#include "cocos2d.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief The cocos2d Application.
|
||||||
|
|
||||||
|
The reason for implement as private inheritance is to hide some interface call by CCDirector.
|
||||||
|
*/
|
||||||
|
class AppDelegate : private cocos2d::CCApplication
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AppDelegate();
|
||||||
|
virtual ~AppDelegate();
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief Implement CCDirector and CCScene init code here.
|
||||||
|
@return true Initialize success, app continue.
|
||||||
|
@return false Initialize failed, app terminate.
|
||||||
|
*/
|
||||||
|
virtual bool applicationDidFinishLaunching();
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief The function be called when the application enter background
|
||||||
|
@param the pointer of the application
|
||||||
|
*/
|
||||||
|
virtual void applicationDidEnterBackground();
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief The function be called when the application enter foreground
|
||||||
|
@param the pointer of the application
|
||||||
|
*/
|
||||||
|
virtual void applicationWillEnterForeground();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _APP_DELEGATE_H_
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
#include "HelloWorldScene.h"
|
||||||
|
|
||||||
|
USING_NS_CC;
|
||||||
|
|
||||||
|
CCScene* HelloWorld::scene()
|
||||||
|
{
|
||||||
|
// 'scene' is an autorelease object
|
||||||
|
CCScene *scene = CCScene::create();
|
||||||
|
|
||||||
|
// 'layer' is an autorelease object
|
||||||
|
HelloWorld *layer = HelloWorld::create();
|
||||||
|
|
||||||
|
// add layer as a child to scene
|
||||||
|
scene->addChild(layer);
|
||||||
|
|
||||||
|
// return the scene
|
||||||
|
return scene;
|
||||||
|
}
|
||||||
|
|
||||||
|
// on "init" you need to initialize your instance
|
||||||
|
bool HelloWorld::init()
|
||||||
|
{
|
||||||
|
//////////////////////////////
|
||||||
|
// 1. super init first
|
||||||
|
if ( !CCLayer::init() )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();
|
||||||
|
CCPoint origin = CCDirector::sharedDirector()->getVisibleOrigin();
|
||||||
|
|
||||||
|
/////////////////////////////
|
||||||
|
// 2. add a menu item with "X" image, which is clicked to quit the program
|
||||||
|
// you may modify it.
|
||||||
|
|
||||||
|
// add a "close" icon to exit the progress. it's an autorelease object
|
||||||
|
CCMenuItemImage *pCloseItem = CCMenuItemImage::create(
|
||||||
|
"CloseNormal.png",
|
||||||
|
"CloseSelected.png",
|
||||||
|
this,
|
||||||
|
menu_selector(HelloWorld::menuCloseCallback));
|
||||||
|
|
||||||
|
pCloseItem->setPosition(ccp(origin.x + visibleSize.width - pCloseItem->getContentSize().width/2 ,
|
||||||
|
origin.y + pCloseItem->getContentSize().height/2));
|
||||||
|
|
||||||
|
// create menu, it's an autorelease object
|
||||||
|
CCMenu* pMenu = CCMenu::create(pCloseItem, NULL);
|
||||||
|
pMenu->setPosition(CCPointZero);
|
||||||
|
this->addChild(pMenu, 1);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void HelloWorld::menuCloseCallback(CCObject* pSender)
|
||||||
|
{
|
||||||
|
CCDirector::sharedDirector()->end();
|
||||||
|
|
||||||
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
|
||||||
|
exit(0);
|
||||||
|
#endif
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
#ifndef __HELLOWORLD_SCENE_H__
|
||||||
|
#define __HELLOWORLD_SCENE_H__
|
||||||
|
|
||||||
|
#include "cocos2d.h"
|
||||||
|
|
||||||
|
class HelloWorld : public cocos2d::CCLayer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone
|
||||||
|
virtual bool init();
|
||||||
|
|
||||||
|
// there's no 'id' in cpp, so we recommend returning the class instance pointer
|
||||||
|
static cocos2d::CCScene* scene();
|
||||||
|
|
||||||
|
// a selector callback
|
||||||
|
void menuCloseCallback(CCObject* pSender);
|
||||||
|
|
||||||
|
// implement the "static node()" method manually
|
||||||
|
CREATE_FUNC(HelloWorld);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // __HELLOWORLD_SCENE_H__
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="src" path="src"/>
|
||||||
|
<classpathentry kind="src" path="gen"/>
|
||||||
|
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
||||||
|
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
||||||
|
<classpathentry kind="output" path="bin/classes"/>
|
||||||
|
</classpath>
|
|
@ -0,0 +1,127 @@
|
||||||
|
<?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="${ProjDirPath}/../../../cocos2dx"/>
|
||||||
|
<listOptionValue builtIn="false" value="${ProjDirPath}/../../../cocos2dx/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"/>
|
||||||
|
</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>
|
||||||
|
<folderInfo id="0.756827735.107360087" name="/" resourcePath="cocos2dx">
|
||||||
|
<toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.2003331868" name="No ToolChain" superClass="org.eclipse.cdt.build.core.prefbase.toolchain" unusedChildren="">
|
||||||
|
<tool id="org.eclipse.cdt.build.core.settings.holder.libs.480884120" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs.1844369373"/>
|
||||||
|
<tool id="org.eclipse.cdt.build.core.settings.holder.251993802" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder.991472034">
|
||||||
|
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.274601766" 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 id="org.eclipse.cdt.build.core.settings.holder.2046837101" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder.2035290044">
|
||||||
|
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.505245606" 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 id="org.eclipse.cdt.build.core.settings.holder.495936265" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder.731367497">
|
||||||
|
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.852453988" 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="2">
|
||||||
|
<configuration configurationName="Default">
|
||||||
|
<resource resourceType="PROJECT" workspacePath="/HelloCpp"/>
|
||||||
|
</configuration>
|
||||||
|
</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>
|
|
@ -0,0 +1,131 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>HelloAds</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/plugin/samples/HelloAds/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,30 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="org.cocos2dx.HelloAds"
|
||||||
|
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=".HelloAds"
|
||||||
|
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>
|
|
@ -0,0 +1,87 @@
|
||||||
|
## 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:
|
||||||
|
* Build C++.
|
||||||
|
* Clean C++.
|
||||||
|
* Build and Run whole project.
|
||||||
|
* Logcat view.
|
||||||
|
* Debug Java code.
|
||||||
|
* Javascript editor.
|
||||||
|
* Project management.
|
||||||
|
2. True C++ editing, including:
|
||||||
|
* Code completion.
|
||||||
|
* Jump to definition.
|
||||||
|
* Refactoring tools etc.
|
||||||
|
* Quick open C++ files.
|
||||||
|
|
||||||
|
|
||||||
|
#### Setup Eclipse Environment (only once)
|
||||||
|
|
||||||
|
|
||||||
|
**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 ADT homepage](http://developer.android.com/sdk/index.html)
|
||||||
|
|
||||||
|
**OR**
|
||||||
|
|
||||||
|
Install Eclipse with Java. Add ADT and CDT plugins.
|
||||||
|
|
||||||
|
2. Only for Windows
|
||||||
|
1. Install [Cygwin](http://www.cygwin.com/) with make (select make package from the list during the install).
|
||||||
|
2. Add `Cygwin\bin` directory to system PATH variable.
|
||||||
|
3. Add this line `none /cygdrive cygdrive binary,noacl,posix=0,user 0 0` to `Cygwin\etc\fstab` file.
|
||||||
|
|
||||||
|
3. Set up Variables:
|
||||||
|
1. Path Variable `COCOS2DX`:
|
||||||
|
* Eclipse->Preferences->General->Workspace->**Linked Resources**
|
||||||
|
* Click **New** button to add a Path Variable `COCOS2DX` pointing to the root cocos2d-x directory.
|
||||||
|
![Example](https://lh5.googleusercontent.com/-oPpk9kg3e5w/UUOYlq8n7aI/AAAAAAAAsdQ/zLA4eghBH9U/s400/cocos2d-x-eclipse-vars.png)
|
||||||
|
|
||||||
|
2. C/C++ Environment Variable `NDK_ROOT`:
|
||||||
|
* Eclipse->Preferences->C/C++->Build->**Environment**.
|
||||||
|
* Click **Add** button and add a new variable `NDK_ROOT` pointing to the root NDK directory.
|
||||||
|
![Example](https://lh3.googleusercontent.com/-AVcY8IAT0_g/UUOYltoRobI/AAAAAAAAsdM/22D2J9u3sig/s400/cocos2d-x-eclipse-ndk.png)
|
||||||
|
* Only for Windows: Add new variables **CYGWIN** with value `nodosfilewarning` and **SHELLOPTS** with value `igncr`
|
||||||
|
|
||||||
|
4. 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
|
||||||
|
|
||||||
|
![Example](https://lh3.googleusercontent.com/-SLBOu6e3QbE/UUOcOXYaGqI/AAAAAAAAsdo/tYBY2SylOSM/s288/cocos2d-x-eclipse-project-from-code.png) ![Import](https://lh5.googleusercontent.com/-XzC9Pn65USc/UUOcOTAwizI/AAAAAAAAsdk/4b6YM-oim9Y/s400/cocos2d-x-eclipse-import-project.png)
|
||||||
|
|
||||||
|
1. File->New->Project->Android Project From Existing Code
|
||||||
|
2. **Browse** to your project directory. eg: `cocos2d-x/cocos2dx/samples/Cpp/TestCpp/proj.android/`
|
||||||
|
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
|
||||||
|
|
||||||
|
$ cd cocos2d-x/samples/Cpp/TestCpp/proj.android/
|
||||||
|
$ export NDK_ROOT=/path/to/ndk
|
||||||
|
$ ./build_native.sh
|
||||||
|
$ ant debug install
|
||||||
|
|
||||||
|
If the last command results in sdk.dir missing error then do:
|
||||||
|
|
||||||
|
$ android list target
|
||||||
|
$ android update project -p . -t (id from step 6)
|
||||||
|
$ android update project -p cocos2d-x/cocos2dx/platform/android/java/ -t (id from step 6)
|
|
@ -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.
|
||||||
|
|
|
@ -0,0 +1,83 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project name="HelloAds" 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>
|
|
@ -0,0 +1,78 @@
|
||||||
|
APPNAME="HelloAds"
|
||||||
|
|
||||||
|
# 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
|
||||||
|
PLUGIN_ROOT="$DIR/../../.."
|
||||||
|
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=${PLUGIN_ROOT}/publish:${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=${PLUGIN_ROOT}/publish:${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/prebuilt"
|
||||||
|
fi
|
|
@ -0,0 +1,28 @@
|
||||||
|
LOCAL_PATH := $(call my-dir)
|
||||||
|
|
||||||
|
include $(CLEAR_VARS)
|
||||||
|
|
||||||
|
LOCAL_MODULE := cocos2dcpp_shared
|
||||||
|
|
||||||
|
LOCAL_MODULE_FILENAME := libcocos2dcpp
|
||||||
|
|
||||||
|
LOCAL_SRC_FILES := hellocpp/main.cpp \
|
||||||
|
../../Classes/AppDelegate.cpp \
|
||||||
|
../../Classes/HelloWorldScene.cpp
|
||||||
|
|
||||||
|
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes
|
||||||
|
|
||||||
|
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)
|
|
@ -0,0 +1,2 @@
|
||||||
|
APP_STL := gnustl_static
|
||||||
|
APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -DCOCOS2D_DEBUG=1
|
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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 *;
|
||||||
|
#}
|
|
@ -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
|
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="app_name">HelloAds</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 org.cocos2dx.HelloAds;
|
||||||
|
|
||||||
|
import org.cocos2dx.lib.Cocos2dxActivity;
|
||||||
|
import org.cocos2dx.lib.Cocos2dxGLSurfaceView;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
public class HelloAds extends Cocos2dxActivity{
|
||||||
|
|
||||||
|
protected void onCreate(Bundle savedInstanceState){
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Cocos2dxGLSurfaceView onCreateView() {
|
||||||
|
Cocos2dxGLSurfaceView glSurfaceView = new Cocos2dxGLSurfaceView(this);
|
||||||
|
// HelloAds should create stencil buffer
|
||||||
|
glSurfaceView.setEGLConfigChooser(5, 6, 5, 0, 16, 8);
|
||||||
|
|
||||||
|
return glSurfaceView;
|
||||||
|
}
|
||||||
|
|
||||||
|
static {
|
||||||
|
System.loadLibrary("cocos2dcpp");
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue