Skip to content

Instantly share code, notes, and snippets.

@yalab
Last active April 28, 2016 10:27
Show Gist options
  • Save yalab/837e8fc5e51d134e30db0542ce635058 to your computer and use it in GitHub Desktop.
Save yalab/837e8fc5e51d134e30db0542ce635058 to your computer and use it in GitHub Desktop.
#!/bin/bash
APP_NAME=$1
if [ -z "$APP_NAME" ];then
echo "Usage: create_cocos app_name"
exit 1
fi
COCOS="cocos2d-x/tools/cocos2d-console/bin/cocos"
COCOS_TEMPLATE="$(pwd)/cocos2d-x/tools/cocos2d-console/plugins/plugin_generate/bin-templates/cpp-template-default/res-portrait"
if [ ! -d "$COCOS_TEMPLATE" ];then
echo "You should install cocos frame work on Your Cocos"
exit 1
fi
GITIGNORE=`cat<<EOF
*.udf
*.apk
*.o
*.a
*.xcodeproj/*
!*.xcodeproj/project.pbxproj
!*.xcworkspace/contents.xcworkspacedata
**/*.xcodeproj/*
!**/*.xcodeproj/project.pbxproj
.DS_Store
.gradle
Thumbs.db
npm-debug.log
/bin
/proj.android/assets/
/proj.android/bin/
/proj.android/gen/
/proj.android/libs/armeabi
/proj.android/libs/google-play-services_lib
/proj.android/libs/library-debug.aar
/proj.android/local.properties
/proj.android-studio/assets/
/proj.android-studio/bin/
/proj.android-studio/gen/
/proj.android-studio/libs/armeabi
/proj.android-studio/libs/google-play-services_lib
/proj.android-studio/libs/library-debug.aar
/proj.android-studio/local.properties
/proj.android-studio/obj/
/proj.android-studio/obj/
/proj.android-studio/app/libs/armeabi/
/proj.android-studio/app/obj/
/cocos2d/cocos/platform/android/java/local.properties
/cocos2d/cocos/platform/android/libcocos2dx/build
/publish/
/proj.android/ant.properties
/proj.android/build
/proj.ios_mac/Pods
/cocos2d/build/build
/proj.ios_mac/build/
Breakpoints_v2.xcbkptlist
UserInterfaceState.xcuserstate
/Resources/*
!/Resources/Sounds
!/Resources/Particles
!/Resources/Fonts
!/Resources/Manifests
!/Resources/Animations
/.keystore
/Classes/EnvPrivate.h
/proj.android-studio/app/assets
EOF`
$COCOS new --portrait -l cpp -p "${APP_NAME}.oke-ya.com" $APP_NAME
cd $APP_NAME
echo "$GITIGNORE" >> .gitignore
cp -r ${COCOS_TEMPLATE}/* .
for f in $(ls HelloCpp*);do
mv $f $(echo $f | sed -e "s/HelloCpp/$APP_NAME/g")
done
git init
rm -rf cocos2d
cd ../cocos2d-x
git checkout v3
git pull
git checkout origin/v3.11
cd ../$APP_NAME
git submodule add --reference ../cocos2d-x [email protected]:cocos2d/cocos2d-x.git cocos2d
git lfs install
git lfs track '*.mp3'
git lfs track '*.png'
git add -A
git commit -m 'First commit'
git submodule add --reference ../PluginXProtocols [email protected]:yalab/PluginXProtocols.git Vendor/PluginXProtocols
git submodule add --reference ../PluginXGooglePlay [email protected]:yalab/PluginXGooglePlay.git Vendor/PluginXGooglePlay
git submodule add --reference ../PluginXIosIap [email protected]:yalab/PluginXIosIap.git Vendor/PluginXIosIap
git submodule add --reference ../openssl-android [email protected]:guardianproject/openssl-android.git Vendor/openssl-android
git submodule add --reference ../C2DXChartboost [email protected]:jesanchezgo/C2DXChartboost.git Vendor/C2DXChartboost
git submodule add --reference ../cocos2d-x-lib [email protected]:oke-ya/cocos2d-x-lib.git Vendor/lib
cp Vendor/lib/Env.h.sample Classes/Env.h
cp Vendor/lib/EnvPrivate.h.sample Classes/EnvPrivate.h
git add -A
git commit -m 'setup submodules'
IOS_DIFF=`cat<<EOF
diff --git a/proj.ios_mac/${APP_NAME}.xcodeproj/project.pbxproj b/proj.ios_mac/${APP_NAME}.xcodeproj/project.pbxproj
index c4a991a..4cc05a1 100644
--- a/proj.ios_mac/${APP_NAME}.xcodeproj/project.pbxproj
+++ b/proj.ios_mac/${APP_NAME}.xcodeproj/project.pbxproj
@@ -11,6 +11,20 @@
1AC6FB30180E99EB004C840B /* libcocos2d iOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AC6FB07180E9839004C840B /* libcocos2d iOS.a */; };
1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; };
+ 241546C71CD0CC7200C37E01 /* Alerm.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 241546B41CD0CC7200C37E01 /* Alerm.cpp */; };
+ 241546C81CD0CC7200C37E01 /* CentralClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 241546B71CD0CC7200C37E01 /* CentralClient.cpp */; };
+ 241546C91CD0CC7200C37E01 /* ConfirmBoard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 241546B91CD0CC7200C37E01 /* ConfirmBoard.cpp */; };
+ 241546CA1CD0CC7200C37E01 /* ListBoard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 241546BB1CD0CC7200C37E01 /* ListBoard.cpp */; };
+ 241546CB1CD0CC7200C37E01 /* PageBoard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 241546BE1CD0CC7200C37E01 /* PageBoard.cpp */; };
+ 241546CC1CD0CC7200C37E01 /* RestClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 241546C11CD0CC7200C37E01 /* RestClient.cpp */; };
+ 241546CD1CD0CC7200C37E01 /* Touchable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 241546C51CD0CC7200C37E01 /* Touchable.cpp */; };
+ 241546DC1CD0CEAD00C37E01 /* libPluginIAP.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 241546D91CD0CCFF00C37E01 /* libPluginIAP.a */; };
+ 241546DD1CD0CEB400C37E01 /* libPluginProtocol.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 241546D31CD0CCED00C37E01 /* libPluginProtocol.a */; };
+ 241546E11CD0D00F00C37E01 /* libcrypto.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 241546DE1CD0D00F00C37E01 /* libcrypto.a */; };
+ 241546E21CD0D00F00C37E01 /* libcurl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 241546DF1CD0D00F00C37E01 /* libcurl.a */; };
+ 241546E31CD0D00F00C37E01 /* libssl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 241546E01CD0D00F00C37E01 /* libssl.a */; };
+ 241546F11CD0DAAB00C37E01 /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 241546F01CD0DAAB00C37E01 /* MediaPlayer.framework */; };
+ 241546F31CD0DAB900C37E01 /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 241546F21CD0DAB900C37E01 /* GameController.framework */; };
288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765A40DF7441C002DB57D /* CoreGraphics.framework */; };
3EACC98F19EE6D4300EB3C5E /* res in Resources */ = {isa = PBXBuildFile; fileRef = 3EACC98E19EE6D4300EB3C5E /* res */; };
3EACC99019EE6D4300EB3C5E /* res in Resources */ = {isa = PBXBuildFile; fileRef = 3EACC98E19EE6D4300EB3C5E /* res */; };
@@ -100,6 +114,27 @@
remoteGlobalIDString = A07A4C241783777C0073F6A7;
remoteInfo = "cocos2dx iOS";
};
+ 241546B11CD0CBC200C37E01 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 1AC6FAE5180E9839004C840B /* cocos2d_libs.xcodeproj */;
+ proxyType = 2;
+ remoteGlobalIDString = 507B40FD1C31BDD30067B53E;
+ remoteInfo = "libcocos2d tvOS";
+ };
+ 241546D21CD0CCED00C37E01 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 241546CE1CD0CCEC00C37E01 /* PluginProtocol.xcodeproj */;
+ proxyType = 2;
+ remoteGlobalIDString = FA09A321168ADBC2008C1C7B;
+ remoteInfo = PluginProtocol;
+ };
+ 241546D81CD0CCFF00C37E01 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 241546D41CD0CCFE00C37E01 /* PluginIAP.xcodeproj */;
+ proxyType = 2;
+ remoteGlobalIDString = 05A9357E19260E2E00F08DC0;
+ remoteInfo = PluginIAP;
+ };
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
@@ -108,6 +143,34 @@
1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
1D6058910D05DD3D006BFB54 /* ${APP_NAME}-mobile.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "${APP_NAME}-mobile.app"; sourceTree = BUILT_PRODUCTS_DIR; };
1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
+ 241546B41CD0CC7200C37E01 /* Alerm.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Alerm.cpp; path = ../Vendor/lib/Alerm.cpp; sourceTree = "<group>"; };
+ 241546B51CD0CC7200C37E01 /* Alerm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Alerm.h; path = ../Vendor/lib/Alerm.h; sourceTree = "<group>"; };
+ 241546B61CD0CC7200C37E01 /* BaseScene.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BaseScene.h; path = ../Vendor/lib/BaseScene.h; sourceTree = "<group>"; };
+ 241546B71CD0CC7200C37E01 /* CentralClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CentralClient.cpp; path = ../Vendor/lib/CentralClient.cpp; sourceTree = "<group>"; };
+ 241546B81CD0CC7200C37E01 /* CentralClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CentralClient.h; path = ../Vendor/lib/CentralClient.h; sourceTree = "<group>"; };
+ 241546B91CD0CC7200C37E01 /* ConfirmBoard.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ConfirmBoard.cpp; path = ../Vendor/lib/ConfirmBoard.cpp; sourceTree = "<group>"; };
+ 241546BA1CD0CC7200C37E01 /* ConfirmBoard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ConfirmBoard.h; path = ../Vendor/lib/ConfirmBoard.h; sourceTree = "<group>"; };
+ 241546BB1CD0CC7200C37E01 /* ListBoard.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ListBoard.cpp; path = ../Vendor/lib/ListBoard.cpp; sourceTree = "<group>"; };
+ 241546BC1CD0CC7200C37E01 /* ListBoard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ListBoard.h; path = ../Vendor/lib/ListBoard.h; sourceTree = "<group>"; };
+ 241546BD1CD0CC7200C37E01 /* NonCopyable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NonCopyable.h; path = ../Vendor/lib/NonCopyable.h; sourceTree = "<group>"; };
+ 241546BE1CD0CC7200C37E01 /* PageBoard.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PageBoard.cpp; path = ../Vendor/lib/PageBoard.cpp; sourceTree = "<group>"; };
+ 241546BF1CD0CC7200C37E01 /* PageBoard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PageBoard.h; path = ../Vendor/lib/PageBoard.h; sourceTree = "<group>"; };
+ 241546C01CD0CC7200C37E01 /* PopUp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PopUp.h; path = ../Vendor/lib/PopUp.h; sourceTree = "<group>"; };
+ 241546C11CD0CC7200C37E01 /* RestClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RestClient.cpp; path = ../Vendor/lib/RestClient.cpp; sourceTree = "<group>"; };
+ 241546C21CD0CC7200C37E01 /* RestClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RestClient.h; path = ../Vendor/lib/RestClient.h; sourceTree = "<group>"; };
+ 241546C31CD0CC7200C37E01 /* scheme.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = scheme.h; path = ../Vendor/lib/scheme.h; sourceTree = "<group>"; };
+ 241546C41CD0CC7200C37E01 /* SupportFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SupportFunctions.h; path = ../Vendor/lib/SupportFunctions.h; sourceTree = "<group>"; };
+ 241546C51CD0CC7200C37E01 /* Touchable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Touchable.cpp; path = ../Vendor/lib/Touchable.cpp; sourceTree = "<group>"; };
+ 241546C61CD0CC7200C37E01 /* Touchable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Touchable.h; path = ../Vendor/lib/Touchable.h; sourceTree = "<group>"; };
+ 241546CE1CD0CCEC00C37E01 /* PluginProtocol.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = PluginProtocol.xcodeproj; path = ../Vendor/PluginXProtocols/proj.ios/PluginProtocol.xcodeproj; sourceTree = "<group>"; };
+ 241546D41CD0CCFE00C37E01 /* PluginIAP.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = PluginIAP.xcodeproj; path = ../Vendor/PluginXIosIap/proj.ios/PluginIAP.xcodeproj; sourceTree = "<group>"; };
+ 241546DA1CD0CD8A00C37E01 /* Env.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Env.h; sourceTree = "<group>"; };
+ 241546DB1CD0CDB400C37E01 /* EnvPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EnvPrivate.h; sourceTree = "<group>"; };
+ 241546DE1CD0D00F00C37E01 /* libcrypto.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcrypto.a; path = ../cocos2d/external/curl/prebuilt/ios/libcrypto.a; sourceTree = "<group>"; };
+ 241546DF1CD0D00F00C37E01 /* libcurl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcurl.a; path = ../cocos2d/external/curl/prebuilt/ios/libcurl.a; sourceTree = "<group>"; };
+ 241546E01CD0D00F00C37E01 /* libssl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libssl.a; path = ../cocos2d/external/curl/prebuilt/ios/libssl.a; sourceTree = "<group>"; };
+ 241546F01CD0DAAB00C37E01 /* MediaPlayer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MediaPlayer.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk/System/Library/Frameworks/MediaPlayer.framework; sourceTree = DEVELOPER_DIR; };
+ 241546F21CD0DAB900C37E01 /* GameController.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GameController.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk/System/Library/Frameworks/GameController.framework; sourceTree = DEVELOPER_DIR; };
288765A40DF7441C002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
3EACC98E19EE6D4300EB3C5E /* res */ = {isa = PBXFileReference; lastKnownFileType = folder; path = res; sourceTree = "<group>"; };
46880B7619C43A67006E1F66 /* CloseNormal.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = CloseNormal.png; sourceTree = "<group>"; };
@@ -170,6 +233,13 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ 241546F31CD0DAB900C37E01 /* GameController.framework in Frameworks */,
+ 241546F11CD0DAAB00C37E01 /* MediaPlayer.framework in Frameworks */,
+ 241546E11CD0D00F00C37E01 /* libcrypto.a in Frameworks */,
+ 241546E21CD0D00F00C37E01 /* libcurl.a in Frameworks */,
+ 241546E31CD0D00F00C37E01 /* libssl.a in Frameworks */,
+ 241546DD1CD0CEB400C37E01 /* libPluginProtocol.a in Frameworks */,
+ 241546DC1CD0CEAD00C37E01 /* libPluginIAP.a in Frameworks */,
ED545A7C1B68A1F400C3958E /* libiconv.dylib in Frameworks */,
52B47A471A53D09C004E4C60 /* Security.framework in Frameworks */,
1AC6FB30180E99EB004C840B /* libcocos2d iOS.a in Frameworks */,
@@ -237,6 +307,49 @@
children = (
1AC6FAF9180E9839004C840B /* libcocos2d Mac.a */,
1AC6FB07180E9839004C840B /* libcocos2d iOS.a */,
+ 241546B21CD0CBC200C37E01 /* libcocos2d tvOS.a */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 241546B31CD0CC4B00C37E01 /* lib */ = {
+ isa = PBXGroup;
+ children = (
+ 241546B41CD0CC7200C37E01 /* Alerm.cpp */,
+ 241546B51CD0CC7200C37E01 /* Alerm.h */,
+ 241546B61CD0CC7200C37E01 /* BaseScene.h */,
+ 241546B71CD0CC7200C37E01 /* CentralClient.cpp */,
+ 241546B81CD0CC7200C37E01 /* CentralClient.h */,
+ 241546B91CD0CC7200C37E01 /* ConfirmBoard.cpp */,
+ 241546BA1CD0CC7200C37E01 /* ConfirmBoard.h */,
+ 241546BB1CD0CC7200C37E01 /* ListBoard.cpp */,
+ 241546BC1CD0CC7200C37E01 /* ListBoard.h */,
+ 241546BD1CD0CC7200C37E01 /* NonCopyable.h */,
+ 241546BE1CD0CC7200C37E01 /* PageBoard.cpp */,
+ 241546BF1CD0CC7200C37E01 /* PageBoard.h */,
+ 241546C01CD0CC7200C37E01 /* PopUp.h */,
+ 241546C11CD0CC7200C37E01 /* RestClient.cpp */,
+ 241546C21CD0CC7200C37E01 /* RestClient.h */,
+ 241546C31CD0CC7200C37E01 /* scheme.h */,
+ 241546C41CD0CC7200C37E01 /* SupportFunctions.h */,
+ 241546C51CD0CC7200C37E01 /* Touchable.cpp */,
+ 241546C61CD0CC7200C37E01 /* Touchable.h */,
+ );
+ name = lib;
+ sourceTree = "<group>";
+ };
+ 241546CF1CD0CCEC00C37E01 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 241546D31CD0CCED00C37E01 /* libPluginProtocol.a */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 241546D51CD0CCFE00C37E01 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 241546D91CD0CCFF00C37E01 /* libPluginIAP.a */,
);
name = Products;
sourceTree = "<group>";
@@ -244,6 +357,9 @@
29B97314FDCFA39411CA2CEA /* CustomTemplate */ = {
isa = PBXGroup;
children = (
+ 241546D41CD0CCFE00C37E01 /* PluginIAP.xcodeproj */,
+ 241546CE1CD0CCEC00C37E01 /* PluginProtocol.xcodeproj */,
+ 241546B31CD0CC4B00C37E01 /* lib */,
46880B8319C43A87006E1F66 /* Classes */,
46880B7519C43A67006E1F66 /* Resources */,
1AC6FAE5180E9839004C840B /* cocos2d_libs.xcodeproj */,
@@ -258,6 +374,11 @@
29B97323FDCFA39411CA2CEA /* Frameworks */ = {
isa = PBXGroup;
children = (
+ 241546F21CD0DAB900C37E01 /* GameController.framework */,
+ 241546F01CD0DAAB00C37E01 /* MediaPlayer.framework */,
+ 241546DE1CD0D00F00C37E01 /* libcrypto.a */,
+ 241546DF1CD0D00F00C37E01 /* libcurl.a */,
+ 241546E01CD0D00F00C37E01 /* libssl.a */,
ED545A7D1B68A1FA00C3958E /* libiconv.dylib */,
ED545A7B1B68A1F400C3958E /* libiconv.dylib */,
8262943D1AAF051F00CB7CF7 /* Security.framework */,
@@ -297,6 +418,8 @@
46880B8319C43A87006E1F66 /* Classes */ = {
isa = PBXGroup;
children = (
+ 241546DB1CD0CDB400C37E01 /* EnvPrivate.h */,
+ 241546DA1CD0CD8A00C37E01 /* Env.h */,
46880B8419C43A87006E1F66 /* AppDelegate.cpp */,
46880B8519C43A87006E1F66 /* AppDelegate.h */,
46880B8619C43A87006E1F66 /* HelloWorldScene.cpp */,
@@ -417,6 +540,14 @@
ProductGroup = 1AC6FAE6180E9839004C840B /* Products */;
ProjectRef = 1AC6FAE5180E9839004C840B /* cocos2d_libs.xcodeproj */;
},
+ {
+ ProductGroup = 241546D51CD0CCFE00C37E01 /* Products */;
+ ProjectRef = 241546D41CD0CCFE00C37E01 /* PluginIAP.xcodeproj */;
+ },
+ {
+ ProductGroup = 241546CF1CD0CCEC00C37E01 /* Products */;
+ ProjectRef = 241546CE1CD0CCEC00C37E01 /* PluginProtocol.xcodeproj */;
+ },
);
projectRoot = "";
targets = (
@@ -441,6 +572,27 @@
remoteRef = 1AC6FB06180E9839004C840B /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
+ 241546B21CD0CBC200C37E01 /* libcocos2d tvOS.a */ = {
+ isa = PBXReferenceProxy;
+ fileType = archive.ar;
+ path = "libcocos2d tvOS.a";
+ remoteRef = 241546B11CD0CBC200C37E01 /* PBXContainerItemProxy */;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
+ 241546D31CD0CCED00C37E01 /* libPluginProtocol.a */ = {
+ isa = PBXReferenceProxy;
+ fileType = archive.ar;
+ path = libPluginProtocol.a;
+ remoteRef = 241546D21CD0CCED00C37E01 /* PBXContainerItemProxy */;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
+ 241546D91CD0CCFF00C37E01 /* libPluginIAP.a */ = {
+ isa = PBXReferenceProxy;
+ fileType = archive.ar;
+ path = libPluginIAP.a;
+ remoteRef = 241546D81CD0CCFF00C37E01 /* PBXContainerItemProxy */;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
/* End PBXReferenceProxy section */
/* Begin PBXResourcesBuildPhase section */
@@ -495,10 +647,17 @@
buildActionMask = 2147483647;
files = (
46880B8819C43A87006E1F66 /* AppDelegate.cpp in Sources */,
+ 241546C81CD0CC7200C37E01 /* CentralClient.cpp in Sources */,
46880B8A19C43A87006E1F66 /* HelloWorldScene.cpp in Sources */,
+ 241546CB1CD0CC7200C37E01 /* PageBoard.cpp in Sources */,
503AE10017EB989F00D1A890 /* AppController.mm in Sources */,
+ 241546CD1CD0CC7200C37E01 /* Touchable.cpp in Sources */,
+ 241546CA1CD0CC7200C37E01 /* ListBoard.cpp in Sources */,
+ 241546C71CD0CC7200C37E01 /* Alerm.cpp in Sources */,
503AE10217EB989F00D1A890 /* RootViewController.mm in Sources */,
503AE10117EB989F00D1A890 /* main.m in Sources */,
+ 241546CC1CD0CC7200C37E01 /* RestClient.cpp in Sources */,
+ 241546C91CD0CC7200C37E01 /* ConfirmBoard.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -532,6 +691,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
+ CLANG_CXX_LANGUAGE_STANDARD = "c++14";
CODE_SIGN_IDENTITY = "iPhone Developer";
COMPRESS_PNG_FILES = NO;
ENABLE_BITCODE = NO;
@@ -550,10 +710,13 @@
"\\$(inherited)",
"\\$(SRCROOT)/../cocos2d/cocos/platform/ios",
"\\$(SRCROOT)/../cocos2d/cocos/platform/ios/Simulation",
+ "\\$(SRCROOT)/../Vendor/PluginXProtocols/include",
+ "\\$(SRCROOT)/../cocos2d/external/curl/include/ios",
+ /opt/boxen/homebrew/Cellar/openssl/1.0.2e_1/include/,
);
INFOPLIST_FILE = ios/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
- LIBRARY_SEARCH_PATHS = "";
+ LIBRARY_SEARCH_PATHS = "\\$(SRCROOT)/../cocos2d/external/curl/prebuilt/ios";
OTHER_LDFLAGS = (
"$(_COCOS_LIB_IOS_BEGIN)",
"$(_COCOS_LIB_IOS_END)",
@@ -569,6 +732,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
+ CLANG_CXX_LANGUAGE_STANDARD = "c++14";
CODE_SIGN_IDENTITY = "iPhone Developer";
COMPRESS_PNG_FILES = NO;
ENABLE_BITCODE = NO;
@@ -585,10 +749,13 @@
"\\$(inherited)",
"\\$(SRCROOT)/../cocos2d/cocos/platform/ios",
"\\$(SRCROOT)/../cocos2d/cocos/platform/ios/Simulation",
+ "\\$(SRCROOT)/../Vendor/PluginXProtocols/include",
+ "\\$(SRCROOT)/../cocos2d/external/curl/include/ios",
+ /opt/boxen/homebrew/Cellar/openssl/1.0.2e_1/include/,
);
INFOPLIST_FILE = ios/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
- LIBRARY_SEARCH_PATHS = "";
+ LIBRARY_SEARCH_PATHS = "\\$(SRCROOT)/../cocos2d/external/curl/prebuilt/ios";
OTHER_LDFLAGS = (
"$(_COCOS_LIB_IOS_BEGIN)",
"$(_COCOS_LIB_IOS_END)",
diff --git a/proj.ios_mac/ios/Info.plist b/proj.ios_mac/ios/Info.plist
index 65ac67c..19f2c85 100644
--- a/proj.ios_mac/ios/Info.plist
+++ b/proj.ios_mac/ios/Info.plist
@@ -62,6 +62,22 @@
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
+ <key>NSAppTransportSecurity</key>
+ <dict>
+ <key>NSExceptionDomains</key>
+ <dict>
+ <key>localhost</key>
+ <dict>
+ <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
+ <true/>
+ </dict>
+ <key>yalab.example.com</key>
+ <dict>
+ <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
+ <true/>
+ </dict>
+ </dict>
+ </dict>
<key>UIAppFonts</key>
<array/>
<key>UIPrerenderedIcon</key>
EOF`
echo "$IOS_DIFF" > ios_diff.patch
patch -F3 -p1 < ios_diff.patch
rm ios_diff.patch
git add -A
git commit -m 'Setup for iOS'
ANDROID_DIFF=`cat<<EOF
diff --git a/proj.android-studio/app/AndroidManifest.xml b/proj.android-studio/app/AndroidManifest.xml
index 241b358..a924986 100644
--- a/proj.android-studio/app/AndroidManifest.xml
+++ b/proj.android-studio/app/AndroidManifest.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="${APP_NAME}.oke-ya.com"
+ package="${APP_NAME}.oke_ya.com"
android:installLocation="auto">
<uses-feature android:glEsVersion="0x00020000" />
diff --git a/proj.android-studio/app/build.gradle b/proj.android-studio/app/build.gradle
index 76d0fd9..db6977e 100644
--- a/proj.android-studio/app/build.gradle
+++ b/proj.android-studio/app/build.gradle
@@ -5,7 +5,7 @@ android {
buildToolsVersion "22.0.1"
defaultConfig {
- applicationId "${APP_NAME}.oke-ya.com"
+ applicationId "${APP_NAME}.oke_ya.com"
minSdkVersion 10
targetSdkVersion 22
versionCode 1
diff --git a/proj.android-studio/app/build.xml b/proj.android-studio/app/build.xml
new file mode 100644
index 0000000..bebc96f
--- /dev/null
+++ b/proj.android-studio/app/build.xml
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="AppActivity" 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" />
+
+ <!-- if sdk.dir was not set from one of the property file, then
+ get it from the ANDROID_HOME env var.
+ This must be done before we load project.properties since
+ the proguard config can use sdk.dir -->
+ <property environment="env" />
+ <condition property="sdk.dir" value="\\${env.ANDROID_HOME}">
+ <isset property="env.ANDROID_HOME" />
+ </condition>
+
+ <!-- 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 the ANDROID_HOME environment variable."
+ 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>
diff --git a/proj.android-studio/app/jni/Android.mk b/proj.android-studio/app/jni/Android.mk
index 9cded81..f8e6bd2 100644
--- a/proj.android-studio/app/jni/Android.mk
+++ b/proj.android-studio/app/jni/Android.mk
@@ -5,29 +5,45 @@ include \\$(CLEAR_VARS)
\\$(call import-add-path,\\$(LOCAL_PATH)/../../../cocos2d)
\\$(call import-add-path,\\$(LOCAL_PATH)/../../../cocos2d/external)
\\$(call import-add-path,\\$(LOCAL_PATH)/../../../cocos2d/cocos)
+\\$(call import-add-path,\\$(LOCAL_PATH)/../../../Vendor)
LOCAL_MODULE := cocos2dcpp_shared
-
LOCAL_MODULE_FILENAME := libcocos2dcpp
-LOCAL_SRC_FILES := hellocpp/main.cpp \
- ../../../Classes/AppDelegate.cpp \
- ../../../Classes/HelloWorldScene.cpp
+CPP_FILES := \\$(shell find \\$(LOCAL_PATH)/../../../Classes -name *.cpp | grep -v "\#")
+#CPP_FILES += \\$(shell find \\$(LOCAL_PATH)/../../../Vendor/C2DXChartboost/C2DXChartboost/android -name *.cpp)
+
+LOCAL_SRC_FILES := hellocpp/main.cpp
+LOCAL_SRC_FILES += \\$(CPP_FILES:\\$(LOCAL_PATH)/%=%)
LOCAL_C_INCLUDES := \\$(LOCAL_PATH)/../../../Classes
+LOCAL_C_INCLUDES += \\$(LOCAL_PATH)/../../../Classes/Common
+LOCAL_C_INCLUDES += \\$(LOCAL_PATH)/../../../Classes/scheme
+LOCAL_C_INCLUDES += \\$(LOCAL_PATH)/../../../cocos2d/cocos/ui
+LOCAL_C_INCLUDES += \\$(LOCAL_PATH)/../../../Vendor/lib
+LOCAL_C_INCLUDES += \\$(LOCAL_PATH)/../../../Vendor/C2DXChartboost/C2DXChartboost
+LOCAL_C_INCLUDES += \\$(LOCAL_PATH)/../../../Vendor/PluginXProtocols/include
+LOCAL_C_INCLUDES += \\$(LOCAL_PATH)/../../../Vendor/openssl-android/include
+LOCAL_C_INCLUDES += \\$(LOCAL_PATH)/../../../cocos2d/external/curl/include/android
+
# _COCOS_HEADER_ANDROID_BEGIN
# _COCOS_HEADER_ANDROID_END
LOCAL_STATIC_LIBRARIES := cocos2dx_static
+LOCAL_WHOLE_STATIC_LIBRARIES := PluginProtocolStatic
# _COCOS_LIB_ANDROID_BEGIN
# _COCOS_LIB_ANDROID_END
include \\$(BUILD_SHARED_LIBRARY)
-\\$(call import-module,.)
+\\$(call import-module,PluginXProtocols/proj.android/jni)
+\\$(call import-module,openssl-android)
+\\$(call import-module,curl/prebuilt/android)
+\\$(call import-module,cocos)
+
# _COCOS_LIB_IMPORT_ANDROID_BEGIN
# _COCOS_LIB_IMPORT_ANDROID_END
diff --git a/proj.android-studio/app/jni/Application.mk b/proj.android-studio/app/jni/Application.mk
index 07aa592..07fb26d 100644
--- a/proj.android-studio/app/jni/Application.mk
+++ b/proj.android-studio/app/jni/Application.mk
@@ -1,6 +1,7 @@
+NDK_TOOLCHAIN_VERSION=clang
APP_STL := gnustl_static
-APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char
+APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++14 -fsigned-char -DCC_USE_PHYSICS=1
APP_LDFLAGS := -latomic
diff --git a/proj.android-studio/app/jni/hellocpp/main.cpp b/proj.android-studio/app/jni/hellocpp/main.cpp
index 2c27096..557557f 100644
--- a/proj.android-studio/app/jni/hellocpp/main.cpp
+++ b/proj.android-studio/app/jni/hellocpp/main.cpp
@@ -3,6 +3,7 @@
#include "platform/android/jni/JniHelper.h"
#include <jni.h>
#include <android/log.h>
+#include "PluginJniHelper.h"
#define LOG_TAG "main"
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__)
@@ -12,4 +13,7 @@ using namespace cocos2d;
void cocos_android_app_init (JNIEnv* env) {
LOGD("cocos_android_app_init");
AppDelegate *pAppDelegate = new AppDelegate();
+ JavaVM* vm;
+ env->GetJavaVM(&vm);
+ PluginJniHelper::setJavaVM(vm);
}
diff --git a/proj.android-studio/app/local.properties b/proj.android-studio/app/local.properties
new file mode 100644
index 0000000..12a0114
--- /dev/null
+++ b/proj.android-studio/app/local.properties
@@ -0,0 +1,10 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must *NOT* be checked into Version Control Systems,
+# as it contains information specific to your local configuration.
+
+# location of the SDK. This is only used by Ant
+# For customization when using a Version Control System, please read the
+# header note.
+sdk.dir=/opt/android-sdk
diff --git a/proj.android-studio/app/proguard-project.txt b/proj.android-studio/app/proguard-project.txt
new file mode 100644
index 0000000..b429c50
--- /dev/null
+++ b/proj.android-studio/app/proguard-project.txt
@@ -0,0 +1,94 @@
+-dontwarn okio.**
+-optimizationpasses 5
+-dontusemixedcaseclassnames
+-dontskipnonpubliclibraryclasses
+-dontpreverify
+-verbose
+-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
+
+-keep public class * extends android.app.Activity
+-keep public class * extends android.app.Application
+-keep public class * extends android.app.Service
+-keep public class * extends android.content.BroadcastReceiver
+-keep public class * extends android.content.ContentProvider
+-keep public class * extends android.app.backup.BackupAgentHelper
+-keep public class * extends android.preference.Preference
+-keep public class com.android.vending.licensing.ILicensingService
+
+-keepclasseswithmembernames class * {
+ native <methods>;
+}
+
+-keepclasseswithmembers class * {
+ public <init>(android.content.Context, android.util.AttributeSet);
+}
+
+-keepclasseswithmembers class * {
+ public <init>(android.content.Context, android.util.AttributeSet, int);
+}
+
+-keepclassmembers class * extends android.app.Activity {
+ public void *(android.view.View);
+}
+
+-keepclassmembers enum * {
+ public static **[] values();
+ public static ** valueOf(java.lang.String);
+}
+
+# COCOS2D-X
+
+-keepclasseswithmembers public class org.cocos2dx.lib.** {
+ *;
+}
+
+-keepclasseswithmembers public class org.cocos2dx.plugin.** {
+ *;
+}
+
+-keepclassmembers public class com.chukong.cocosplay.client.** {
+ *;
+}
+
+# ADMOB
+-keep public class com.google.android.gms.ads.** {
+ public *;
+}
+
+-keep public class com.google.ads.** {
+ public *;
+}
+
+# GooglePlay IAP
+
+-keep class com.android.vending.billing.**
+
+
+# GooglePlayService
+
+-keep class * extends java.util.ListResourceBundle {
+ protected Object[][] getContents();
+}
+
+-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
+ public static final *** NULL;
+}
+
+-keepnames @com.google.android.gms.common.annotation.KeepName class *
+-keepclassmembernames class * {
+ @com.google.android.gms.common.annotation.KeepName *;
+}
+
+-keepnames class * implements android.os.Parcelable {
+ public static final ** CREATOR;
+}
+
+-keep class com.chartboost.** { *; }
+
+-keep class twitter4j.** { *; }
+-dontwarn twitter4j.management.**
+-dontwarn twitter4j.**
+-dontwarn oauth.signpost.jetty.HttpRequestAdapter
+-dontwarn org.cocos2dx.plugin.TwitterApp
+-dontwarn oauth.signpost.signature.OAuthMessageSigner
+-dontwarn oauth.signpost.jetty.JettyOAuthConsumer
EOF`
echo "$ANDROID_DIFF" > android_diff.patch
patch -F3 -p1 < android_diff.patch
rm android_diff.patch
git add -A
git commit -m 'Setup for Android'
cd cocos2d
./download-deps.py
cd ../
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment