dmuratshin 9 năm trước cách đây
mục cha
commit
13937dd753
30 tập tin đã thay đổi với 1229 bổ sung266 xóa
  1. 2 0
      .hgignore
  2. 20 0
      CMakeLists.txt
  3. 193 0
      android/src/org/oxygine/facebook/Facebook.java
  4. 55 0
      example/HelloWorldFacebook/data/demo/big.bmfc
  5. BIN
      example/HelloWorldFacebook/data/demo/button.png
  6. BIN
      example/HelloWorldFacebook/data/demo/eng.txt
  7. 109 0
      example/HelloWorldFacebook/data/demo/font.fnt
  8. BIN
      example/HelloWorldFacebook/data/demo/font.png
  9. 6 0
      example/HelloWorldFacebook/data/demo/fonts.xml
  10. BIN
      example/HelloWorldFacebook/data/demo/loading.png
  11. BIN
      example/HelloWorldFacebook/data/demo/logo2.png
  12. 55 0
      example/HelloWorldFacebook/data/demo/main.bmfc
  13. 34 0
      example/HelloWorldFacebook/data/demo/num_fnt_shdr.fnt
  14. BIN
      example/HelloWorldFacebook/data/demo/num_fnt_shdr.png
  15. 9 0
      example/HelloWorldFacebook/data/demo/res_ui.xml
  16. 109 0
      example/HelloWorldFacebook/data/ext/fonts.xml.ox/bmfc_font/big.fnt
  17. BIN
      example/HelloWorldFacebook/data/ext/fonts.xml.ox/bmfc_font/big_0.png
  18. 109 0
      example/HelloWorldFacebook/data/ext/fonts.xml.ox/bmfc_font/main.fnt
  19. BIN
      example/HelloWorldFacebook/data/ext/fonts.xml.ox/bmfc_font/main_0.png
  20. 1 0
      example/HelloWorldFacebook/data/ext/fonts.xml.ox/meta.xml
  21. BIN
      example/HelloWorldFacebook/data/ext/res_ui.xml.ox/atlas/1_0.png
  22. 1 0
      example/HelloWorldFacebook/data/ext/res_ui.xml.ox/meta.xml
  23. 5 2
      example/HelloWorldFacebook/proj.cmake/CMakeLists.txt
  24. 36 123
      example/HelloWorldFacebook/src/example.cpp
  25. 245 0
      example/HelloWorldFacebook/src/test.cpp
  26. 83 0
      example/HelloWorldFacebook/src/test.h
  27. 25 20
      src/android/AndroidFacebook.cpp
  28. 55 51
      src/facebook.cpp
  29. 67 60
      src/facebook.h
  30. 10 10
      src/sim/FacebookSimulator.cpp

+ 2 - 0
.hgignore

@@ -0,0 +1,2 @@
+syntax: glob
+example/HelloWorldFacebook/proj.cmake/build/

+ 20 - 0
CMakeLists.txt

@@ -0,0 +1,20 @@
+cmake_minimum_required (VERSION 2.6)
+project (OXYGINE_FACEBOOK)
+
+set(OXYGINE_FACEBOOK_INCLUDE_DIRS 
+	${CMAKE_CURRENT_SOURCE_DIR}/src)
+
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+
+include_directories(${OXYGINE_FACEBOOK_INCLUDE_DIRS})
+add_library(oxygine-facebook STATIC 
+	src/facebook.cpp 
+	src/facebook.h
+	src/sim/FacebookSimulator.cpp 
+	src/sim/FacebookSimulator.h
+)
+
+#target_link_libraries(oxyginemagicparticles)
+
+set(OXYGINE_FACEBOOK_INCLUDE_DIRS ${OXYGINE_FACEBOOK_INCLUDE_DIRS} PARENT_SCOPE)
+set(OXYGINE_FACEBOOK_LIBS ${OXYGINE_FACEBOOK_LIBS} PARENT_SCOPE)

+ 193 - 0
android/src/org/oxygine/facebook/Facebook.java

@@ -0,0 +1,193 @@
+package org.oxygine.facebook.Facebook;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.util.Log;
+
+import com.facebook.AccessToken;
+import com.facebook.AccessTokenTracker;
+import com.facebook.CallbackManager;
+import com.facebook.FacebookCallback;
+import com.facebook.FacebookException;
+import com.facebook.FacebookRequestError;
+import com.facebook.FacebookSdk;
+import com.facebook.GraphRequest;
+import com.facebook.GraphResponse;
+import com.facebook.Profile;
+import com.facebook.ProfileTracker;
+import com.facebook.appevents.AppEventsLogger;
+import com.facebook.login.LoginManager;
+import com.facebook.login.LoginResult;
+import com.facebook.share.model.AppInviteContent;
+import com.facebook.share.widget.AppInviteDialog;
+
+import org.json.JSONArray;
+import org.json.JSONObject;
+import org.oxygine.lib.extension.ActivityObserver;
+
+import java.util.Arrays;
+
+public class FacebookAdapter extends ActivityObserver
+{
+    private static String TAG = "FacebookAdapter";
+
+    ProfileTracker profileTracker;
+    AccessToken accessToken;
+    AccessTokenTracker accessTokenTracker;
+    CallbackManager callbackManager;
+    Activity activity;
+
+    public native void loginResult(boolean value);
+    public native void newToken(String value);
+    public native void newMyFriendsRequestResult(String data, boolean error);
+    public native void newMeRequestResult(String data, boolean error);
+
+    public void logout()
+    {
+        Log.i(TAG, "logout");
+        LoginManager.getInstance().logOut();
+    }
+
+    public void login()
+    {
+        Log.i(TAG, "login");
+        LoginManager.getInstance().logInWithReadPermissions(activity, Arrays.asList("public_profile", "user_friends"));
+    }
+
+    public FacebookAdapter(Activity a)
+    {
+        Log.i(TAG, "FacebookAdapter");
+
+        activity = a;
+        FacebookSdk.sdkInitialize(a.getApplicationContext());
+
+        callbackManager = CallbackManager.Factory.create();
+
+        LoginManager.getInstance().registerCallback(callbackManager,
+                new FacebookCallback<LoginResult>() {
+                    @Override
+                    public void onSuccess(LoginResult loginResult) {
+                        Log.i(TAG, "Login::onSuccess");
+                        loginResult(true);
+                    }
+
+                    @Override
+                    public void onCancel() {
+                        Log.i(TAG, "Login::onCancel");
+                        loginResult(false);
+                    }
+
+                    @Override
+                    public void onError(FacebookException exception) {
+                        Log.i(TAG, "Login::onError");
+                        loginResult(false);
+                    }
+                });
+
+
+        accessTokenTracker = new AccessTokenTracker() {
+            @Override
+            protected void onCurrentAccessTokenChanged(
+                    AccessToken oldAccessToken,
+                    AccessToken currentAccessToken) {
+                // Set the access token using
+                // currentAccessToken when it's loaded or set.
+                accessToken = currentAccessToken;
+                newToken(accessToken.getToken());
+            }
+        };
+        // If the access token is available already assign it.
+        accessToken = AccessToken.getCurrentAccessToken();
+
+        if (isLoggedIn())
+            newToken(accessToken.getToken());
+/*
+        profileTracker = new ProfileTracker() {
+            @Override
+            protected void onCurrentProfileChanged(
+                    Profile oldProfile,
+                    Profile currentProfile) {
+                // App code
+            }
+        };*/
+
+
+    }
+
+    public void newMyFriendsRequest() {
+        Log.i(TAG, "newMyFriendsRequest");
+        GraphRequest request = GraphRequest.newMyFriendsRequest(accessToken, new GraphRequest.GraphJSONArrayCallback() {
+            @Override
+            public void onCompleted(JSONArray objects, GraphResponse response) {
+                Log.i(TAG, "newMyFriendsRequest:onCompleted " + objects.toString());
+                newMyFriendsRequestResult(objects.toString(), response.getError() != null);
+            }
+        });
+        request.executeAsync();
+    }
+
+
+    public boolean appInviteDialog(final String appLinkUrl,final String previewImageUrl) {
+
+        //appLinkUrl = "https://www.mydomain.com/myapplink";
+        //previewImageUrl = "https://www.mydomain.com/my_invite_image.jpg";
+
+        if (AppInviteDialog.canShow()) {
+            AppInviteContent content = new AppInviteContent.Builder()
+                    .setApplinkUrl(appLinkUrl)
+                    .setPreviewImageUrl(previewImageUrl)
+                    .build();
+            AppInviteDialog.show(activity, content);
+            return true;
+        }
+
+        return false;
+    }
+
+    public void newMeRequest() {
+        Log.i(TAG, "newMeRequest");
+        GraphRequest request = GraphRequest.newMeRequest(
+                accessToken,
+                new GraphRequest.GraphJSONObjectCallback() {
+                    @Override
+                    public void onCompleted(JSONObject object, GraphResponse response) {
+                        Log.i(TAG, "newMeRequest:onCompleted " + object.toString());
+                        newMeRequestResult(object.toString(), response.getError() != null);
+                    }
+                });
+        Bundle parameters = new Bundle();
+        parameters.putString("fields", "id,name,link");
+        request.setParameters(parameters);
+        request.executeAsync();
+    }
+
+    boolean isLoggedIn() {
+        Log.i(TAG, "isLoggedIn");
+        AccessToken accessToken = AccessToken.getCurrentAccessToken();
+        return accessToken != null && !accessToken.isExpired();
+    }
+
+    @Override
+    public void onActivityResult(int requestCode, int resultCode, Intent data) {
+        callbackManager.onActivityResult(requestCode, resultCode, data);
+    }
+
+    @Override
+    public void onDestroy() {
+        accessTokenTracker.stopTracking();
+        profileTracker.stopTracking();
+    }
+
+    @Override
+    public void onResume() {
+        // Logs 'install' and 'app activate' App Events.
+        AppEventsLogger.activateApp(activity);
+    }
+
+    @Override
+    public void onPause() {
+        // Logs 'app deactivate' App Event.
+        AppEventsLogger.deactivateApp(activity);
+    }
+}

+ 55 - 0
example/HelloWorldFacebook/data/demo/big.bmfc

@@ -0,0 +1,55 @@
+# AngelCode Bitmap Font Generator configuration file
+fileVersion=1
+
+# font settings
+fontName=Arial
+fontFile=
+charSet=0
+fontSize=-26
+aa=1
+scaleH=100
+useSmoothing=1
+isBold=1
+isItalic=0
+useUnicode=1
+disableBoxChars=1
+outputInvalidCharGlyph=0
+dontIncludeKerningPairs=1
+useHinting=1
+renderFromOutline=0
+useClearType=1
+
+# character alignment
+paddingDown=0
+paddingUp=0
+paddingRight=0
+paddingLeft=0
+spacingHoriz=1
+spacingVert=1
+useFixedHeight=0
+forceZero=0
+
+# output file
+outWidth=512
+outHeight=512
+outBitDepth=32
+fontDescFormat=1
+fourChnlPacked=0
+textureFormat=png
+textureCompression=0
+alphaChnl=0
+redChnl=4
+greenChnl=4
+blueChnl=4
+invA=0
+invR=0
+invG=0
+invB=0
+
+# outline
+outlineThickness=0
+
+# selected chars
+chars=32-126,169,174,176,180
+
+# imported icon images

BIN
example/HelloWorldFacebook/data/demo/button.png


BIN
example/HelloWorldFacebook/data/demo/eng.txt


+ 109 - 0
example/HelloWorldFacebook/data/demo/font.fnt

