starting on facebook connect

Previous topic - Next topic

djtoon


trucidare

Create a .mm file with extern "C" function that do something with the facebook sdk then import function in glbasic with IMPORT "C" and use in your game. compile run and think -> whoa thas porn <-
MacBook Pro 2,2 GHz Core 2 Duo, 4 GB RAM, 160 GB HDD, 8600M GT
Core i3 - 3,07 GHz, 8 GB Ram, 2.5 TB HDD, Geforce GTX 260+ OC

djtoon

hmm...
im kida stuck on this part :)
any example code somewhere or a simple tutorial for us non "C" People :)

MrTAToad

Don't think anyone has tried to connect to Facebook, I'm afraid...

matchy

Quote from: djtoon on 2010-Oct-27
hmm...
im kida stuck on this part :)
any example code somewhere or a simple tutorial for us non "C" People :)

Does "C" stand for complacent?

trucidare

#5
untested  -  coded in forum editor

Code (glbasic) Select

@interface GLB_FB_Wrapper : NSObject {
       static NSString* _secret;
       static NSString* _key;
       FBSession* _session;
       FBLoginDialog* _loginDialog;
}

- (void)_glb_fb_init:(NSString*)secret :(NSString*)key;
- (void)_glb_fb_login;
@end

@implementation GLB_FB_Wrapper
- (void)_glb_fb_init:(NSString*)secret :(NSString*)key {
        self._key = key;
        self._secret = secret;
         _session = [[FBSession sessionForApplication:key
                                      secret:secret delegate:self] retain];
}

- (void)_glb_fb_login {
        _loginDialog = [[FBLoginDialog alloc] init];
        [_loginDialog show];
}
@end

GLB_FB_Wrapper* FB_Connect;

extern "C" GLB_FB_Init(const char* secret, const char* key) {
      FB_Connect = [[GLB_FB_Wrapper alloc]init];
      [FB_Connect _glb_fb_init:[NSString stringWithUTF8String:secret] :[NSString stringWithUTF8String:key]];
}

extern "C" _glb_fb_login() {
      [FB_Connect _glb_fb_login];
}
MacBook Pro 2,2 GHz Core 2 Duo, 4 GB RAM, 160 GB HDD, 8600M GT
Core i3 - 3,07 GHz, 8 GB Ram, 2.5 TB HDD, Geforce GTX 260+ OC

MrTAToad

Now you need to exand that for use with non-Apple code :)

trucidare

compile this code as static iphone lib

then input in glbasic game:

Code (glbasic) Select
IMPORT "C" GLB_FB_Init(const char* secret, const char* key)
IMPORT "C" GLB_FB_Login()


add the lib and the facebook sdk to your gameproject compile and all fine
MacBook Pro 2,2 GHz Core 2 Duo, 4 GB RAM, 160 GB HDD, 8600M GT
Core i3 - 3,07 GHz, 8 GB Ram, 2.5 TB HDD, Geforce GTX 260+ OC

djtoon

i dont understand?

what do you mean a static iphone lib?
sorry for the questions
im still trying to figure out this warpper thing


trucidare

open xcode -> new project -> iphone (library) -> static lib -> insert code -> compile -> got libXXXX.a

MacBook Pro 2,2 GHz Core 2 Duo, 4 GB RAM, 160 GB HDD, 8600M GT
Core i3 - 3,07 GHz, 8 GB Ram, 2.5 TB HDD, Geforce GTX 260+ OC

djtoon

xcode is realy weird :(

can getit to work :)
im trying too ... maybe ill find a good tutorial somewhere on the net

i know this is a big thing but can you create some sort of tutorial?
could be usefull for alot of people

thank you

trucidare

its realy simple - if i have some time i will write a german tutorial and someone translate it to english.

there are only 3 steps:

1.) Create your lib in XCode with extern "C" flags - compile
2.) Import functions int GLBasic with IMPORT and compile for xcode
3.) open compiled xcode project and add the lib from step 1. compile and have fun
MacBook Pro 2,2 GHz Core 2 Duo, 4 GB RAM, 160 GB HDD, 8600M GT
Core i3 - 3,07 GHz, 8 GB Ram, 2.5 TB HDD, Geforce GTX 260+ OC

djtoon

this sould be a built in feature in glbasic :)
it will make it stand out more in the iphone app makeing class :)

i know
i use alot of them :)