Author Topic: GLBASIC iTouch and OpenFeint  (Read 13227 times)

Offline codegit

  • Dr. Type
  • ****
  • Posts: 270
    • View Profile
Re: GLBASIC iTouch and OpenFeint
« Reply #15 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

Offline matchy

  • Prof. Inline
  • *****
  • Posts: 1543
    • View Profile
Re: GLBASIC iTouch and OpenFeint
« Reply #16 on: 2010-Jan-18 »
We are almost there!

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

Offline codegit

  • Dr. Type
  • ****
  • Posts: 270
    • View Profile
Re: GLBASIC iTouch and OpenFeint
« Reply #17 on: 2010-Jan-19 »
We are almost there!

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

Nice.  :good:
------------------------------------------
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

  • Guest
Re: GLBASIC iTouch and OpenFeint
« Reply #18 on: 2010-Jan-19 »
Awesome matchy. I hope you will succeed.  :enc:

Offline trucidare

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1377
  • Bachelor of Fail
    • View Profile
Re: GLBASIC iTouch and OpenFeint
« Reply #19 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
« Last Edit: 2010-Jan-19 by trucidare »
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

Offline matchy

  • Prof. Inline
  • *****
  • Posts: 1543
    • View Profile
Re: GLBASIC iTouch and OpenFeint
« Reply #20 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:

Offline trucidare

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1377
  • Bachelor of Fail
    • View Profile
Re: GLBASIC iTouch and OpenFeint
« Reply #21 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]
« Last Edit: 2010-Jan-19 by trucidare »
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

Offline matchy

  • Prof. Inline
  • *****
  • Posts: 1543
    • View Profile
Re: GLBASIC iTouch and OpenFeint
« Reply #22 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 )?


Offline trucidare

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1377
  • Bachelor of Fail
    • View Profile
Re: GLBASIC iTouch and OpenFeint
« Reply #23 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.

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

Offline matchy

  • Prof. Inline
  • *****
  • Posts: 1543
    • View Profile
Re: GLBASIC iTouch and OpenFeint
« Reply #24 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?

MikeHart

  • Guest
Re: GLBASIC iTouch and OpenFeint
« Reply #25 on: 2010-Jan-19 »
Which version of OpenFeint are you using?

Offline trucidare

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1377
  • Bachelor of Fail
    • View Profile
Re: GLBASIC iTouch and OpenFeint
« Reply #26 on: 2010-Jan-20 »
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

Offline matchy

  • Prof. Inline
  • *****
  • Posts: 1543
    • View Profile
Re: GLBASIC iTouch and OpenFeint
« Reply #27 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)

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10709
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: GLBASIC iTouch and OpenFeint
« Reply #28 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!

Offline trucidare

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1377
  • Bachelor of Fail
    • View Profile
Re: GLBASIC iTouch and OpenFeint
« Reply #29 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
« Last Edit: 2010-Jan-20 by trucidare »
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