@@ -0,0 +1,109 @@
+<?xml version="1.0" ?><font>
+  <info aa="1" bold="1" charset="" face="Arial" italic="0" outline="0" padding="0,0,0,0" size="-26" smooth="1" spacing="1,1" stretchH="100" unicode="1"/>
+  <common alphaChnl="0" base="24" blueChnl="4" greenChnl="4" lineHeight="30" packed="0" pages="1" redChnl="4" scaleH="128" scaleW="512"/>
+  <pages>
+    <page file="font.png" id="0"/>
+  </pages>
+  <chars count="100">
+    <char chnl="15" height="1" id="32" page="0" width="3" x="98" xadvance="7" xoffset="-1" y="23" yoffset="29"/>
+    <char chnl="15" height="19" id="33" page="0" width="6" x="30" xadvance="8" xoffset="1" y="46" yoffset="5"/>
+    <char chnl="15" height="7" id="34" page="0" width="11" x="376" xadvance="12" xoffset="0" y="40" yoffset="5"/>
+    <char chnl="15" height="19" id="35" page="0" width="16" x="108" xadvance="14" xoffset="-1" y="23" yoffset="5"/>
+    <char chnl="15" height="22" id="36" page="0" width="14" x="98" xadvance="14" xoffset="0" y="0" yoffset="4"/>
+    <char chnl="15" height="20" id="37" page="0" width="23" x="134" xadvance="24" xoffset="0" y="0" yoffset="5"/>
+    <char chnl="15" height="19" id="38" page="0" width="19" x="323" xadvance="19" xoffset="0" y="0" yoffset="5"/>
+    <char chnl="15" height="7" id="39" page="0" width="6" x="388" xadvance="6" xoffset="0" y="40" yoffset="5"/>
+    <char chnl="15" height="24" id="40" page="0" width="7" x="76" xadvance="9" xoffset="1" y="0" yoffset="5"/>
+    <char chnl="15" height="24" id="41" page="0" width="7" x="84" xadvance="9" xoffset="1" y="0" yoffset="5"/>
+    <char chnl="15" height="9" id="42" page="0" width="10" x="348" xadvance="10" xoffset="0" y="40" yoffset="5"/>
+    <char chnl="15" height="14" id="43" page="0" width="15" x="119" xadvance="15" xoffset="0" y="43" yoffset="7"/>
+    <char chnl="15" height="8" id="44" page="0" width="5" x="370" xadvance="7" xoffset="1" y="40" yoffset="20"/>
+    <char chnl="15" height="4" id="45" page="0" width="8" x="411" xadvance="9" xoffset="1" y="40" yoffset="15"/>
+    <char chnl="15" height="4" id="46" page="0" width="5" x="436" xadvance="7" xoffset="1" y="40" yoffset="20"/>
+    <char chnl="15" height="19" id="47" page="0" width="9" x="0" xadvance="7" xoffset="-1" y="46" yoffset="5"/>
+    <char chnl="15" height="19" id="48" page="0" width="14" x="424" xadvance="14" xoffset="0" y="20" yoffset="5"/>
+    <char chnl="15" height="19" id="49" page="0" width="10" x="493" xadvance="14" xoffset="1" y="20" yoffset="5"/>
+    <char chnl="15" height="19" id="50" page="0" width="14" x="409" xadvance="14" xoffset="0" y="20" yoffset="5"/>
+    <char chnl="15" height="19" id="51" page="0" width="14" x="379" xadvance="14" xoffset="0" y="20" yoffset="5"/>
+    <char chnl="15" height="19" id="52" page="0" width="14" x="364" xadvance="14" xoffset="0" y="20" yoffset="5"/>
+    <char chnl="15" height="19" id="53" page="0" width="14" x="319" xadvance="14" xoffset="0" y="20" yoffset="5"/>
+    <char chnl="15" height="19" id="54" page="0" width="14" x="349" xadvance="14" xoffset="0" y="20" yoffset="5"/>
+    <char chnl="15" height="19" id="55" page="0" width="14" x="334" xadvance="14" xoffset="0" y="20" yoffset="5"/>
+    <char chnl="15" height="19" id="56" page="0" width="14" x="394" xadvance="14" xoffset="0" y="20" yoffset="5"/>
+    <char chnl="15" height="19" id="57" page="0" width="14" x="304" xadvance="14" xoffset="0" y="20" yoffset="5"/>
+    <char chnl="15" height="14" id="58" page="0" width="6" x="311" xadvance="10" xoffset="2" y="40" yoffset="10"/>
+    <char chnl="15" height="18" id="59" page="0" width="6" x="49" xadvance="10" xoffset="2" y="45" yoffset="10"/>
+    <char chnl="15" height="14" id="60" page="0" width="14" x="271" xadvance="15" xoffset="0" y="40" yoffset="8"/>
+    <char chnl="15" height="10" id="61" page="0" width="15" x="318" xadvance="15" xoffset="0" y="40" yoffset="10"/>
+    <char chnl="15" height="14" id="62" page="0" width="14" x="211" xadvance="15" xoffset="0" y="40" yoffset="8"/>
+    <char chnl="15" height="19" id="63" page="0" width="15" x="240" xadvance="16" xoffset="1" y="20" yoffset="5"/>
+    <char chnl="15" height="25" id="64" page="0" width="25" x="0" xadvance="25" xoffset="0" y="0" yoffset="5"/>
+    <char chnl="15" height="19" id="65" page="0" width="20" x="281" xadvance="19" xoffset="-1" y="0" yoffset="5"/>
+    <char chnl="15" height="19" id="66" page="0" width="18" x="402" xadvance="19" xoffset="1" y="0" yoffset="5"/>
+    <char chnl="15" height="19" id="67" page="0" width="18" x="383" xadvance="19" xoffset="0" y="0" yoffset="5"/>
+    <char chnl="15" height="19" id="68" page="0" width="18" x="421" xadvance="19" xoffset="1" y="0" yoffset="5"/>
+    <char chnl="15" height="19" id="69" page="0" width="15" x="224" xadvance="17" xoffset="1" y="20" yoffset="5"/>
+    <char chnl="15" height="19" id="70" page="0" width="14" x="497" xadvance="16" xoffset="1" y="0" yoffset="5"/>
+    <char chnl="15" height="19" id="71" page="0" width="19" x="343" xadvance="20" xoffset="0" y="0" yoffset="5"/>
+    <char chnl="15" height="19" id="72" page="0" width="17" x="18" xadvance="19" xoffset="1" y="26" yoffset="5"/>
+    <char chnl="15" height="19" id="73" page="0" width="6" x="504" xadvance="8" xoffset="1" y="20" yoffset="5"/>
+    <char chnl="15" height="19" id="74" page="0" width="13" x="454" xadvance="14" xoffset="0" y="20" yoffset="5"/>
+    <char chnl="15" height="19" id="75" page="0" width="18" x="459" xadvance="19" xoffset="1" y="0" yoffset="5"/>
+    <char chnl="15" height="19" id="76" page="0" width="15" x="256" xadvance="16" xoffset="1" y="20" yoffset="5"/>
+    <char chnl="15" height="19" id="77" page="0" width="21" x="259" xadvance="23" xoffset="1" y="0" yoffset="5"/>
+    <char chnl="15" height="19" id="78" page="0" width="17" x="72" xadvance="19" xoffset="1" y="25" yoffset="5"/>
+    <char chnl="15" height="19" id="79" page="0" width="20" x="302" xadvance="20" xoffset="0" y="0" yoffset="5"/>
+    <char chnl="15" height="19" id="80" page="0" width="17" x="90" xadvance="18" xoffset="1" y="25" yoffset="5"/>
+    <char chnl="15" height="21" id="81" page="0" width="20" x="113" xadvance="20" xoffset="0" y="0" yoffset="5"/>
+    <char chnl="15" height="19" id="82" page="0" width="18" x="440" xadvance="19" xoffset="1" y="0" yoffset="5"/>
+    <char chnl="15" height="19" id="83" page="0" width="17" x="36" xadvance="17" xoffset="0" y="25" yoffset="5"/>
+    <char chnl="15" height="19" id="84" page="0" width="16" x="125" xadvance="16" xoffset="1" y="22" yoffset="5"/>
+    <char chnl="15" height="19" id="85" page="0" width="17" x="0" xadvance="19" xoffset="1" y="26" yoffset="5"/>
+    <char chnl="15" height="19" id="86" page="0" width="19" x="363" xadvance="17" xoffset="-1" y="0" yoffset="5"/>
+    <char chnl="15" height="19" id="87" page="0" width="27" x="187" xadvance="25" xoffset="-1" y="0" yoffset="5"/>
+    <char chnl="15" height="19" id="88" page="0" width="17" x="54" xadvance="17" xoffset="0" y="25" yoffset="5"/>
+    <char chnl="15" height="19" id="89" page="0" width="18" x="478" xadvance="18" xoffset="0" y="0" yoffset="5"/>
+    <char chnl="15" height="19" id="90" page="0" width="16" x="159" xadvance="16" xoffset="0" y="20" yoffset="5"/>
+    <char chnl="15" height="24" id="91" page="0" width="8" x="67" xadvance="9" xoffset="1" y="0" yoffset="5"/>
+    <char chnl="15" height="19" id="92" page="0" width="9" x="10" xadvance="7" xoffset="-1" y="46" yoffset="5"/>
+    <char chnl="15" height="24" id="93" page="0" width="8" x="58" xadvance="9" xoffset="0" y="0" yoffset="5"/>
+    <char chnl="15" height="10" id="94" page="0" width="13" x="334" xadvance="15" xoffset="1" y="40" yoffset="5"/>
+    <char chnl="15" height="3" id="95" page="0" width="16" x="442" xadvance="14" xoffset="-1" y="40" yoffset="26"/>
+    <char chnl="15" height="4" id="96" page="0" width="7" x="420" xadvance="9" xoffset="0" y="40" yoffset="5"/>
+    <char chnl="15" height="14" id="97" page="0" width="14" x="151" xadvance="14" xoffset="0" y="41" yoffset="10"/>
+    <char chnl="15" height="19" id="98" page="0" width="15" x="208" xadvance="16" xoffset="1" y="20" yoffset="5"/>
+    <char chnl="15" height="14" id="99" page="0" width="14" x="166" xadvance="14" xoffset="0" y="40" yoffset="10"/>
+    <char chnl="15" height="19" id="100" page="0" width="15" x="192" xadvance="16" xoffset="0" y="20" yoffset="5"/>
+    <char chnl="15" height="14" id="101" page="0" width="14" x="181" xadvance="14" xoffset="0" y="40" yoffset="10"/>
+    <char chnl="15" height="19" id="102" page="0" width="10" x="482" xadvance="9" xoffset="0" y="20" yoffset="5"/>
+    <char chnl="15" height="19" id="103" page="0" width="15" x="176" xadvance="16" xoffset="0" y="20" yoffset="10"/>
+    <char chnl="15" height="19" id="104" page="0" width="14" x="439" xadvance="16" xoffset="1" y="20" yoffset="5"/>
+    <char chnl="15" height="19" id="105" page="0" width="5" x="37" xadvance="8" xoffset="2" y="45" yoffset="5"/>
+    <char chnl="15" height="24" id="106" page="0" width="9" x="48" xadvance="8" xoffset="-2" y="0" yoffset="5"/>
+    <char chnl="15" height="19" id="107" page="0" width="13" x="468" xadvance="14" xoffset="1" y="20" yoffset="5"/>
+    <char chnl="15" height="19" id="108" page="0" width="5" x="43" xadvance="8" xoffset="2" y="45" yoffset="5"/>
+    <char chnl="15" height="14" id="109" page="0" width="22" x="79" xadvance="24" xoffset="1" y="45" yoffset="10"/>
+    <char chnl="15" height="14" id="110" page="0" width="14" x="196" xadvance="16" xoffset="1" y="40" yoffset="10"/>
+    <char chnl="15" height="14" id="111" page="0" width="16" x="102" xadvance="16" xoffset="0" y="45" yoffset="10"/>
+    <char chnl="15" height="19" id="112" page="0" width="15" x="288" xadvance="16" xoffset="1" y="20" yoffset="10"/>
+    <char chnl="15" height="19" id="113" page="0" width="15" x="272" xadvance="16" xoffset="0" y="20" yoffset="10"/>
+    <char chnl="15" height="14" id="114" page="0" width="10" x="300" xadvance="10" xoffset="1" y="40" yoffset="10"/>
+    <char chnl="15" height="14" id="115" page="0" width="14" x="226" xadvance="14" xoffset="0" y="40" yoffset="10"/>
+    <char chnl="15" height="19" id="116" page="0" width="9" x="20" xadvance="9" xoffset="0" y="46" yoffset="5"/>
+    <char chnl="15" height="14" id="117" page="0" width="14" x="241" xadvance="16" xoffset="1" y="40" yoffset="10"/>
+    <char chnl="15" height="14" id="118" page="0" width="15" x="135" xadvance="15" xoffset="0" y="42" yoffset="10"/>
+    <char chnl="15" height="14" id="119" page="0" width="22" x="56" xadvance="21" xoffset="0" y="45" yoffset="10"/>
+    <char chnl="15" height="14" id="120" page="0" width="14" x="256" xadvance="14" xoffset="0" y="40" yoffset="10"/>
+    <char chnl="15" height="19" id="121" page="0" width="16" x="142" xadvance="15" xoffset="-1" y="21" yoffset="10"/>
+    <char chnl="15" height="14" id="122" page="0" width="13" x="286" xadvance="13" xoffset="0" y="40" yoffset="10"/>
+    <char chnl="15" height="24" id="123" page="0" width="10" x="37" xadvance="10" xoffset="0" y="0" yoffset="5"/>
+    <char chnl="15" height="24" id="124" page="0" width="5" x="92" xadvance="7" xoffset="1" y="0" yoffset="5"/>
+    <char chnl="15" height="24" id="125" page="0" width="10" x="26" xadvance="10" xoffset="0" y="0" yoffset="5"/>
+    <char chnl="15" height="6" id="126" page="0" width="15" x="395" xadvance="15" xoffset="0" y="40" yoffset="11"/>
+    <char chnl="15" height="19" id="169" page="0" width="21" x="237" xadvance="19" xoffset="-1" y="0" yoffset="5"/>
+    <char chnl="15" height="19" id="174" page="0" width="21" x="215" xadvance="19" xoffset="-1" y="0" yoffset="5"/>
+    <char chnl="15" height="8" id="176" page="0" width="10" x="359" xadvance="10" xoffset="0" y="40" yoffset="5"/>
+    <char chnl="15" height="4" id="180" page="0" width="7" x="428" xadvance="9" xoffset="2" y="40" yoffset="5"/>
+    <char chnl="15" height="19" id="8470" page="0" width="28" x="158" xadvance="29" xoffset="1" y="0" yoffset="5"/>
+  </chars>
+</font>

