GLBASIC iTouch and OpenFeint

Previous topic - Next topic

codegit

Quote from: MrTAToad on 2010-Jan-18
Any chance of putting in an interface to OpenFeint into GLBasic.


This would be really coooooool  :nw:
------------------------------------------
1 X Acer TravelMate 4270, laptop, XP PRO
1 X Dell Studio 17 laptop, Windows 7
1 X MacBook Pro 2,2 GHz Core 2 Duo, 2 GB RAM, 160 GB HDD, 9400M
2 X iTouch
1 X HTC Desire (Android 2.1)
iPad soon to be added

matchy

We are almost there!

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

codegit

------------------------------------------
1 X Acer TravelMate 4270, laptop, XP PRO
1 X Dell Studio 17 laptop, Windows 7
1 X MacBook Pro 2,2 GHz Core 2 Duo, 2 GB RAM, 160 GB HDD, 9400M
2 X iTouch
1 X HTC Desire (Android 2.1)
iPad soon to be added

MikeHart

Awesome matchy. I hope you will succeed.  :enc:

trucidare

#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

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

matchy

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:

trucidare

#21
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]
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

matchy

Cool. So now are you able to input in glb on after the OF init ( release the screen/window/view/subview )?


trucidare

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.

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

matchy

Can you call openfeint commands interactively by pressing a button - for example init OP and another button to launch the dashboard?

MikeHart

Which version of OpenFeint are you using?

trucidare

yep i can but had no Time to create One in my Test ;) i m à glb noob
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

matchy

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)

Kitty Hello

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!

trucidare

#29
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
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