Productivity boost for cocos2d-x developers.
Avalon provides various extension, helpers, libraries, classes, templates & functions on top of cocos2d-x. It should speed up cross-platform development and automate annoying tasks.
- Checkout avalon to you project directory near
Classesfolder - Don't forget
git submodule update --init
- Add Avalon.xcodeproj to you project as subproject
- TODO: IMPORT COCOS2D-X PROJECT INTO WORKSPACE
- Add
LOCAL_WHOLE_STATIC_LIBRARIES += avalon_statictojni/Android.mk - Add
$(call import-module,../../avalon)tojni/Android.mk - Optional Declare additional features with
AVALON_FEATURES- available features AVALON_FEATURES := "gamecenter, payment, appirater, flurry, flurryads, notifications"
- Add GameCenter to
Build PhasesTarget Dependencies - Add libGameCenter.a to
Build PhasesLink Binary With Libraries - Add GameKit.framework to
Build PhasesLink Binary With Libraries
- Add
gamecentertoAVALON_FEATURESin yourjni/Android.mk
- Set
AVALON_PLATFORM_FLAVORtoamazonin yourjni/Android.mk - Import
GameCenterAmazonform /avalon/proj.android into work space - Add to Project->properties->Android->Library
GameCenterAmazon
-
Set
AVALON_PLATFORM_FLAVORtogooglein yourjni/Android.mk -
Import
GameCenterGoogleform /avalon/proj.android into work space -
Import
google-play-servicel_libform /avalon/proj.android into work space -
Add to Project->properties->Android->Library
GameCenterGoogle -
Create file
ids.xmlinproj.android/res/valuesfolder of you project with following content<?xml version="1.0" encoding="utf-8"?> <resources> <string name="app_id">50439291110</string> <string name="#Scrore1Name">#Score1Id</string> ... <string name="#Achievement1Name">#Achievement1Id</string> ... </resources> -
Ensure the internet permission in your
AndroidManifest.xml<uses-permission android:name="android.permission.INTERNET"/> -
Ensure the
applicationmeta-datain yourAndroidManifest.xml<application> ... <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> <meta-data android:name="com.google.android.gms.games.APP_ID" android:value="@string/app_id" /> ... </application>
- Add Payment to
Build PhasesTarget Dependencies - Add libPayment.a to
Build PhasesLink Binary With Libraries - Add StoreKit.framework to
Build PhasesLink Binary With Libraries
- Add
paymenttoAVALON_FEATURESin yourjni/Android.mk - Add android rsa key to resources
googleplay_rsa_key
-
Set
AVALON_PLATFORM_FLAVORtoamazonin yourjni/Android.mk -
Import
PaymentAmazonform /avalon/proj.android into work space -
Add to Project->properties->Android->Library
PaymentAmazon -
Ensure the internet permission in your
AndroidManifest.xml<uses-permission android:name="android.permission.INTERNET"/> -
Ensure the
applicationreceiverin yourAndroidManifest.xml<application> ... <receiver android:name="com.amazon.inapp.purchasing.ResponseReceiver" > <intent-filter> <action android:name="com.amazon.inapp.purchasing.NOTIFY" android:permission="com.amazon.inapp.purchasing.Permission.NOTIFY" /> </intent-filter> </receiver> ... </application>
-
Set
AVALON_PLATFORM_FLAVORtogooglein yourjni/Android.mk -
Import
PaymentGoogleform /avalon/proj.android into work space -
Add to Project->properties->Android->Library
PaymentGoogle -
Ensure following permissions in your
AndroidManifest.xml<uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="com.android.vending.BILLING"/>
- Add Appirater to
Build PhasesTarget Dependencies - Add libAppirater.a to
Build PhasesLink Binary With Libraries - Add StoreKit.framework to
Build PhasesLink Binary With Libraries - Add SystemConfiguration.framework to
Build PhasesLink Binary With Libraries
-
Add
appiratertoAVALON_FEATURESin yourjni/Android.mk -
Import
Appiraterform /avalon/proj.android into work space -
Add to Project->properties->Android->Library
Appirater -
Ensure the
ACCESS_NETWORK_STATEne permission in yourAndroidManifest.xml<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
- Add Flurry to
Build PhasesTarget Dependencies - Add libFlurry.a to
Build PhasesLink Binary With Libraries - Add SystemConfiguration.framework to
Build PhasesLink Binary With Libraries - Add Security.framework to
Build PhasesLink Binary With Libraries
-
Add
flurrytoAVALON_FEATURESin yourjni/Android.mk -
Import
Flurryform /avalon/proj.android into work space -
Add to Project->properties->Android->Library
Flurry -
Ensure the internet permission in your
AndroidManifest.xml<uses-permission android:name="android.permission.INTERNET"/>
- Add FlurryAds to
Build PhasesTarget Dependencies - Add libFlurryAds.a to
Build PhasesLink Binary With Libraries - Add AddSupport.framework to
Build PhasesLink Binary With Libraries - Add SystemConfiguration.framework to
Build PhasesLink Binary With Libraries - Add AddSupport.framework to
Build PhasesLink Binary With Libraries - Add Security.framework to
Build PhasesLink Binary With Libraries - Add MediaPlayer.framework to
Build PhasesLink Binary With Libraries
- Add
flurryAdstoAVALON_FEATURESin yourjni/Android.mk - Import
FlurryAdsform /avalon/proj.android into work space - Add to Project->properties->Android->Library
FlurryAds - Ensure the following activity configuration in your
AndroidManifest.xml
-
Add Notificatios to
Build PhasesTarget Dependencies -
Add libNotificatios.a to
Build PhasesLink Binary With Libraries -
Add
#import "avalon/platform/ios/notifications/NotificationsAppController.h"to yourAppController.h -
Subclass your AppController from NotificationsAppController
@interface AppController : NotificationsAppController
- Add
notificatiostoAVALON_FEATURESin yourjni/Android.mk - Import
Notificatiosform /avalon/proj.android into work space - Add to Project->properties->Android->Library
Notificatios
-
To restore local only notifications after reboot ensure following permissions in your
AndroidManifest.xml<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> -
Ensure the
applicationreceiversin yourAndroidManifest.xml<application> ... <receiver android:name="com.avalon.notifications.LocalNotificationsReceiver" /> <receiver android:name="com.avalon.notifications.LocalNotificationsRestore" > <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED" /> </intent-filter> </receiver> ... </application>
-
Ensure the
applicationmeta-datain yourAndroidManifest.xml<application> ... <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> ... </application> -
Ensure following permissions for remote notifications in your
AndroidManifest.xml<uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.GET_ACCOUNTS" /> <permission android:name="{package}.permission.C2D_MESSAGE" android:protectionLevel="signature" /> <uses-permission android:name="{package}.cpp.permission.C2D_MESSAGE" /> <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />where
{package}is you package name examplecom.google.example -
Ensure the
applicationreceiversin yourAndroidManifest.xml<application> ... <receiver android:name="com.avalon.notifications.GcmBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND" > <intent-filter> <!-- Receives the actual messages. --> <action android:name="com.google.android.c2dm.intent.RECEIVE" /> <category android:name="{package}" /> </intent-filter> </receiver> where `{package}` is you package name example `com.google.example` -
Add following code to main Activity
AppActivityvoid onCreate(final Bundle savedInstanceState) { ... Notifications.setContext(this); Notifications.processIntent(getIntent()); void onPause() { ... Notifications.onPause(); void onNewIntent(Intent intent) { Notifications.processIntent(intent); ...
- Add Firebase iOS to
Build PhasesTarget Dependencies - Add Firebasei iOS.a, libz.a, libsqlite3.a, StoreKit.framework, SystemConfiguration.framework to
Build PhasesLink Binary With Libraries - Add GoogleService-Info.plist to
Build PhasesCopy Bundle Resources - Use functions from Firebase.h
-
Add to
CmakeList.txtset(AVALON_FIREBASE ON CACHE BOOL "firebase") -
Add to build.gradle
buildscript { dependencies { classpath 'com.google.gms:google-services:3.1.1' // google-services plugin ... } ... } ... repositories { maven { url "https://maven.google.com" // Google's Maven repository ... } ... } -
Add to
settings.gradleinclude ':Firebase' project(':Firebase').projectDir = new File(settingsDir, '../avalon/proj.android-studio/Firebase') -
Add
app/build.gradledependencies { compile project(':Firebase') ... } -
Add
google-services.json -
Use functions from
Firebase.h(TBD: please clarify what functions will we use?)
The MIT License (MIT)
Copyright (c) 2014 Sergey Pereplitsa <non_2001@mail.ru>
Copyright (c) 2013 Michael Contento <michaelcontento@gmail.com>
Jochen Heizmann <info@intermediaware.de>
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.