BIN
example/HelloWorldFacebook/data/demo/font.png


+ 6 - 0
example/HelloWorldFacebook/data/demo/fonts.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<resources>
+	<set path = "demo" />
+	<bmfc_font file="main.bmfc" chars="eng.txt"/>	
+	<bmfc_font file="big.bmfc" chars="eng.txt"/>
+</resources>

BIN
example/HelloWorldFacebook/data/demo/loading.png


BIN
example/HelloWorldFacebook/data/demo/logo2.png


+ 55 - 0
example/HelloWorldFacebook/data/demo/main.bmfc

@@ -0,0 +1,55 @@
+# AngelCode Bitmap Font Generator configuration file
+fileVersion=1
+
+# font settings
+fontName=Arial
+fontFile=
+charSet=0
+fontSize=-16
+aa=1
+scaleH=100
+useSmoothing=1
+isBold=1
+isItalic=0
+useUnicode=1
+disableBoxChars=1
+outputInvalidCharGlyph=0
+dontIncludeKerningPairs=1
+useHinting=1
+renderFromOutline=0
+useClearType=1
+
+# character alignment
+paddingDown=0
+paddingUp=0
+paddingRight=0
+paddingLeft=0
+spacingHoriz=1
+spacingVert=1
+useFixedHeight=0
+forceZero=0
+
+# output file
+outWidth=512
+outHeight=512
+outBitDepth=32
+fontDescFormat=1
+fourChnlPacked=0
+textureFormat=png
+textureCompression=0
+alphaChnl=0
+redChnl=4
+greenChnl=4
+blueChnl=4
+invA=0
+invR=0
+invG=0
+invB=0
+
+# outline
+outlineThickness=0
+
+# selected chars
+chars=32-126,169,174,176,180
+
+# imported icon images

+ 34 - 0
example/HelloWorldFacebook/data/demo/num_fnt_shdr.fnt

@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<font>
+  <info face="Movavi Grotesque Black" size="70" bold="0" italic="0" charset="" unicode="1" stretchH="100" smooth="1" aa="4" padding="0,0,0,0" spacing="1,1" outline="5"/>
+  <common lineHeight="70" base="55" scaleW="512" scaleH="68" pages="1" packed="0" alphaChnl="1" redChnl="0" greenChnl="0" blueChnl="0"/>
+  <pages>
+    <page id="0" file="num_fnt_shdr.png" />
+  </pages>
+  <chars count="10">
+    <char id="48" x="0" y="0" width="49" height="62" xoffset="-3" yoffset="-2" xadvance="44" page="0" chnl="15" />
+    <char id="49" x="449" y="0" width="34" height="60" xoffset="-5" yoffset="-1" xadvance="27" page="0" chnl="15" />
+    <char id="50" x="298" y="0" width="47" height="61" xoffset="-2" yoffset="-2" xadvance="44" page="0" chnl="15" />
+    <char id="51" x="198" y="0" width="49" height="61" xoffset="-3" yoffset="-1" xadvance="44" page="0" chnl="15" />
+    <char id="52" x="346" y="0" width="53" height="60" xoffset="-5" yoffset="-1" xadvance="43" page="0" chnl="15" />
+    <char id="53" x="248" y="0" width="49" height="61" xoffset="-3" yoffset="-1" xadvance="44" page="0" chnl="15" />
+    <char id="54" x="50" y="0" width="49" height="62" xoffset="-3" yoffset="-2" xadvance="44" page="0" chnl="15" />
+    <char id="55" x="400" y="0" width="48" height="60" xoffset="-5" yoffset="-1" xadvance="39" page="0" chnl="15" />
+    <char id="56" x="150" y="0" width="47" height="62" xoffset="-3" yoffset="-2" xadvance="42" page="0" chnl="15" />
+    <char id="57" x="100" y="0" width="49" height="62" xoffset="-3" yoffset="-2" xadvance="44" page="0" chnl="15" />
+  </chars>
+  <kernings count="12">
+    <kerning first="56" second="52" amount="1" />
+    <kerning first="55" second="55" amount="2" />
+    <kerning first="55" second="53" amount="-1" />
+    <kerning first="55" second="52" amount="-2" />
+    <kerning first="55" second="49" amount="2" />
+    <kerning first="54" second="52" amount="1" />
+    <kerning first="52" second="52" amount="2" />
+    <kerning first="51" second="52" amount="1" />
+    <kerning first="49" second="55" amount="1" />
+    <kerning first="49" second="54" amount="1" />
+    <kerning first="49" second="48" amount="1" />
+    <kerning first="48" second="49" amount="1" />
+  </kernings>
+</font>

BIN
example/HelloWorldFacebook/data/demo/num_fnt_shdr.png


+ 9 - 0
example/HelloWorldFacebook/data/demo/res_ui.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<resources>
+	<set path = "demo" />
+	<atlas>
+		<image file="loading.png"/>		
+		<image file="logo2.png"/>		
+		<image file="button.png" cols = "3" />	
+	</atlas>	
+</resources>

+ 109 - 0
example/HelloWorldFacebook/data/ext/fonts.xml.ox/bmfc_font/big.fnt

