GLBasic forum

Main forum => Off Topic => Topic started by: codegit on 2009-Nov-30

Title: GLBASIC iTouch and OpenFeint
Post by: codegit on 2009-Nov-30
Has anybody tried using OpenFeint on the iTouch?? If so can you please give a brief description on how you did it.  :O

http://www.openfeint.com/
Title: Re: GLBASIC iTouch and OpenFeint
Post by: MrTAToad on 2009-Nov-30
There is another lobby system for the iPhone - cant remember what its called now though.  It seems to be quite popular.

However, any external lobby system will no doubt be a pain to interface will.  On this very forum I've got a lobby system (and on my site) that can be used in GLBasic as its been written in GLBasic

It needs a lot of testing though - which is something I haven't really got around to.
Title: Re: GLBASIC iTouch and OpenFeint
Post by: Kitty Hello on 2009-Dec-01
Plus+, IIRC
Title: Re: GLBASIC iTouch and OpenFeint
Post by: codegit on 2009-Dec-01
Yes Plus+ is the other one.  =D
Title: Re: GLBASIC iTouch and OpenFeint
Post by: fjsantosb on 2009-Dec-01
Good question here.
I am thinking of implemeting any of this systems too, openfeint and plus+ seems to be more popular now.
Its easy to use on glbasic?

King Regards, fjsantos.
Title: Re: GLBASIC iTouch and OpenFeint
Post by: codegit on 2009-Dec-01
Quote from: fjsantosb on 2009-Dec-01
Good question here.
I am thinking of implemeting any of this systems too, openfeint and plus+ seems to be more popular now.
Its easy to use on glbasic?

King Regards, fjsantos.

I think we going to be out of luck. The SDK's are most probably for Objective c. I'm not sure but this is my thinking.  :(

Unfortunatly, this is fast becoming an important part of iPhone development.
Title: Re: GLBASIC iTouch and OpenFeint
Post by: Kitty Hello on 2009-Dec-01
you have a true xcode project in the end for the iphone. You can merge _any_ library.
I have no idea about plus+. OpenFeint seems the cheaper solution to me.
Title: Re: GLBASIC iTouch and OpenFeint
Post by: trucidare on 2009-Dec-01
Whats OpenFeint?
Merging other libs need to know something about objc and the sdk included in windows.
Title: Re: GLBASIC iTouch and OpenFeint
Post by: MrTAToad on 2009-Dec-01
http://www.openfeint.com/ (http://www.openfeint.com/)

Its a network lobby system
Title: Re: GLBASIC iTouch and OpenFeint
Post by: codegit on 2009-Dec-02
Lobby systems are becoming a very important marketing tool for iPhone. Also, it adds a lot of depth to your selling point as gamers really like to compare their scores and trophies etc to each other. I am trying to work through this stuff now, but my knowledge of Obj c is really limited. Also, I dont like the language, it kinda sucks a bit. (My opinion)  :(
Title: Re: GLBASIC iTouch and OpenFeint
Post by: matchy on 2010-Jan-17
Question is: How to call GLB in OBJC with and like OpenFeint in main or delagate?

Code (glbasic) Select

int main(int argc, char *argv[]) { // for GLB
return GLB_iPhone_call_main(argc, argv);
}


Code (glbasic) Select

int main(int argc, char *argv[]) { // for OF
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retOF = UIApplicationMain(argc, argv, nil, @"OpenFeintAppDelegate");
[pool release];
return retOF;
}
Title: Re: GLBASIC iTouch and OpenFeint
Post by: trucidare on 2010-Jan-17
Call inside glbasic with objekt allocation.
Code (glbasic) Select

@interface myInteface : NSObject <OpenFeinAppDelegate>

@end
...
myInterface* muh = [[myInterface alloc]init];
Title: Re: GLBASIC iTouch and OpenFeint
Post by: matchy on 2010-Jan-18
How and where is the "reference" to GLB_iPhone_main in objc, I guess in
Code (glbasic) Select

@implemenation OFeintTestAppDelegate

@synthesize window;

- (void)applicationDidFinishLaunching:(UIApplication *)application) {

// [GLBasic GLB_iPhone_main]; //???????? i dunno

...

[window makeKeyAndVisible];
[OpenFeint initializeWithProductKey:@"KEY123" ... ]
[OpenFeint launchDashboard]

}

Could you please elaborate on that as I am starting to learn objc !?

Title: Re: GLBASIC iTouch and OpenFeint
Post by: Kitty Hello on 2010-Jan-18
GLB_iPhone_main is a C function, that takes over all activity and won't ever return.
Title: Re: GLBASIC iTouch and OpenFeint
Post by: MrTAToad on 2010-Jan-18
Any chance of putting in an interface to OpenFeint into GLBasic.

By the way, they will be expanding to Android platforms.  But they wont contemplate doing a system for Window, Mac or Linux unfortunately.
Title: Re: GLBASIC iTouch and OpenFeint
Post by: codegit on 2010-Jan-18
Quote from: MrTAToad on 2010-Jan-18
Any chance of putting in an interface to OpenFeint into GLBasic.


This would be really coooooool  :nw:
Title: Re: GLBASIC iTouch and OpenFeint
Post by: matchy on 2010-Jan-18
We are almost there!

OpenFeint running on GLBasic:
http://www.youtube.com/watch?v=ljimQS567uA
Title: Re: GLBASIC iTouch and OpenFeint
Post by: codegit on 2010-Jan-19
Quote from: matchy on 2010-Jan-18
We are almost there!

OpenFeint running on GLBasic:
http://www.youtube.com/watch?v=ljimQS567uA

Nice.  :good:
Title: Re: GLBASIC iTouch and OpenFeint
Post by: MikeHart on 2010-Jan-19
Awesome matchy. I hope you will succeed.  :enc:
Title: Re: GLBASIC iTouch and OpenFeint
Post by: trucidare on 2010-Jan-19
Running here too!
Nice work matchy

Can you send me your code?
Implemented directly in glbasic. You made with XCode project?

yeah memory leak free :D
Code (glbasic) Select
2010-01-19 16:58:49.220 iPhone[1635:207] WB:Notice: WinterBoard
ID: XXXXX init with coder
app did finish launching, view=0x544bc0
start ani
applicationDidBecomeActive
backing: 320 x 480
Init GFX
Init Finalized
2010-01-19 16:58:51.412 iPhone[1635:207] GLB_Of_Init
2010-01-19 16:58:51.430 iPhone[1635:207] Settings drin...
2010-01-19 16:58:51.435 iPhone[1635:207] Delegates drin...
2010-01-19 16:58:52.142 iPhone[1635:207] Using OpenFeint version 1182010.https://api.openfeint.com/
2010-01-19 16:58:52.150 iPhone[1635:207] OpenFeint Init
Hallo OF

Title: Re: GLBASIC iTouch and OpenFeint
Post by: matchy on 2010-Jan-19
Trudicare, the the c functions to call the extern obj functions did the trick!

Note: This code is for the video demo (no return to glb window but still running). Hopefully we will be able to resolve this issue when I get a chance again. Have I missed anything?
8)
Code (glbasic) Select

