Skip to content

newnon/avalon

 
 

Repository files navigation

Avalon

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.

Installation

General

  1. Checkout avalon to you project directory near Classes folder
  2. Don't forget git submodule update --init

iOS

  1. Add Avalon.xcodeproj to you project as subproject

Android

  1. TODO: IMPORT COCOS2D-X PROJECT INTO WORKSPACE
  2. Add LOCAL_WHOLE_STATIC_LIBRARIES += avalon_static to jni/Android.mk
  3. Add $(call import-module,../../avalon) to jni/Android.mk
  4. Optional Declare additional features with AVALON_FEATURES
    • available features AVALON_FEATURES := "gamecenter, payment, appirater, flurry, flurryads, notifications"

Features

Game Center

Ios
  1. Add GameCenter to Build Phases Target Dependencies
  2. Add libGameCenter.a to Build Phases Link Binary With Libraries
  3. Add GameKit.framework to Build Phases Link Binary With Libraries
Android
  1. Add gamecenter to AVALON_FEATURES in your jni/Android.mk
Amazon
  1. Set AVALON_PLATFORM_FLAVOR to amazon in your jni/Android.mk
  2. Import GameCenterAmazon form /avalon/proj.android into work space
  3. Add to Project->properties->Android->Library GameCenterAmazon
Google
  1. Set AVALON_PLATFORM_FLAVOR to google in your jni/Android.mk

  2. Import GameCenterGoogle form /avalon/proj.android into work space

  3. Import google-play-servicel_lib form /avalon/proj.android into work space

  4. Add to Project->properties->Android->Library GameCenterGoogle

  5. Create file ids.xml in proj.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> 
    
  6. Ensure the internet permission in your AndroidManifest.xml

     <uses-permission android:name="android.permission.INTERNET"/>
    
  7. Ensure the application meta-data in your AndroidManifest.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>        
    

Payment

Ios
  1. Add Payment to Build Phases Target Dependencies
  2. Add libPayment.a to Build Phases Link Binary With Libraries
  3. Add StoreKit.framework to Build Phases Link Binary With Libraries
Android
  1. Add payment to AVALON_FEATURES in your jni/Android.mk
  2. Add android rsa key to resources googleplay_rsa_key
Amazon
  1. Set AVALON_PLATFORM_FLAVOR to amazon in your jni/Android.mk

  2. Import PaymentAmazon form /avalon/proj.android into work space

  3. Add to Project->properties->Android->Library PaymentAmazon

  4. Ensure the internet permission in your AndroidManifest.xml

     <uses-permission android:name="android.permission.INTERNET"/>
    
  5. Ensure the application receiver in your AndroidManifest.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>
    
Google
  1. Set AVALON_PLATFORM_FLAVOR to google in your jni/Android.mk

  2. Import PaymentGoogle form /avalon/proj.android into work space

  3. Add to Project->properties->Android->Library PaymentGoogle

  4. Ensure following permissions in your AndroidManifest.xml

     <uses-permission android:name="android.permission.INTERNET"/>
     <uses-permission android:name="com.android.vending.BILLING"/>
    

Appirater

Ios
  1. Add Appirater to Build Phases Target Dependencies
  2. Add libAppirater.a to Build Phases Link Binary With Libraries
  3. Add StoreKit.framework to Build Phases Link Binary With Libraries
  4. Add SystemConfiguration.framework to Build Phases Link Binary With Libraries
Android
  1. Add appirater to AVALON_FEATURES in your jni/Android.mk

  2. Import Appirater form /avalon/proj.android into work space

  3. Add to Project->properties->Android->Library Appirater

  4. Ensure the ACCESS_NETWORK_STATE ne permission in your AndroidManifest.xml

     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    

Flurry

Ios
  1. Add Flurry to Build Phases Target Dependencies
  2. Add libFlurry.a to Build Phases Link Binary With Libraries
  3. Add SystemConfiguration.framework to Build Phases Link Binary With Libraries
  4. Add Security.framework to Build Phases Link Binary With Libraries
Android
  1. Add flurry to AVALON_FEATURES in your jni/Android.mk

  2. Import Flurry form /avalon/proj.android into work space

  3. Add to Project->properties->Android->Library Flurry

  4. Ensure the internet permission in your AndroidManifest.xml

     <uses-permission android:name="android.permission.INTERNET"/>
    

FlurryAds

Ios
  1. Add FlurryAds to Build Phases Target Dependencies
  2. Add libFlurryAds.a to Build Phases Link Binary With Libraries
  3. Add AddSupport.framework to Build Phases Link Binary With Libraries
  4. Add SystemConfiguration.framework to Build Phases Link Binary With Libraries
  5. Add AddSupport.framework to Build Phases Link Binary With Libraries
  6. Add Security.framework to Build Phases Link Binary With Libraries
  7. Add MediaPlayer.framework to Build Phases Link Binary With Libraries
Android
  1. Add flurryAds to AVALON_FEATURES in your jni/Android.mk
  2. Import FlurryAds form /avalon/proj.android into work space
  3. Add to Project->properties->Android->Library FlurryAds
  4. Ensure the following activity configuration in your AndroidManifest.xml

Notificatios

Ios
  1. Add Notificatios to Build Phases Target Dependencies

  2. Add libNotificatios.a to Build Phases Link Binary With Libraries

  3. Add #import "avalon/platform/ios/notifications/NotificationsAppController.h" to your AppController.h

  4. Subclass your AppController from NotificationsAppController

     @interface AppController : NotificationsAppController
    
Android
  1. Add notificatios to AVALON_FEATURES in your jni/Android.mk
  2. Import Notificatios form /avalon/proj.android into work space
  3. Add to Project->properties->Android->Library Notificatios
Local Notifications
  1. To restore local only notifications after reboot ensure following permissions in your AndroidManifest.xml

     <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    
  2. Ensure the application receivers in your AndroidManifest.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>  
    
Remote Notifications
  1. Ensure the application meta-data in your AndroidManifest.xml

     <application>
         ...
         <meta-data 
            android:name="com.google.android.gms.version" 
            android:value="@integer/google_play_services_version" />
         ...
     </application> 
    
  2. 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 example com.google.example

  3. Ensure the application receivers in your AndroidManifest.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`
    
  4. 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);
         ...
    
Firebase Analytics
Ios
  1. Add Firebase iOS to Build Phases Target Dependencies
  2. Add Firebasei iOS.a, libz.a, libsqlite3.a, StoreKit.framework, SystemConfiguration.framework to Build Phases Link Binary With Libraries
  3. Add GoogleService-Info.plist to Build Phases Copy Bundle Resources
  4. Use functions from Firebase.h
Android
  1. Add to CmakeList.txt

     set(AVALON_FIREBASE ON CACHE BOOL "firebase")
    
  2. 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
            ...
         }
         ...
      }
    
  3. Add to settings.gradle

     include ':Firebase'
     project(':Firebase').projectDir = new File(settingsDir, '../avalon/proj.android-studio/Firebase')
    
  4. Add app/build.gradle

     dependencies {
         compile project(':Firebase')
         ...
     }
    
  5. Add google-services.json

  6. Use functions from Firebase.h (TBD: please clarify what functions will we use?)

Documentations

License

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.

About

Various extensions, helper and functions for cocos2d-x

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 39.8%
  • Java 28.1%
  • Objective-C 17.8%
  • Objective-C++ 13.1%
  • C 0.8%
  • Makefile 0.2%
  • CMake 0.2%