@@ -0,0 +1,109 @@
+<?xml version="1.0" ?><font>
+  <info aa="1" bold="1" charset="" face="Arial" italic="0" outline="0" padding="0,0,0,0" size="-26" smooth="1" spacing="1,1" stretchH="100" unicode="1"/>
+  <common alphaChnl="0" base="24" blueChnl="4" greenChnl="4" lineHeight="30" packed="0" pages="1" redChnl="4" scaleH="128" scaleW="512"/>
+  <pages>
+    <page file="big_0.png" id="0"/>
+  </pages>
+  <chars count="100">
+    <char chnl="15" height="1" id="32" page="0" width="3" x="98" xadvance="7" xoffset="-1" y="23" yoffset="29"/>
+    <char chnl="15" height="19" id="33" page="0" width="6" x="30" xadvance="8" xoffset="1" y="46" yoffset="5"/>
+    <char chnl="15" height="7" id="34" page="0" width="11" x="376" xadvance="12" xoffset="0" y="40" yoffset="5"/>
+    <char chnl="15" height="19" id="35" page="0" width="16" x="108" xadvance="14" xoffset="-1" y="23" yoffset="5"/>
+    <char chnl="15" height="22" id="36" page="0" width="14" x="98" xadvance="14" xoffset="0" y="0" yoffset="4"/>
+    <char chnl="15" height="20" id="37" page="0" width="23" x="134" xadvance="24" xoffset="0" y="0" yoffset="5"/>
+    <char chnl="15" height="19" id="38" page="0" width="19" x="323" xadvance="19" xoffset="0" y="0" yoffset="5"/>
+    <char chnl="15" height="7" id="39" page="0" width="6" x="388" xadvance="6" xoffset="0" y="40" yoffset="5"/>
+    <char chnl="15" height="24" id="40" page="0" width="7" x="76" xadvance="9" xoffset="1" y="0" yoffset="5"/>
+    <char chnl="15" height="24" id="41" page="0" width="7" x="84" xadvance="9" xoffset="1" y="0" yoffset="5"/>
+    <char chnl="15" height="9" id="42" page="0" width="10" x="348" xadvance="10" xoffset="0" y="40" yoffset="5"/>
+    <char chnl="15" height="14" id="43" page="0" width="15" x="119" xadvance="15" xoffset="0" y="43" yoffset="7"/>
+    <char chnl="15" height="8" id="44" page="0" width="5" x="370" xadvance="7" xoffset="1" y="40" yoffset="20"/>
+    <char chnl="15" height="4" id="45" page="0" width="8" x="411" xadvance="9" xoffset="1" y="40" yoffset="15"/>
+    <char chnl="15" height="4" id="46" page="0" width="5" x="436" xadvance="7" xoffset="1" y="40" yoffset="20"/>
+    <char chnl="15" height="19" id="47" page="0" width="9" x="0" xadvance="7" xoffset="-1" y="46" yoffset="5"/>
+    <char chnl="15" height="19" id="48" page="0" width="14" x="424" xadvance="14" xoffset="0" y="20" yoffset="5"/>
+    <char chnl="15" height="19" id="49" page="0" width="10" x="493" xadvance="14" xoffset="1" y="20" yoffset="5"/>
+    <char chnl="15" height="19" id="50" page="0" width="14" x="409" xadvance="14" xoffset="0" y="20" yoffset="5"/>
+    <char chnl="15" height="19" id="51" page="0" width="14" x="379" xadvance="14" xoffset="0" y="20" yoffset="5"/>
+    <char chnl="15" height="19" id="52" page="0" width="14" x="364" xadvance="14" xoffset="0" y="20" yoffset="5"/>
+    <char chnl="15" height="19" id="53" page="0" width="14" x="319" xadvance="14" xoffset="0" y="20" yoffset="5"/>
+    <char chnl="15" height="19" id="54" page="0" width="14" x="349" xadvance="14" xoffset="0" y="20" yoffset="5"/>
+    <char chnl="15" height="19" id="55" page="0" width="14" x="334" xadvance="14" xoffset="0" y="20" yoffset="5"/>
+    <char chnl="15" height="19" id="56" page="0" width="14" x="394" xadvance="14" xoffset="0" y="20" yoffset="5"/>
+    <char chnl="15" height="19" id="57" page="0" width="14" x="304" xadvance="14" xoffset="0" y="20" yoffset="5"/>
+    <char chnl="15" height="14" id="58" page="0" width="6" x="311" xadvance="10" xoffset="2" y="40" yoffset="10"/>
+    <char chnl="15" height="18" id="59" page="0" width="6" x="49" xadvance="10" xoffset="2" y="45" yoffset="10"/>
+    <char chnl="15" height="14" id="60" page="0" width="14" x="271" xadvance="15" xoffset="0" y="40" yoffset="8"/>
+    <char chnl="15" height="10" id="61" page="0" width="15" x="318" xadvance="15" xoffset="0" y="40" yoffset="10"/>
+    <char chnl="15" height="14" id="62" page="0" width="14" x="211" xadvance="15" xoffset="0" y="40" yoffset="8"/>
+    <char chnl="15" height="19" id="63" page="0" width="15" x="240" xadvance="16" xoffset="1" y="20" yoffset="5"/>
+    <char chnl="15" height="25" id="64" page="0" width="25" x="0" xadvance="25" xoffset="0" y="0" yoffset="5"/>
+    <char chnl="15" height="19" id="65" page="0" width="20" x="281" xadvance="19" xoffset="-1" y="0" yoffset="5"/>
+    <char chnl="15" height="19" id="66" page="0" width="18" x="402" xadvance="19" xoffset="1" y="0" yoffset="5"/>
+    <char chnl="15" height="19" id="67" page="0" width="18" x="383" xadvance="19" xoffset="0" y="0" yoffset="5"/>
+    <char chnl="15" height="19" id="68" page="0" width="18" x="421" xadvance="19" xoffset="1" y="0" yoffset="5"/>
+    <char chnl="15" height="19" id="69" page="0" width="15" x="224" xadvance="17" xoffset="1" y="20" yoffset="5"/>
+    <char chnl="15" height="19" id="70" page="0" width="14" x="497" xadvance="16" xoffset="1" y="0" yoffset="5"/>
+    <char chnl="15" height="19" id="71" page="0" width="19" x="343" xadvance="20" xoffset="0" y="0" yoffset="5"/>
+    <char chnl="15" height="19" id="72" page="0" width="17" x="18" xadvance="19" xoffset="1" y="26" yoffset="5"/>
+    <char chnl="15" height="19" id="73" page="0" width="6" x="504" xadvance="8" xoffset="1" y="20" yoffset="5"/>
+    <char chnl="15" height="19" id="74" page="0" width="13" x="454" xadvance="14" xoffset="0" y="20" yoffset="5"/>
+    <char chnl="15" height="19" id="75" page="0" width="18" x="459" xadvance="19" xoffset="1" y="0" yoffset="5"/>
+    <char chnl="15" height="19" id="76" page="0" width="15" x="256" xadvance="16" xoffset="1" y="20" yoffset="5"/>
+    <char chnl="15" height="19" id="77" page="0" width="21" x="259" xadvance="23" xoffset="1" y="0" yoffset="5"/>
+    <char chnl="15" height="19" id="78" page="0" width="17" x="72" xadvance="19" xoffset="1" y="25" yoffset="5"/>
+    <char chnl="15" height="19" id="79" page="0" width="20" x="302" xadvance="20" xoffset="0" y="0" yoffset="5"/>
+    <char chnl="15" height="19" id="80" page="0" width="17" x="90" xadvance="18" xoffset="1" y="25" yoffset="5"/>
+    <char chnl="15" height="21" id="81" page="0" width="20" x="113" xadvance="20" xoffset="0" y="0" yoffset="5"/>
+    <char chnl="15" height="19" id="82" page="0" width="18" x="440" xadvance="19" xoffset="1" y="0" yoffset="5"/>
+    <char chnl="15" height="19" id="83" page="0" width="17" x="36" xadvance="17" xoffset="0" y="25" yoffset="5"/>
+    <char chnl="15" height="19" id="84" page="0" width="16" x="125" xadvance="16" xoffset="1" y="22" yoffset="5"/>
+    <char chnl="15" height="19" id="85" page="0" width="17" x="0" xadvance="19" xoffset="1" y="26" yoffset="5"/>
+    <char chnl="15" height="19" id="86" page="0" width="19" x="363" xadvance="17" xoffset="-1" y="0" yoffset="5"/>
+    <char chnl="15" height="19" id="87" page="0" width="27" x="187" xadvance="25" xoffset="-1" y="0" yoffset="5"/>
+    <char chnl="15" height="19" id="88" page="0" width="17" x="54" xadvance="17" xoffset="0" y="25" yoffset="5"/>
+    <char chnl="15" height="19" id="89" page="0" width="18" x="478" xadvance="18" xoffset="0" y="0" yoffset="5"/>
+    <char chnl="15" height="19" id="90" page="0" width="16" x="159" xadvance="16" xoffset="0" y="20" yoffset="5"/>
+    <char chnl="15" height="24" id="91" page="0" width="8" x="67" xadvance="9" xoffset="1" y="0" yoffset="5"/>
+    <char chnl="15" height="19" id="92" page="0" width="9" x="10" xadvance="7" xoffset="-1" y="46" yoffset="5"/>
+    <char chnl="15" height="24" id="93" page="0" width="8" x="58" xadvance="9" xoffset="0" y="0" yoffset="5"/>
+    <char chnl="15" height="10" id="94" page="0" width="13" x="334" xadvance="15" xoffset="1" y="40" yoffset="5"/>
+    <char chnl="15" height="3" id="95" page="0" width="16" x="442" xadvance="14" xoffset="-1" y="40" yoffset="26"/>
+    <char chnl="15" height="4" id="96" page="0" width="7" x="420" xadvance="9" xoffset="0" y="40" yoffset="5"/>
+    <char chnl="15" height="14" id="97" page="0" width="14" x="151" xadvance="14" xoffset="0" y="41" yoffset="10"/>
+    <char chnl="15" height="19" id="98" page="0" width="15" x="208" xadvance="16" xoffset="1" y="20" yoffset="5"/>
+    <char chnl="15" height="14" id="99" page="0" width="14" x="166" xadvance="14" xoffset="0" y="40" yoffset="10"/>
+    <char chnl="15" height="19" id="100" page="0" width="15" x="192" xadvance="16" xoffset="0" y="20" yoffset="5"/>
+    <char chnl="15" height="14" id="101" page="0" width="14" x="181" xadvance="14" xoffset="0" y="40" yoffset="10"/>
+    <char chnl="15" height="19" id="102" page="0" width="10" x="482" xadvance="9" xoffset="0" y="20" yoffset="5"/>
+    <char chnl="15" height="19" id="103" page="0" width="15" x="176" xadvance="16" xoffset="0" y="20" yoffset="10"/>
+    <char chnl="15" height="19" id="104" page="0" width="14" x="439" xadvance="16" xoffset="1" y="20" yoffset="5"/>
+    <char chnl="15" height="19" id="105" page="0" width="5" x="37" xadvance="8" xoffset="2" y="45" yoffset="5"/>
+    <char chnl="15" height="24" id="106" page="0" width="9" x="48" xadvance="8" xoffset="-2" y="0" yoffset="5"/>
+    <char chnl="15" height="19" id="107" page="0" width="13" x="468" xadvance="14" xoffset="1" y="20" yoffset="5"/>
+    <char chnl="15" height="19" id="108" page="0" width="5" x="43" xadvance="8" xoffset="2" y="45" yoffset="5"/>
+    <char chnl="15" height="14" id="109" page="0" width="22" x="79" xadvance="24" xoffset="1" y="45" yoffset="10"/>
+    <char chnl="15" height="14" id="110" page="0" width="14" x="196" xadvance="16" xoffset="1" y="40" yoffset="10"/>
+    <char chnl="15" height="14" id="111" page="0" width="16" x="102" xadvance="16" xoffset="0" y="45" yoffset="10"/>
+    <char chnl="15" height="19" id="112" page="0" width="15" x="288" xadvance="16" xoffset="1" y="20" yoffset="10"/>
+    <char chnl="15" height="19" id="113" page="0" width="15" x="272" xadvance="16" xoffset="0" y="20" yoffset="10"/>
+    <char chnl="15" height="14" id="114" page="0" width="10" x="300" xadvance="10" xoffset="1" y="40" yoffset="10"/>
+    <char chnl="15" height="14" id="115" page="0" width="14" x="226" xadvance="14" xoffset="0" y="40" yoffset="10"/>
+    <char chnl="15" height="19" id="116" page="0" width="9" x="20" xadvance="9" xoffset="0" y="46" yoffset="5"/>
+    <char chnl="15" height="14" id="117" page="0" width="14" x="241" xadvance="16" xoffset="1" y="40" yoffset="10"/>
+    <char chnl="15" height="14" id="118" page="0" width="15" x="135" xadvance="15" xoffset="0" y="42" yoffset="10"/>
+    <char chnl="15" height="14" id="119" page="0" width="22" x="56" xadvance="21" xoffset="0" y="45" yoffset="10"/>
+    <char chnl="15" height="14" id="120" page="0" width="14" x="256" xadvance="14" xoffset="0" y="40" yoffset="10"/>
+    <char chnl="15" height="19" id="121" page="0" width="16" x="142" xadvance="15" xoffset="-1" y="21" yoffset="10"/>
+    <char chnl="15" height="14" id="122" page="0" width="13" x="286" xadvance="13" xoffset="0" y="40" yoffset="10"/>
+    <char chnl="15" height="24" id="123" page="0" width="10" x="37" xadvance="10" xoffset="0" y="0" yoffset="5"/>
+    <char chnl="15" height="24" id="124" page="0" width="5" x="92" xadvance="7" xoffset="1" y="0" yoffset="5"/>
+    <char chnl="15" height="24" id="125" page="0" width="10" x="26" xadvance="10" xoffset="0" y="0" yoffset="5"/>
+    <char chnl="15" height="6" id="126" page="0" width="15" x="395" xadvance="15" xoffset="0" y="40" yoffset="11"/>
+    <char chnl="15" height="19" id="169" page="0" width="21" x="237" xadvance="19" xoffset="-1" y="0" yoffset="5"/>
+    <char chnl="15" height="19" id="174" page="0" width="21" x="215" xadvance="19" xoffset="-1" y="0" yoffset="5"/>
+    <char chnl="15" height="8" id="176" page="0" width="10" x="359" xadvance="10" xoffset="0" y="40" yoffset="5"/>
+    <char chnl="15" height="4" id="180" page="0" width="7" x="428" xadvance="9" xoffset="2" y="40" yoffset="5"/>
+    <char chnl="15" height="19" id="8470" page="0" width="28" x="158" xadvance="29" xoffset="1" y="0" yoffset="5"/>
+  </chars>
+</font>

BIN
example/HelloWorldFacebook/data/ext/fonts.xml.ox/bmfc_font/big_0.png


+ 109 - 0
example/HelloWorldFacebook/data/ext/fonts.xml.ox/bmfc_font/main.fnt