// ofImport.gbas
REQUIRE "OpenFeint.c"
IMPORT "C" int funStartOpenFeint()
IMPORT "C" int funLaunchDashboard()
IMPORT "C" int funAchievement()

Code (glbasic) Select

// ofImport.c
int funStartOpenFeint() {
   return GLB_Of_Init();
}
int funAchievement() {
   return GLB_Of_Ach();
}

int funLaunchDashboard() {
   return GLB_Of_Dash();
}

Code (glbasic) Select

//  ofDelegate.h

#import <UIKit/UIKit.h>

@interface OFreintTestAppDelegate : NSObject <UIApplicationDelegate> {
    UIWindow *window;
UIView *view;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;

@end

Code (glbasic) Select

//  ofDelegate.m

#import "OpenFeint.h"
#import "OFAchievementService.h"
#import "OFAchievement.h"
#import "ofDelegate.h"

@implementation OFreintTestAppDelegate

@synthesize window;

- (void)dealloc {
    [view release];
    [window release];
    [super dealloc];
}

- (void) _GLB_Of_Init {
    CGRect lFrame = [[UIScreen mainScreen] applicationFrame];
    self.window = [[UIWindow alloc] initWithFrame: lFrame];
    lFrame.origin.y = 0.0;
    view = [[UIView alloc] initWithFrame: lFrame];
    [window addSubview: view];
    [window makeKeyAndVisible];

[OpenFeint initializeWithProductKey:@"ABC" andSecret:@"EFG" andDisplayName:@"ofTest" andSettings:nil andDelegates:nil];
}
- (void) _GLB_Of_Dash {
[OpenFeint launchDashboard];
}

- (void) _GLB_Of_Ach {
[OFAchievementService unlockAchievement:@"123"];
}

@end

OFreintTestAppDelegate *myFeintInit;

extern "C" void GLB_Of_Init() {
myFeintInit = [[OFreintTestAppDelegate alloc] init];
[myFeintInit _GLB_Of_Init];
}

OFreintTestAppDelegate *myFeintAch;

extern "C" void GLB_Of_Ach() {
myFeintAch = [[OFreintTestAppDelegate alloc] init];
[myFeintAch _GLB_Of_Ach];
}

OFreintTestAppDelegate *myFeintDash;

extern "C" void GLB_Of_Dash() {
myFeintDash = [[OFreintTestAppDelegate alloc] init];
[myFeintDash _GLB_Of_Dash];
}

:whistle:
Title: Re: GLBASIC iTouch and OpenFeint
Post by: trucidare on 2010-Jan-19
found the error in my .a solution. Now i can use OF and glb with only this:

Code (glbasic) Select
IMPORT "C" void GLB_Of_Init()
IMPORT "C" int GLB_Of_isOnline()

GLB_Of_Init()

WHILE TRUE
    PRINT "OpenFeint Connected - "+GLB_Of_isOnline(),0,0
    SHOWSCREEN
WEND


And simply add my lib and the openFein directory to xcode project created by glbasic. then ready compile and use openFeint and glbasic. (my test shows online stat and on touch on the screen handled by glbasic the dashboard will shown)



[attachment deleted by admin]
Title: Re: GLBASIC iTouch and OpenFeint
Post by: matchy on 2010-Jan-19
Cool. So now are you able to input in glb on after the OF init ( release the screen/window/view/subview )?

Title: Re: GLBASIC iTouch and OpenFeint
Post by: trucidare on 2010-Jan-19
you can do everything with glbasic and openfeint, one issue - i dont have phoos "pump iphone message" function, so the lists in openfeint are slow and not animated in scrolling. but all works.

Title: Re: GLBASIC iTouch and OpenFeint
Post by: matchy on 2010-Jan-19
Can you call openfeint commands interactively by pressing a button - for example init OP and another button to launch the dashboard?
Title: Re: GLBASIC iTouch and OpenFeint
Post by: MikeHart on 2010-Jan-19
Which version of OpenFeint are you using?
Title: Re: GLBASIC iTouch and OpenFeint
Post by: trucidare on 2010-Jan-20
yep i can but had no Time to create One in my Test ;) i m à glb noob
Title: Re: GLBASIC iTouch and OpenFeint
Post by: matchy on 2010-Jan-20
Anyone who is able to run the OF sample file and then include GLB will find that it is a loooooong process and cold compiling can take 5 to 10 minutes with hope of no errors.  :whistle:

TC, no pressure and I will try soon when I find some time to tackle this and learn some more obj! ;)

MH, The latest OpenFeint is 2.4.1.  8)
Title: Re: GLBASIC iTouch and OpenFeint
Post by: Kitty Hello on 2010-Jan-20
Code (glbasic) Select

extern "C" void iPhonePumpEvents(unsigned long milliseconds);

call it with "0" milliseconds to return quickly, but handle the messages. You need to call that function when you are performing a loop in some code.

ACE WORK!
Title: Re: GLBASIC iTouch and OpenFeint
Post by: trucidare on 2010-Jan-20
Compiling here about 2 min (the XCode project and with installing ob ipod) in glbasic no extra time

here a video of using OF (forgot to call iPhonePumpMessages, listviews are slow)

http://www.youtube.com/watch?v=-HVde1ZXhWw
Title: Re: GLBASIC iTouch and OpenFeint
Post by: trucidare on 2010-Jan-20
Found another social network similar to OpenFeint...

http://developer.agon-online.com/

is a static lib + header
Title: Re: GLBASIC iTouch and OpenFeint
Post by: Kitty Hello on 2010-Jan-20
I think OpenFeint is the most used out there. PLUS+ seems a big one, too. But the most games these days have OF.
Title: Re: GLBASIC iTouch and OpenFeint
Post by: MikeHart on 2010-Jan-20
Quote from: matchy on 2010-Jan-20
MH, The latest OpenFeint is 2.4.1.  8)

Matchy, I used 2.2 before but downloaded 2.4.2 yesterday.  ;)
Title: Re: GLBASIC iTouch and OpenFeint
Post by: trucidare on 2010-Jan-21
i created a simple xcode project for use with openFeint. some fine tune and add leaderboards then i release it.
Title: Re: GLBASIC iTouch and OpenFeint
Post by: trucidare on 2010-Jan-21
Now time for Testing :D

1. Download the Xcode.rar file.
2. Unrar it
3. Go to X:/Program Files/GLBasic/Compiler/platform/iPhone
4. Rename XCode folder to XCode - Non OF
5. Copy the unrared XCode folder to X:/Program Files/GLBasic/Compiler/platform/iPhone
6. Run GLBasic
7. Open your Project
8. Add following lines:
-> IMPORT "C" void GLB_Of_Init(const char* key, const char* secret, const char* displayName)
-> IMPORT "C" void GLB_Of_ShowDashboard()
-> IMPORT "C" int GLB_Of_isOnline()
-> IMPORT "C" void GLB_Of_Achive(const char* achivementID)
-> IMPORT "C" void GLB_Of_HighScore(const char* leadID, long score)
-> IMPORT "C" int GLB_Of_isDashboardClosed()
-> IMPORT "C" void iPhonePumpEvents(unsigned long milisecs)

