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
Classes
folder - 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_static
tojni/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 Phases
Target Dependencies
- Add libGameCenter.a to
Build Phases
Link Binary With Libraries
- Add GameKit.framework to
Build Phases
Link Binary With Libraries
- Add
gamecenter
toAVALON_FEATURES
in yourjni/Android.mk
- Set
AVALON_PLATFORM_FLAVOR
toamazon
in yourjni/Android.mk
- Import
GameCenterAmazon
form /avalon/proj.android into work space - Add to Project->properties->Android->Library
GameCenterAmazon
-
Set
AVALON_PLATFORM_FLAVOR
togoogle
in yourjni/Android.mk
-
Import
GameCenterGoogle
form /avalon/proj.android into work space -
Import
google-play-servicel_lib
form /avalon/proj.android into work space -
Add to Project->properties->Android->Library
GameCenterGoogle
-
Create file
ids.xml
inproj.android/res/values
folder 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
application
meta-data
in 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 Phases
Target Dependencies
- Add libPayment.a to
Build Phases
Link Binary With Libraries
- Add StoreKit.framework to
Build Phases
Link Binary With Libraries
- Add
payment
toAVALON_FEATURES
in yourjni/Android.mk
- Add android rsa key to resources
googleplay_rsa_key
-
Set
AVALON_PLATFORM_FLAVOR
toamazon
in yourjni/Android.mk
-
Import
PaymentAmazon
form /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
application
receiver
in 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_FLAVOR
togoogle
in yourjni/Android.mk
-
Import
PaymentGoogle
form /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 Phases
Target Dependencies
- Add libAppirater.a to
Build Phases
Link Binary With Libraries
- Add StoreKit.framework to
Build Phases
Link Binary With Libraries
- Add SystemConfiguration.framework to
Build Phases
Link Binary With Libraries
-
Add
appirater
toAVALON_FEATURES
in yourjni/Android.mk
-
Import
Appirater
form /avalon/proj.android into work space -
Add to Project->properties->Android->Library
Appirater
-
Ensure the
ACCESS_NETWORK_STATE
ne permission in yourAndroidManifest.xml
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
- Add Flurry to
Build Phases
Target Dependencies
- Add libFlurry.a to
Build Phases
Link Binary With Libraries
- Add SystemConfiguration.framework to
Build Phases
Link Binary With Libraries
- Add Security.framework to
Build Phases
Link Binary With Libraries
-
Add
flurry
toAVALON_FEATURES
in yourjni/Android.mk
-
Import
Flurry
form /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 Phases
Target Dependencies
- Add libFlurryAds.a to
Build Phases
Link Binary With Libraries
- Add AddSupport.framework to
Build Phases
Link Binary With Libraries
- Add SystemConfiguration.framework to
Build Phases
Link Binary With Libraries
- Add AddSupport.framework to
Build Phases
Link Binary With Libraries
- Add Security.framework to
Build Phases
Link Binary With Libraries
- Add MediaPlayer.framework to
Build Phases
Link Binary With Libraries
- Add
flurryAds
toAVALON_FEATURES
in yourjni/Android.mk
- Import
FlurryAds
form /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 Phases
Target Dependencies
-
Add libNotificatios.a to
Build Phases
Link Binary With Libraries
-
Add
#import "avalon/platform/ios/notifications/NotificationsAppController.h"
to yourAppController.h
-
Subclass your AppController from NotificationsAppController
@interface AppController : NotificationsAppController
- Add
notificatios
toAVALON_FEATURES
in yourjni/Android.mk
- Import
Notificatios
form /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
application
receivers
in 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
application
meta-data
in 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
application
receivers
in 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
AppActivity
void 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 Phases
Target Dependencies
- Add Firebasei iOS.a, libz.a, libsqlite3.a, StoreKit.framework, SystemConfiguration.framework to
Build Phases
Link Binary With Libraries
- Add GoogleService-Info.plist to
Build Phases
Copy Bundle Resources
- Use functions from Firebase.h
-
Add to
CmakeList.txt
set(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.gradle
include ':Firebase' project(':Firebase').projectDir = new File(settingsDir, '../avalon/proj.android-studio/Firebase')
-
Add
app/build.gradle
dependencies { 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 <[email protected]>
Copyright (c) 2013 Michael Contento <[email protected]>
Jochen Heizmann <[email protected]>
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.