@@ -0,0 +1,109 @@
+<?xml version="1.0" ?><font>
+  <info aa="1" bold="1" charset="" face="Arial" italic="0" outline="0" padding="0,0,0,0" size="-16" smooth="1" spacing="1,1" stretchH="100" unicode="1"/>
+  <common alphaChnl="0" base="15" blueChnl="4" greenChnl="4" lineHeight="19" packed="0" pages="1" redChnl="4" scaleH="64" scaleW="512"/>
+  <pages>
+    <page file="main_0.png" id="0"/>
+  </pages>
+  <chars count="100">
+    <char chnl="15" height="1" id="32" page="0" width="3" x="495" xadvance="4" xoffset="-1" y="13" yoffset="18"/>
+    <char chnl="15" height="12" id="33" page="0" width="4" x="205" xadvance="4" xoffset="0" y="13" yoffset="3"/>
+    <char chnl="15" height="4" id="34" page="0" width="8" x="430" xadvance="8" xoffset="0" y="13" yoffset="3"/>
+    <char chnl="15" height="12" id="35" page="0" width="11" x="404" xadvance="9" xoffset="-1" y="0" yoffset="3"/>
+    <char chnl="15" height="14" id="36" page="0" width="9" x="68" xadvance="9" xoffset="0" y="0" yoffset="2"/>
+    <char chnl="15" height="12" id="37" page="0" width="15" x="127" xadvance="16" xoffset="0" y="0" yoffset="3"/>
+    <char chnl="15" height="12" id="38" page="0" width="12" x="201" xadvance="12" xoffset="0" y="0" yoffset="3"/>
+    <char chnl="15" height="4" id="39" page="0" width="4" x="446" xadvance="4" xoffset="0" y="13" yoffset="3"/>
+    <char chnl="15" height="15" id="40" page="0" width="5" x="51" xadvance="5" xoffset="0" y="0" yoffset="3"/>
+    <char chnl="15" height="15" id="41" page="0" width="5" x="57" xadvance="5" xoffset="0" y="0" yoffset="3"/>
+    <char chnl="15" height="4" id="42" page="0" width="6" x="439" xadvance="6" xoffset="0" y="13" yoffset="3"/>
+    <char chnl="15" height="8" id="43" page="0" width="10" x="387" xadvance="9" xoffset="0" y="13" yoffset="5"/>
+    <char chnl="15" height="5" id="44" page="0" width="4" x="425" xadvance="4" xoffset="0" y="13" yoffset="13"/>
+    <char chnl="15" height="2" id="45" page="0" width="6" x="473" xadvance="5" xoffset="0" y="13" yoffset="10"/>
+    <char chnl="15" height="2" id="46" page="0" width="4" x="485" xadvance="4" xoffset="0" y="13" yoffset="13"/>
+    <char chnl="15" height="12" id="47" page="0" width="6" x="188" xadvance="4" xoffset="-1" y="13" yoffset="3"/>
+    <char chnl="15" height="12" id="48" page="0" width="9" x="95" xadvance="9" xoffset="0" y="13" yoffset="3"/>
+    <char chnl="15" height="12" id="49" page="0" width="7" x="164" xadvance="9" xoffset="0" y="13" yoffset="3"/>
+    <char chnl="15" height="12" id="50" page="0" width="9" x="105" xadvance="9" xoffset="0" y="13" yoffset="3"/>
+    <char chnl="15" height="12" id="51" page="0" width="9" x="115" xadvance="9" xoffset="0" y="13" yoffset="3"/>
+    <char chnl="15" height="12" id="52" page="0" width="9" x="125" xadvance="9" xoffset="0" y="13" yoffset="3"/>
+    <char chnl="15" height="12" id="53" page="0" width="9" x="135" xadvance="9" xoffset="0" y="13" yoffset="3"/>
+    <char chnl="15" height="12" id="54" page="0" width="9" x="145" xadvance="9" xoffset="0" y="13" yoffset="3"/>
+    <char chnl="15" height="12" id="55" page="0" width="9" x="55" xadvance="9" xoffset="0" y="16" yoffset="3"/>
+    <char chnl="15" height="12" id="56" page="0" width="9" x="85" xadvance="9" xoffset="0" y="14" yoffset="3"/>
+    <char chnl="15" height="12" id="57" page="0" width="9" x="65" xadvance="9" xoffset="0" y="16" yoffset="3"/>
+    <char chnl="15" height="9" id="58" page="0" width="4" x="382" xadvance="6" xoffset="1" y="13" yoffset="6"/>
+    <char chnl="15" height="12" id="59" page="0" width="4" x="215" xadvance="6" xoffset="1" y="13" yoffset="6"/>
+    <char chnl="15" height="9" id="60" page="0" width="9" x="354" xadvance="9" xoffset="0" y="13" yoffset="5"/>
+    <char chnl="15" height="5" id="61" page="0" width="9" x="408" xadvance="9" xoffset="0" y="13" yoffset="6"/>
+    <char chnl="15" height="9" id="62" page="0" width="9" x="344" xadvance="9" xoffset="0" y="13" yoffset="5"/>
+    <char chnl="15" height="12" id="63" page="0" width="10" x="472" xadvance="10" xoffset="0" y="0" yoffset="3"/>
+    <char chnl="15" height="16" id="64" page="0" width="16" x="0" xadvance="16" xoffset="0" y="0" yoffset="3"/>
+    <char chnl="15" height="12" id="65" page="0" width="12" x="253" xadvance="11" xoffset="-1" y="0" yoffset="3"/>
+    <char chnl="15" height="12" id="66" page="0" width="12" x="240" xadvance="12" xoffset="0" y="0" yoffset="3"/>
+    <char chnl="15" height="12" id="67" page="0" width="12" x="227" xadvance="12" xoffset="0" y="0" yoffset="3"/>
+    <char chnl="15" height="12" id="68" page="0" width="12" x="292" xadvance="12" xoffset="0" y="0" yoffset="3"/>
+    <char chnl="15" height="12" id="69" page="0" width="11" x="416" xadvance="11" xoffset="0" y="0" yoffset="3"/>
+    <char chnl="15" height="12" id="70" page="0" width="10" x="0" xadvance="10" xoffset="0" y="17" yoffset="3"/>
+    <char chnl="15" height="12" id="71" page="0" width="12" x="318" xadvance="12" xoffset="0" y="0" yoffset="3"/>
+    <char chnl="15" height="12" id="72" page="0" width="12" x="331" xadvance="12" xoffset="0" y="0" yoffset="3"/>
+    <char chnl="15" height="12" id="73" page="0" width="4" x="195" xadvance="4" xoffset="0" y="13" yoffset="3"/>
+    <char chnl="15" height="12" id="74" page="0" width="8" x="155" xadvance="9" xoffset="0" y="13" yoffset="3"/>
+    <char chnl="15" height="12" id="75" page="0" width="12" x="279" xadvance="12" xoffset="0" y="0" yoffset="3"/>
+    <char chnl="15" height="12" id="76" page="0" width="10" x="428" xadvance="10" xoffset="0" y="0" yoffset="3"/>
+    <char chnl="15" height="12" id="77" page="0" width="13" x="187" xadvance="13" xoffset="0" y="0" yoffset="3"/>
+    <char chnl="15" height="12" id="78" page="0" width="11" x="344" xadvance="12" xoffset="0" y="0" yoffset="3"/>
+    <char chnl="15" height="12" id="79" page="0" width="12" x="214" xadvance="12" xoffset="0" y="0" yoffset="3"/>
+    <char chnl="15" height="12" id="80" page="0" width="11" x="356" xadvance="11" xoffset="0" y="0" yoffset="3"/>
+    <char chnl="15" height="13" id="81" page="0" width="12" x="78" xadvance="12" xoffset="0" y="0" yoffset="3"/>
+    <char chnl="15" height="12" id="82" page="0" width="12" x="305" xadvance="12" xoffset="0" y="0" yoffset="3"/>
+    <char chnl="15" height="12" id="83" page="0" width="10" x="461" xadvance="11" xoffset="1" y="0" yoffset="3"/>
+    <char chnl="15" height="12" id="84" page="0" width="10" x="483" xadvance="10" xoffset="1" y="0" yoffset="3"/>
+    <char chnl="15" height="12" id="85" page="0" width="11" x="392" xadvance="12" xoffset="0" y="0" yoffset="3"/>
+    <char chnl="15" height="12" id="86" page="0" width="13" x="173" xadvance="11" xoffset="-1" y="0" yoffset="3"/>
+    <char chnl="15" height="12" id="87" page="0" width="17" x="109" xadvance="15" xoffset="-1" y="0" yoffset="3"/>
+    <char chnl="15" height="12" id="88" page="0" width="11" x="380" xadvance="11" xoffset="0" y="0" yoffset="3"/>
+    <char chnl="15" height="12" id="89" page="0" width="12" x="266" xadvance="10" xoffset="-1" y="0" yoffset="3"/>
+    <char chnl="15" height="12" id="90" page="0" width="11" x="368" xadvance="9" xoffset="-1" y="0" yoffset="3"/>
+    <char chnl="15" height="15" id="91" page="0" width="6" x="24" xadvance="5" xoffset="0" y="0" yoffset="3"/>
+    <char chnl="15" height="12" id="92" page="0" width="6" x="505" xadvance="4" xoffset="-1" y="0" yoffset="3"/>
+    <char chnl="15" height="15" id="93" page="0" width="6" x="17" xadvance="5" xoffset="-1" y="0" yoffset="3"/>
+    <char chnl="15" height="6" id="94" page="0" width="9" x="398" xadvance="9" xoffset="0" y="13" yoffset="3"/>
+    <char chnl="15" height="2" id="95" page="0" width="11" x="461" xadvance="9" xoffset="-1" y="13" yoffset="16"/>
+    <char chnl="15" height="2" id="96" page="0" width="4" x="480" xadvance="5" xoffset="0" y="13" yoffset="3"/>
+    <char chnl="15" height="9" id="97" page="0" width="9" x="284" xadvance="9" xoffset="0" y="13" yoffset="6"/>
+    <char chnl="15" height="12" id="98" page="0" width="10" x="439" xadvance="10" xoffset="0" y="0" yoffset="3"/>
+    <char chnl="15" height="9" id="99" page="0" width="9" x="294" xadvance="9" xoffset="0" y="13" yoffset="6"/>
+    <char chnl="15" height="12" id="100" page="0" width="10" x="450" xadvance="10" xoffset="0" y="0" yoffset="3"/>
+    <char chnl="15" height="9" id="101" page="0" width="9" x="364" xadvance="9" xoffset="0" y="13" yoffset="6"/>
+    <char chnl="15" height="12" id="102" page="0" width="7" x="180" xadvance="5" xoffset="-1" y="13" yoffset="3"/>
+    <char chnl="15" height="12" id="103" page="0" width="10" x="11" xadvance="10" xoffset="0" y="17" yoffset="6"/>
+    <char chnl="15" height="12" id="104" page="0" width="10" x="22" xadvance="10" xoffset="0" y="16" yoffset="3"/>
+    <char chnl="15" height="12" id="105" page="0" width="4" x="200" xadvance="4" xoffset="0" y="13" yoffset="3"/>
+    <char chnl="15" height="15" id="106" page="0" width="5" x="45" xadvance="4" xoffset="-1" y="0" yoffset="3"/>
+    <char chnl="15" height="12" id="107" page="0" width="9" x="75" xadvance="9" xoffset="0" y="15" yoffset="3"/>
+    <char chnl="15" height="12" id="108" page="0" width="4" x="210" xadvance="4" xoffset="0" y="13" yoffset="3"/>
+    <char chnl="15" height="9" id="109" page="0" width="14" x="236" xadvance="14" xoffset="0" y="13" yoffset="6"/>
+    <char chnl="15" height="9" id="110" page="0" width="10" x="262" xadvance="10" xoffset="0" y="13" yoffset="6"/>
+    <char chnl="15" height="9" id="111" page="0" width="10" x="273" xadvance="10" xoffset="0" y="13" yoffset="6"/>
+    <char chnl="15" height="12" id="112" page="0" width="10" x="33" xadvance="10" xoffset="0" y="16" yoffset="6"/>
+    <char chnl="15" height="12" id="113" page="0" width="10" x="44" xadvance="10" xoffset="0" y="16" yoffset="6"/>
+    <char chnl="15" height="9" id="114" page="0" width="7" x="374" xadvance="6" xoffset="0" y="13" yoffset="6"/>
+    <char chnl="15" height="9" id="115" page="0" width="9" x="304" xadvance="9" xoffset="0" y="13" yoffset="6"/>
+    <char chnl="15" height="12" id="116" page="0" width="7" x="172" xadvance="5" xoffset="-1" y="13" yoffset="3"/>
+    <char chnl="15" height="9" id="117" page="0" width="10" x="251" xadvance="10" xoffset="0" y="13" yoffset="6"/>
+    <char chnl="15" height="9" id="118" page="0" width="9" x="314" xadvance="9" xoffset="0" y="13" yoffset="6"/>
+    <char chnl="15" height="9" id="119" page="0" width="15" x="220" xadvance="13" xoffset="-1" y="13" yoffset="6"/>
+    <char chnl="15" height="9" id="120" page="0" width="9" x="324" xadvance="9" xoffset="0" y="13" yoffset="6"/>
+    <char chnl="15" height="12" id="121" page="0" width="10" x="494" xadvance="9" xoffset="-1" y="0" yoffset="6"/>
+    <char chnl="15" height="9" id="122" page="0" width="9" x="334" xadvance="9" xoffset="0" y="13" yoffset="6"/>
+    <char chnl="15" height="15" id="123" page="0" width="6" x="31" xadvance="6" xoffset="0" y="0" yoffset="3"/>
+    <char chnl="15" height="15" id="124" page="0" width="4" x="63" xadvance="4" xoffset="0" y="0" yoffset="3"/>
+    <char chnl="15" height="15" id="125" page="0" width="6" x="38" xadvance="6" xoffset="0" y="0" yoffset="3"/>
+    <char chnl="15" height="3" id="126" page="0" width="9" x="451" xadvance="9" xoffset="0" y="13" yoffset="8"/>
+    <char chnl="15" height="12" id="169" page="0" width="14" x="158" xadvance="12" xoffset="-1" y="0" yoffset="3"/>
+    <char chnl="15" height="12" id="174" page="0" width="14" x="143" xadvance="12" xoffset="-1" y="0" yoffset="3"/>
+    <char chnl="15" height="5" id="176" page="0" width="6" x="418" xadvance="6" xoffset="0" y="13" yoffset="3"/>
+    <char chnl="15" height="2" id="180" page="0" width="4" x="490" xadvance="5" xoffset="1" y="13" yoffset="3"/>
+    <char chnl="15" height="12" id="8470" page="0" width="17" x="91" xadvance="18" xoffset="1" y="0" yoffset="3"/>
+  </chars>
+</font>