Or import the Attached Wrapper to your Project.

9. Write your Game
10. add the functions declared in 8 to your game
11. Compile
12. Copy to mac
13. Compile Xcode Project with XCode
14 Be happy :D

for questions answer in this thread.

Known Issues -> table content in OpenFeint are slow, hope for a quick solution but not sure how. (tab and wait after some time it will click with row) - solved

Download Link -> http://rapidshare.com/files/339338189/XCode.rar.html (http://rapidshare.com/files/339338189/XCode.rar.html)

Please load up this file to another private server, because 10 times download limit.

Thanks

[attachment deleted by admin]
Title: Re: GLBASIC iTouch and OpenFeint
Post by: Kitty Hello on 2010-Jan-21
For Step 8 -> please provide a .gbas file that has the wrappers ;)
As usual, ace work.
Title: Re: GLBASIC iTouch and OpenFeint
Post by: trucidare on 2010-Jan-21
Pfew had forgotten that i can save gbas ob mac :D

Forgoten to say: You can use the same xcode project for every project. OpenFeint will be only enabled with calling GLB_Of_Init. Who do not use OpenFeint dont call this function ;)
Title: Re: GLBASIC iTouch and OpenFeint
Post by: codegit on 2010-Jan-21
 :enc: :nw:
Title: Re: GLBASIC iTouch and OpenFeint
Post by: Kitty Hello on 2010-Jan-21
Dude, I can't wait to try this out. I'll stick it into WizSticks. I'll have the gems for the Archivements.
Title: Re: GLBASIC iTouch and OpenFeint
Post by: trucidare on 2010-Jan-21
Hope for the solution for the slow down issue - after this all is perfect.

P.S. its the same slowdown that stops my CocoaTouch project, if this solved CocoaTouch is not far away
Title: Re: GLBASIC iTouch and OpenFeint
Post by: matchy on 2010-Jan-23
Tested OK and works fine!  =D
Title: Re: GLBASIC iTouch and OpenFeint
Post by: bigsofty on 2010-Jan-24
Can't test, iMac getting repaired... but sounds great, congrats on getting this far Trucidare  :booze:
Title: Re: GLBASIC iTouch and OpenFeint
Post by: Hatonastick on 2010-Jan-24
The file can also be downloaded via: http://www.davis.org.au/trucidare/XCode.rar (http://www.davis.org.au/trucidare/XCode.rar)

Trucidare, if you update send me a message and I'll update the version I'm hosting if you like.  I wouldn't mind hosting GLB-related files for people if they need it (heck its not like I'm doing much with the bandwidth) although I would have to ask why you don't just put it in the GLB showroom. :)
Title: Re: GLBASIC iTouch and OpenFeint
Post by: trucidare on 2010-Jan-24
Because the file size.
Thanks, i send you a mail if an update is online.
Title: Re: GLBASIC iTouch and OpenFeint
Post by: Hatonastick on 2010-Jan-25
No problem mate.  If you or anyone else needs GLB-specific files hosted just shoot me a message.

I've noticed lately a few DNS problems with my server which is odd, which may cause my server to 'randomly' disappear from time to time.  Don't panic if that happens as it's usually temporary.  Mind you the problem could just be the DNS server my home network uses ie. an issue with our ISP which wouldn't be the first time.  Anyway that's enough thread-stealing from me. :)
Title: Re: GLBASIC iTouch and OpenFeint
Post by: matchy on 2010-Feb-17
trucidare,

Any chance of an update to the OpenFeint library please?

- Screen orientation on before init (eg. UIInterfaceOrientationLandscapeRight)
- latest version: OpenFeint 2.4.3

eg.:

CONSTANT LANDSCAPE = 1
CONSTANT PORTRAIT = 2
IMPORT "C" void GLB_Of_Init(const char* key, const char* secret, const char* displayName, int mode)

;)

Edit: Landscape now supported! Thanks tucidare.
Title: Re: GLBASIC iTouch and OpenFeint
Post by: trucidare on 2010-Feb-18
oh didnt read this thread. My last library support it as own function.
its not released yet because slowmow bug.

you can update OpenFeint by yourselfe. Simple download latest OpenFeint SDK and copy OpenFeint into my OpenFeint template and overwrite.