BIN
example/HelloWorldFacebook/data/ext/fonts.xml.ox/bmfc_font/main_0.png


+ 1 - 0
example/HelloWorldFacebook/data/ext/fonts.xml.ox/meta.xml

@@ -0,0 +1 @@
+<resources version="2"><set/><bmfc_font sf="1.0" size="16"/><bmfc_font sf="1.0" size="26"/></resources>

BIN
example/HelloWorldFacebook/data/ext/res_ui.xml.ox/atlas/1_0.png


+ 1 - 0
example/HelloWorldFacebook/data/ext/res_ui.xml.ox/meta.xml

@@ -0,0 +1 @@
+<resources version="2"><set/><atlas><atlas file="1_0.png" format="r8g8b8a8" h="512" w="256"/><image fs="1,1,128,128,1.000000" ht="0,128,32,32">0,2,251,12,21,107,58;</image><image fs="1,1,150,107,1.000000" ht="128,208,37,26">0,2,140,0,0,150,107;</image><image fs="3,1,166,44,1.000000">0,2,48,1,1,164,42;0,2,2,1,1,165,42;0,2,94,2,2,164,42;</image><ht len="448">AAAAAAAAAAAAAAAAAAAAAAAAAAAAAB4AAMA/AAD8fwAA/v8BQP//A4D//wfAP/AD4A/AD+ADgB/gA4Af+AGAH/gBgD/4AQA/+AEAHsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPwAAAAAAAIB/AAAAAAAA4P8BAAAAAADg/wEAAAAAAOD/AQAAAAAA8P8DAAAAAADw8wMAAAAAAPj/AQAAAAAA/P///wcAAAD/////DwAAAP////8PAAAA/////w8AAAD/H///DwAAAP+///8PAAAA/3///w8AAAD8////DwAAAPz///8PAAAA/P///w8AAAD8/P//BwAAAPz8//8PAAAA/P///x8AAAD8////HwAAAPz///8fAAAA+P///x8AAADwv///DwAAAMAf+AMAAAAA</ht></atlas></resources>

+ 5 - 2
example/HelloWorldFacebook/proj.cmake/CMakeLists.txt

@@ -6,11 +6,14 @@ add_definitions(${OXYGINE_DEFINITIONS})
 include_directories(${OXYGINE_INCLUDE_DIRS})
 link_directories(${OXYGINE_LIBRARY_DIRS})
 
+add_subdirectory(../../../../oxygine-facebook/ oxygine-facebook)
+include_directories(${OXYGINE_FACEBOOK_INCLUDE_DIRS})
+
 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
-add_executable(HelloWorldFacebook ../src/example.cpp ../src/main.cpp  ../src/example.h )
+add_executable(HelloWorldFacebook ../src/main.cpp ../src/example.cpp  ../src/example.h ../src/test.h ../src/test.cpp)
 
 if (WIN32) #disable console mode for VC++
 	set_target_properties(HelloWorldFacebook PROPERTIES WIN32_EXECUTABLE TRUE)
 endif(WIN32)
 
-target_link_libraries(HelloWorldFacebook ${OXYGINE_CORE_LIBS})
+target_link_libraries(HelloWorldFacebook ${OXYGINE_CORE_LIBS} oxygine-facebook)

+ 36 - 123
example/HelloWorldFacebook/src/example.cpp

@@ -1,157 +1,70 @@
 #include "oxygine-framework.h"
-#include <functional>
-using namespace oxygine;
-
-//it is our resources
-//in real project you would have more than one Resources declarations.
-//It is important on mobile devices with limited memory and you would load/unload them
-Resources gameResources;
-
-
-class MainActor: public Actor
-{
-public:
-    spTextField _text;
-    spSprite    _button;
+#include "test.h"
 
-    MainActor()
-    {
-        //create button Sprite
-        spSprite button = new Sprite();
+#include "facebook.h"
 
-        //setup it:
-        //set button.png image. Resource 'button' defined in 'res.xml'
-        button->setResAnim(gameResources.getResAnim("button"));
+using namespace oxygine;
 
-        //centered button at screen
-        Vector2 pos = getStage()->getSize() / 2 - button->getSize() / 2;
-        button->setPosition(pos);
 
-        //register  click handler to button
-        EventCallback cb = CLOSURE(this, &MainActor::buttonClicked);
-        button->addEventListener(TouchEvent::CLICK, cb);
+//This contains our resources
+//In a real project you would have more than one Resources declaration.
+//It is important on mobile devices with limited memory and you would load/unload them
+Resources resources;
 
-#ifdef CLOSURE_FUNCTION //if your compiler supports lambda
-
-        button->addEventListener(TouchEvent::CLICK, [](Event * e)->void
-        {
-            log::messageln("button clicked");
-        });
+//#define MULTIWINDOW 1
 
+#if MULTIWINDOW
+spStage stage2;
 #endif
 
-        //attach button as child to current actor
-        addChild(button);
-        _button = button;
-
-
-
-        //create TextField Actor
-        spTextField text = new TextField();
-        //attach it as child to button
-        text->attachTo(button);
-        //centered in button
-        text->setPosition(button->getSize() / 2);
-
-        //initialize text style
-        TextStyle style;
-        style.font = gameResources.getResFont("main")->getFont();
-        style.color = Color::White;
-        style.vAlign = TextStyle::VALIGN_MIDDLE;
-        style.hAlign = TextStyle::HALIGN_CENTER;
-
-        text->setStyle(style);
-        text->setText("Click\nMe!");
-
-        _text = text;
-    }
+class TestActor : public Test
+{
+public:
 
-    void buttonClicked(Event* event)
+    TestActor()
     {
-        //user clicked to button
 
-        //animate button by chaning color
-        _button->setColor(Color::White);
-        _button->addTween(Sprite::TweenColor(Color::Green), 500, 1, true);
+        _x = 90;//getStage()->getWidth()/2.0f;
+        _y = 80;
 
-        //animate text by scaling
-        _text->setScale(1.0f);
-        _text->addTween(Actor::TweenScale(1.1f), 500, 1, true);
 
-        //and change text
-        _text->setText("Clicked!");
-
-        //lets create and run sprite with simple animation
-        runSprite();
+        addButton("login", "login");
     }
 
-    void runSprite()
+    void clicked(string id)
     {
-        spSprite sprite = new Sprite();
-        addChild(sprite);
-
-        int duration = 500;//500 ms
-        int loops = -1;//infinity loops
-
-        //animation has 7 columns, check 'res.xml'
-        ResAnim* animation = gameResources.getResAnim("anim");
-
-        //add animation tween to sprite
-        //TweenAnim would change animation frames
-        sprite->addTween(Sprite::TweenAnim(animation), duration, loops);
-
-        Vector2 destPos = getStage()->getSize() - sprite->getSize();
-        Vector2 srcPos = Vector2(0, destPos.y);
-        //set sprite initial position
-        sprite->setPosition(srcPos);
-
-        //add another tween: TweenQueue
-        //TweenQueue is a collection of tweens
-        spTweenQueue tweenQueue = new TweenQueue();
-        tweenQueue->setDelay(1500);
-        //first, move sprite to dest position
-        tweenQueue->add(Sprite::TweenPosition(destPos), 1500, 1);
-        //then fade it out smoothly
-        tweenQueue->add(Sprite::TweenAlpha(0), 500, 1);
-
-        sprite->addTween(tweenQueue);
-
-        //and remove sprite from tree when tweenQueue is empty
-        //if you don't hold any references to sprite it would be deleted automatically
-        tweenQueue->setDetachActor(true);
+        if (id == "login")
+        {
+        }
     }
 };
-//declare spMainActor as intrusive_ptr holder of MainActor
-typedef oxygine::intrusive_ptr<MainActor> spMainActor;
-//you could use DECLARE_SMART preprocessor definition it does the same:
-//DECLARE_SMART(MainActor, spMainActor)
 
-void example_preinit() {}
+void example_preinit()
+{
+}
+
 
-//called from main.cpp
 void example_init()
 {
-    //load xml file with resources definition
-    gameResources.loadXML("res.xml");
+    Test::init();
 
+    Test::instance = new TestActor;
+    getStage()->addChild(Test::instance);
 
-    //lets create our client code simple actor
-    //spMainActor was defined above as smart intrusive pointer (read more: http://www.boost.org/doc/libs/1_60_0/libs/smart_ptr/intrusive_ptr.html)
-    spMainActor actor = new MainActor;
+    //Initialize http requests
+    HttpRequestTask::init();
 
-    //and add it to Stage as child
-    getStage()->addChild(actor);
+    facebook::init();
 }
 
-
-//called each frame from main.cpp
 void example_update()
 {
 }
 
-//called each frame from main.cpp
 void example_destroy()
 {
-    //free previously loaded resources
-    gameResources.free();
-}
+    resources.free();
+    Test::free();
+    HttpRequestTask::release();
+    facebook::free();
+}

+ 245 - 0
example/HelloWorldFacebook/src/test.cpp

@@ -0,0 +1,245 @@
+#include "test.h"
+#include "oxygine-framework.h"
+#include "core/STDFileSystem.h"
+#include "WebImage.h"
+
+Resources Test::resourcesUI;
+file::STDFileSystem extfs(true);
+spTest Test::instance;
+
+void Test::init()
+{
+    //Mount additional file system with inner path "ext"
+    //Used for searching files in data/ext
+    extfs.setPath(file::fs().getFullPath("ext").c_str());
+    file::mount(&extfs);
+
+    resourcesUI.loadXML("demo/res_ui.xml");
+    resourcesUI.loadXML("demo/fonts.xml");
+
+
+    HttpRequestTask::init();
+
+    //Load logo from oxygine server
+    spWebImage sp = new WebImage;
+    sp->load("http://oxygine.org/test/logo.png");
+    sp->setTouchEnabled(false);
+    sp->attachTo(getStage());
+    sp->setPriority(10);
+    sp->setAlpha(128);
+    sp->setSize(150, 107);
+
+    sp->setX(getStage()->getWidth() - sp->getWidth());
+    sp->setY(getStage()->getHeight() - sp->getHeight());
+}
+
+void Test::free()
+{
+    resourcesUI.free();
+    instance->detach();
+    instance = 0;
+    HttpRequestTask::release();
+}
+
+class Toggle: public Button
+{
+public:
+    Toggle(const Test::toggle* t, int num): _current(0)
+    {
+        _items.assign(t, t + num);
+    }
+
+    int _current;
+
+    std::vector<Test::toggle> _items;
+};
+
+Color textColor(72, 61, 139, 255);
+
+spTextField createText(const std::string& txt)
+{
+    spTextField text = new TextField();
+
+    TextStyle style;
+    style.font = Test::resourcesUI.getResFont("main")->getFont();
+    style.color = textColor;
+    style.vAlign = TextStyle::VALIGN_MIDDLE;
+    style.hAlign = TextStyle::HALIGN_CENTER;
+    style.multiline = true;
+
+    text->setStyle(style);
+    text->setText(txt.c_str());
+
+    return text;
+}
+
+spButton createButtonHelper(spButton button, const std::string& txt, EventCallback cb)
+{
+    button->setPriority(10);
+    //button->setName(id);
+    button->setResAnim(Test::resourcesUI.getResAnim("button"));
+    button->addEventListener(TouchEvent::CLICK, cb);
+
+    //Create Actor with Text and add it to button as child
+    spTextField text = createText(txt);
+    text->setSize(button->getSize());
+    text->attachTo(button);
+
+    return button;
+}
+
+
+Test::Test() : _color(Color::White), _txtColor(72, 61, 139, 255)
+{
+    setSize(getStage()->getSize());
+
+    _x = getWidth() - 100;
+    _y = 2;
+
+    ui = new Actor;
+    content = new Content;
+    content->setSize(getSize());
+
+    addChild(content);
+    addChild(ui);
+
+    if (instance)
+    {
+        spButton button = createButtonHelper(new Button, "back", CLOSURE(this, &Test::back));
+        button->setY(getHeight() - button->getHeight());
+        ui->addChild(button);
+    }
+
+    memset(_notifies, 0, sizeof(_notifies));
+}
+
+
+Test::~Test()
+{
+}
+
+
+spButton Test::addButton(std::string id, std::string txt)
+{
+    textColor = _txtColor;
+    spButton button = createButtonHelper(new Button, txt, CLOSURE(this, &Test::_clicked));
+    initActor(button.get(),
+              arg_name = id,
+              arg_attachTo = ui,
+              arg_anchor = Vector2(0.5f, 0.0f),
+              arg_pos = Vector2(_x, _y));
+    button->setColor(_color);
+    textColor = Color(72, 61, 139, 255);
+
+    _y += button->getHeight() + 2.0f;
+
+    if (_y + button->getHeight() >= getHeight())
+    {
+        _y = 5;
+        _x += button->getWidth() + 70;
+    }
+
+    return button;
+}
+
+void Test::addToggle(std::string id, const toggle* t, int num)
+{
+    spButton button = createButtonHelper(new Toggle(t, num), t[0].text, CLOSURE(this, &Test::_toggleClicked));
+    initActor(button.get(),
+              arg_name = id,
+              arg_attachTo = ui,
+              arg_anchor = Vector2(0.5f, 0.0f),
+              arg_pos = Vector2(_x, _y));
+
+    _y += button->getHeight() + 2.0f;
+
+    if (_y + button->getHeight() >= getHeight())
+    {
+        _y = 0;
+        _x += button->getWidth() + 70;
+    }
+}
+
+void Test::updateText(std::string id, std::string txt)
+{
+    spActor child = ui->getChild(id);
+    if (!child)
+        return;
+
+    spTextField t = safeSpCast<TextField>(child->getFirstChild());
+    if (!t)
+        return;
+    t->setText(txt);
+}
+
+
+void Test::_clicked(Event* event)
+{
+    clicked(event->currentTarget->getName());
+}
+
+void Test::_toggleClicked(Event* event)
+{
+    Toggle* t = safeCast<Toggle*>(event->currentTarget.get());
+
+    toggleClicked(event->currentTarget->getName(), &t->_items[t->_current]);
+
+    t->_current = (t->_current + 1) % t->_items.size();
+    spTextField ta = safeSpCast<TextField>(t->getFirstChild());
+    const toggle* data = &t->_items[t->_current];
+    ta->setText(data->text);
+}
+
+
+void Test::back(Event* event)
+{
+    detach();
+    instance->setVisible(true);
+}
+
+
+void Test::notify(std::string txt, int time)
+{
+    size_t N = 0;
+    for (size_t i = 0; i < MAX_NOTIFIES; ++i)
+    {
+        if (_notifies[i])
+            continue;
+        N = i;
+        break;
+    }
+
+    _notifies[N] += 1;
+
+
+    spColorRectSprite sprite = new ColorRectSprite();
+    sprite->setUserData((void*)N);
+    sprite->setPriority(10);
+    Color colors[] = {Color(0xD2691EFF), Color(0x7FFFD4FF), Color(0xDC143CFF), Color(0xADFF2FFF), };
+    Color c = colors[rand() % 4];
+    sprite->setColor(c);
+    sprite->setSize(100, 30);
+    //sprite->setAnimFrame(resourcesUI.getResAnim("button"));
+    sprite->setAlpha(0);
+
+    spTweenQueue tq = new TweenQueue;
+    tq->add(Actor::TweenAlpha(255), 300, 1, false, 0, Tween::ease_inExpo);
+    tq->add(Actor::TweenAlpha(0), 300, 1, false, 1200);
+    tq->setDetachActor(true);
+    tq->addDoneCallback(CLOSURE(this, &Test::notifyDone));
+
+    sprite->addTween(tq);
+    sprite->attachTo(ui);
+    sprite->setPosition(2.0f, getHeight() - 100.0f - N * sprite->getHeight() * 1.1f);
+
+    spTextField text = createText(txt);
+    text->attachTo(sprite);
+    text->setColor(Color::Black);
+    text->setPosition(sprite->getSize() / 2);
+}
+
+void Test::notifyDone(Event* ev)
+{
+    size_t N = size_t(ev->target->getUserData());
+    _notifies[N] -= 1;
+}

+ 83 - 0
example/HelloWorldFacebook/src/test.h

@@ -0,0 +1,83 @@
+#pragma once
+#include "Actor.h"
+#include "Button.h"
+#include "RenderState.h"
+#include "STDRenderer.h"
+#include "TextField.h"
+using namespace oxygine;
+using namespace std;
+
+
+spTextField createText(const std::string& txt);
+spButton createButtonHelper(spButton, const std::string& txt, EventCallback cb);
+
+class Content: public Actor
+{
+public:
+    Content() : driver(0) { setName("content"); }
+    IVideoDriver* driver;
+
+    /*
+    void render(const RenderState& parentRS)
+    {
+
+        parentRS.renderer->drawBatch();
+
+        RenderState rs = parentRS;
+        STDRenderer renderer(driver ? driver : IVideoDriver::instance);
+        renderer.Renderer::begin(parentRS.renderer);
+        rs.renderer = &renderer;
+        Actor::render(rs);
+        renderer.end();
+    }
+    */
+};
+
+DECLARE_SMART(Test, spTest);
+class Test: public Actor
+{
+public:
+    Test();
+    ~Test();
+
+    static void init();
+    static void free();
+    static spTest instance;
+
+    struct toggle
+    {
+        string text;
+        int value;
+        const void* data;
+        toggle() {}
+        toggle(const char* text_, int v_ = 0, const void* data_ = 0): text(text_), value(v_), data(data_) {}
+
+    };
+
+    spButton addButton(string id, string txt);
+    void addToggle(string id, const toggle* t, int num);
+    void updateText(string id, string txt);
+    virtual void clicked(string id) {}
+    virtual void toggleClicked(string id, const toggle* data) {}
+    void _clicked(Event* event);
+    void _toggleClicked(Event* event);
+    void back(Event* event);
+
+    void notify(string text, int time = 400);
+
+protected:
+    void notifyDone(Event* ev);
+
+    Color _color;
+    Color _txtColor;
+
+    float _x;
+    float _y;
+    spActor ui;
+    Content* content;
+    enum {MAX_NOTIFIES = 8};
+    int _notifies[MAX_NOTIFIES];
+
+public:
+    static Resources resourcesUI;
+};

+ 25 - 20
src/android/AndroidFacebook.cpp

@@ -15,35 +15,39 @@ using namespace oxygine;
 jclass _jFacebookClass = 0;
 jobject _jFacebookObject = 0;
 
-bool isFacebookEnabled() {
+bool isFacebookEnabled()
+{
     return _jFacebookClass && _jFacebookObject;
 }
 
 
 extern "C"
 {
-    JNIEXPORT void JNICALL Java_com_furry_FacebookAdapter_FacebookAdapter_newMeRequestResult(JNIEnv *env, jobject obj, jstring json_data, jboolean error)
+    JNIEXPORT void JNICALL Java_com_furry_FacebookAdapter_FacebookAdapter_newMeRequestResult(JNIEnv* env, jobject obj, jstring json_data, jboolean error)
     {
         string data = jniGetString(env, json_data);
 
-        core::getMainThreadMessages().postCallback([ = ]() {
-            facebook::internal::newMeRequestResult( data , (bool) error) ;
+        core::getMainThreadMessages().postCallback([ = ]()
+        {
+            facebook::internal::newMeRequestResult(data , (bool) error) ;
         });
     }
 
-    JNIEXPORT void JNICALL Java_com_furry_FacebookAdapter_FacebookAdapter_newToken(JNIEnv *env, jobject obj, jstring json_data)
+    JNIEXPORT void JNICALL Java_com_furry_FacebookAdapter_FacebookAdapter_newToken(JNIEnv* env, jobject obj, jstring json_data)
     {
         string data = jniGetString(env, json_data);
 
-        core::getMainThreadMessages().postCallback([ = ]() {
-            facebook::internal::newToken( data ) ;
+        core::getMainThreadMessages().postCallback([ = ]()
+        {
+            facebook::internal::newToken(data) ;
         });
     }
 
     JNIEXPORT void JNICALL Java_com_furry_FacebookAdapter_FacebookAdapter_loginResult(JNIEnv* env, jobject obj, jboolean value)
     {
-        core::getMainThreadMessages().postCallback([ = ]() {
-            facebook::internal::loginResult((bool ) value ) ;
+        core::getMainThreadMessages().postCallback([ = ]()
+        {
+            facebook::internal::loginResult((bool) value) ;
         });
     }
 
@@ -51,7 +55,8 @@ extern "C"
     {
         string data = jniGetString(env, json_data);
 
-        core::getMainThreadMessages().postCallback([ = ]() {
+        core::getMainThreadMessages().postCallback([ = ]()
+        {
             facebook::internal::newMyFriendsRequestResult(data, (bool) error);
         });
     }
@@ -111,7 +116,7 @@ bool jniFacebookIsLoggedIn()
     bool result = false;
     try
     {
-        JNIEnv *env = jniGetEnv();
+        JNIEnv* env = jniGetEnv();
         LOCAL_REF_HOLDER(env);
 
         jmethodID jisLoggedIn = env->GetMethodID(_jFacebookClass, "isLoggedIn", "()Z");
@@ -121,7 +126,7 @@ bool jniFacebookIsLoggedIn()
         result = (bool) jb;
 
     }
-    catch(const notFound&)
+    catch (const notFound&)
     {
         log::error("jniFacebookIsLoggedIn failed, class/member not found");
     }
@@ -136,7 +141,7 @@ void jniFacebookNewMeRequest()
 
     try
     {
-        JNIEnv *env = jniGetEnv();
+        JNIEnv* env = jniGetEnv();
         LOCAL_REF_HOLDER(env);
 
         jmethodID jnewMeRequest = env->GetMethodID(_jFacebookClass, "newMeRequest", "()V");
@@ -144,7 +149,7 @@ void jniFacebookNewMeRequest()
         env->CallVoidMethod(_jFacebookObject, jnewMeRequest);
 
     }
-    catch(const notFound&)
+    catch (const notFound&)
     {
         log::error("jniFacebookNewMeRequest failed, class/member not found");
     }
@@ -157,7 +162,7 @@ bool jniFacebookAppInviteDialog(const string& appLinkUrl, const string& previewI
 
     try
     {
-        JNIEnv *env = jniGetEnv();
+        JNIEnv* env = jniGetEnv();
         LOCAL_REF_HOLDER(env);
 
         jmethodID jappInviteDialog = env->GetMethodID(_jFacebookClass, "appInviteDialog", "([Ljava/lang/String;[Ljava/lang/String;)Z");
@@ -169,7 +174,7 @@ bool jniFacebookAppInviteDialog(const string& appLinkUrl, const string& previewI
         env->CallVoidMethod(_jFacebookObject, jappInviteDialog, jappLinkUrl, jpreviewImageUrl);
 
     }
-    catch(const notFound&)
+    catch (const notFound&)
     {
         log::error("jniFacebookGetFriends failed, class/member not found");
     }
@@ -182,7 +187,7 @@ void jniFacebookGetFriends()
 
     try
     {
-        JNIEnv *env = jniGetEnv();
+        JNIEnv* env = jniGetEnv();
         LOCAL_REF_HOLDER(env);
 
         jmethodID jgetFriends = env->GetMethodID(_jFacebookClass, "newMyFriendsRequest", "()V");
@@ -190,7 +195,7 @@ void jniFacebookGetFriends()
         env->CallVoidMethod(_jFacebookObject, jgetFriends);
 
     }
-    catch(const notFound&)
+    catch (const notFound&)
     {
         log::error("jniFacebookGetFriends failed, class/member not found");
     }
@@ -203,7 +208,7 @@ void jniFacebookLogin()
 
     try
     {
-        JNIEnv *env = jniGetEnv();
+        JNIEnv* env = jniGetEnv();
         LOCAL_REF_HOLDER(env);
 
         jmethodID jlogin = env->GetMethodID(_jFacebookClass, "login", "()V");
@@ -211,7 +216,7 @@ void jniFacebookLogin()
         env->CallVoidMethod(_jFacebookObject, jlogin);
 
     }
-    catch(const notFound&)
+    catch (const notFound&)
     {
         log::error("jniFacebookLogin failed, class/member not found");
     }

+ 55 - 51
src/facebook.cpp

@@ -1,4 +1,4 @@
-#include "FacebookAdapter.h"
+#include "facebook.h"
 
 #ifdef __ANDROID__
 #include "android/AndroidFacebook.h"
@@ -8,7 +8,8 @@
 
 #define FB_EXT_ENABLED 1
 
-namespace facebook {
+namespace facebook
+{
 
     spEventDispatcher _dispatcher;
 
@@ -17,9 +18,10 @@ namespace facebook {
         return _dispatcher;
     }
 
-    void init() {
+    void init()
+    {
 #if !FB_EXT_ENABLED
-		return;
+        return;
 #endif
 
         log::messageln("facebook::init");
@@ -36,7 +38,7 @@ namespace facebook {
     void free()
     {
 #if !FB_EXT_ENABLED
-		return;
+        return;
 #endif
 
         log::messageln("facebook::free");
@@ -51,33 +53,33 @@ namespace facebook {
     void login()
     {
 #if !FB_EXT_ENABLED
-		return;
+        return;
 #endif
         log::messageln("facebook::login");
 
 #ifdef __ANDROID__
         jniFacebookLogin();
 #else
-       facebookSimulatorLogin();
+        facebookSimulatorLogin();
 #endif
         log::messageln("facebook::login done");
     }
 
-	bool appInviteDialog(const string& appLinkUrl, const string& previewImageUrl)
-	{
+    bool appInviteDialog(const string& appLinkUrl, const string& previewImageUrl)
+    {
 #if !FB_EXT_ENABLED
-		return false;
+        return false;
 #endif
-		log::messageln("facebook::AppInviteDialog");
+        log::messageln("facebook::AppInviteDialog");
 
 #ifdef __ANDROID__
-		return jniFacebookAppInviteDialog(appLinkUrl, previewImageUrl);
+        return jniFacebookAppInviteDialog(appLinkUrl, previewImageUrl);
 #else
-		return facebookSimulatorAppInviteDialog(appLinkUrl, previewImageUrl);
+        return facebookSimulatorAppInviteDialog(appLinkUrl, previewImageUrl);
 #endif
-		return false;
+        return false;
 
-	}
+    }
 
     void newMeRequest()
     {
@@ -98,7 +100,7 @@ namespace facebook {
     void getFriends()
     {
 #if !FB_EXT_ENABLED
-		return;
+        return;
 #endif
         log::messageln("facebook::getFriends");
 
@@ -113,7 +115,7 @@ namespace facebook {
     bool isLoggedIn()
     {
 #if !FB_EXT_ENABLED
-		return false;  
+        return false;
 #endif
         log::messageln("facebook::isLoggined");
 
@@ -125,60 +127,62 @@ namespace facebook {
         return false;
     }
 
-    namespace internal {
+    namespace internal
+    {
 
-		void newToken(const string& value)
-		{
-			log::messageln("facebook::internal::newToken %s", value.c_str());
+        void newToken(const string& value)
+        {
+            log::messageln("facebook::internal::newToken %s", value.c_str());
             TokenEvent ev;
             ev.token = value;
             _dispatcher->dispatchEvent(&ev);
-		}
+        }
 
         void loginResult(bool value)
         {
-			log::messageln("facebook::internal::loginResult %d", value);
+            log::messageln("facebook::internal::loginResult %d", value);
             LoginEvent ev;
             ev.isLoggedIn = value;
             _dispatcher->dispatchEvent(&ev);
         }
-		
-
-		/*
-			{
-				"id":"1035749669829946",
-				"link" : "https:\/\/www.facebook.com\/app_scoped_user_id\/1035749669829946\/",
-				"name" : "Denis Sachkov"
-			}
-		*/
-		void newMeRequestResult(const string& data, bool error) {
-			log::messageln("facebook::internal::newMeRequestResult %s", data.c_str());
+
+
+        /*
+            {
+                "id":"1035749669829946",
+                "link" : "https:\/\/www.facebook.com\/app_scoped_user_id\/1035749669829946\/",
+                "name" : "Denis Sachkov"
+            }
+        */
+        void newMeRequestResult(const string& data, bool error)
+        {
+            log::messageln("facebook::internal::newMeRequestResult %s", data.c_str());
 
             NewMeRequestEvent event;
-			Json::Reader reader;
-			Json::Value root;
-			bool parsingSuccessful = reader.parse(data.c_str(), root);     //parse process
-			if (!parsingSuccessful || error)
-			{
+            Json::Reader reader;
+            Json::Value root;
+            bool parsingSuccessful = reader.parse(data.c_str(), root);     //parse process
+            if (!parsingSuccessful || error)
+            {
                 event.error = true;
-				log::messageln("newMeRequestResult error" + error ? "response error" : "parse error" );
-				return;
-			}
-			else
-			{
-				event.id = root["id"].asCString();
-				event.link = root["link"].asCString();
-				event.name = root["name"].asCString();
-			}
+                log::messageln("newMeRequestResult error" + error ? "response error" : "parse error");
+                return;
+            }
+            else
+            {
+                event.id = root["id"].asCString();
+                event.link = root["link"].asCString();
+                event.name = root["name"].asCString();
+            }
 
             _dispatcher->dispatchEvent(&event);
-		}
+        }
 
         void newMyFriendsRequestResult(const string& data, bool error)
         {
-			log::messageln("facebook::internal::newMyFriendsRequestResult %s", data.c_str());
+            log::messageln("facebook::internal::newMyFriendsRequestResult %s", data.c_str());
+
 
-			
         }
     }
 }

+ 67 - 60
src/facebook.h

@@ -9,64 +9,71 @@
 using namespace std;
 using namespace oxygine;
 
-namespace facebook {
-
-	void init();
-	void free();
-
-		class NewMeRequestEvent : public Event {
-		public:
-			enum { EVENT = sysEventID('f', 'b', 'n') };
-			NewMeRequestEvent() : Event(EVENT) {}
-			
-			string id;
-			string link;
-			string name;
-			bool error = false;
-		};
-	
-		class LoginEvent : public Event {
-		public:
-			enum { EVENT = sysEventID('f','b','l')};
-			LoginEvent() : Event(EVENT) {}
-			bool isLoggedIn = false;
-		};
-
-		class FriendsEvent : public Event {
-			enum { EVENT = sysEventID('f', 'b', 'f')};
-			FriendsEvent() : Event(EVENT) {}
-
-			struct friend_Data {
-				string name;
-			};
-
-			typedef list<friend_Data> friends_list;
-
-			friends_list friends;
-			bool error = false;
-
-		};
-
-		class TokenEvent : public Event {
-		public:
-			enum { EVENT = sysEventID('f', 'b', 't')};
-			TokenEvent() : Event(EVENT) {};
-
-			string token;
-		};
-
-		spEventDispatcher dispatcher();
-
-		bool isLoggedIn();
-		void login();
-		void getFriends();
-		void newMeRequest();
-		bool appInviteDialog(const string& appLinkUrl, const string& previewImageUrl);
-
-		namespace internal {
-			void newMeRequestResult(const string& data, bool error);
-			void loginResult(bool value);
-			void newToken(const string& value);
-			void newMyFriendsRequestResult(const string& data, bool error);
-		}
+namespace facebook
+{
+
+    void init();
+    void free();
+
+    class NewMeRequestEvent : public Event
+    {
+    public:
+        enum { EVENT = sysEventID('f', 'b', 'n') };
+        NewMeRequestEvent() : Event(EVENT) {}
+
+        string id;
+        string link;
+        string name;
+        bool error = false;
+    };
+
+    class LoginEvent : public Event
+    {
+    public:
+        enum { EVENT = sysEventID('f', 'b', 'l')};
+        LoginEvent() : Event(EVENT) {}
+        bool isLoggedIn = false;
+    };
+
+    class FriendsEvent : public Event
+    {
+        enum { EVENT = sysEventID('f', 'b', 'f')};
+        FriendsEvent() : Event(EVENT) {}
+
+        struct friend_Data
+        {
+            string name;
+        };
+
+        typedef list<friend_Data> friends_list;
+
+        friends_list friends;
+        bool error = false;
+
+    };
+
+    class TokenEvent : public Event
+    {
+    public:
+        enum { EVENT = sysEventID('f', 'b', 't')};
+        TokenEvent() : Event(EVENT) {};
+
+        string token;
+    };
+
+    spEventDispatcher dispatcher();
+
+    bool isLoggedIn();
+    void login();
+    void getFriends();
+    void newMeRequest();
+    bool appInviteDialog(const string& appLinkUrl, const string& previewImageUrl);
+
+    namespace internal
+    {
+        void newMeRequestResult(const string& data, bool error);
+        void loginResult(bool value);
+        void newToken(const string& value);
+        void newMyFriendsRequestResult(const string& data, bool error);
+    }
 };

+ 10 - 10
src/sim/FacebookSimulator.cpp

@@ -1,5 +1,5 @@
 #include "FacebookSimulator.h"
-#include "FacebookAdapter.h"
+#include "facebook.h"
 
 
 bool _is_logged_in = false;
@@ -7,35 +7,35 @@ string facebook_token = "CAANycbhXMg0BAMpzvMM7M8sTjnRghS5heVq3EatYJssa9TKSnZArS7
 
 void facebookSimulatorLogin()
 {
-	_is_logged_in = true;
-	facebook::internal::loginResult(true);
-	facebook::internal::newToken(facebook_token);
+    _is_logged_in = true;
+    facebook::internal::loginResult(true);
+    facebook::internal::newToken(facebook_token);
 }
 
 void facebookSimulatorInit()
 {
-	log::messageln("Facebook Simulator Init");
+    log::messageln("Facebook Simulator Init");
 
 }
 
 void facebookSimulatorNewMeRequest()
 {
-	string data = "{\"id\":\"1035749669829946\",\"link\" : \"https:\/\/www.facebook.com\/app_scoped_user_id\/1035749669829946\/\",\"name\" : \"Denis Sachkov\"}";
-	facebook::internal::newMeRequestResult(data, false);
+    string data = "{\"id\":\"1035749669829946\",\"link\" : \"https:\/\/www.facebook.com\/app_scoped_user_id\/1035749669829946\/\",\"name\" : \"Denis Sachkov\"}";
+    facebook::internal::newMeRequestResult(data, false);
 }
 
 
 void facebookSimulatorGetFriends()
 {
-	
+
 }
 
 bool facebookSimulatorAppInviteDialog(const string& appLinkUrl, const string& previewImageUrl)
 {
-	return false;
+    return false;
 }
 
 bool facebookSimulatorIsLoggedIn()
 {
-	return _is_logged_in;
+    return _is_logged_in;
 }