long time here

spacefractal · 25618

Offline spacefractal

  • RBP Team Member
  • Blue Gene Super Computer
  • *****
    • Posts: 4138
on: May 22, 2014, 08:12:53 pm
how goes really with eventuelly new projects? Its seen a quite low activity here, so which forums do you also uses too?

here im mostly on glbasic yet, and is looking on the race game as well a labyrinth version of Greedy Mouse.

For that Greedy Mouse, all levels will been some sort of labyrinth with no focus on puzzles, but complete the generated mazes on a scabalon in relaxed style (just like the labyrinth bonus village).  The star reward system is also differents, since no score or bonus is used, so its complete a relaxed game this time, but reuses all graphics from Greedy mouse.

Im thinks its can been fun reuses a game that way and see that going when im have a paid version (the maze version) and the original version (still freemium) and im also wont want ads in the labyrinth version at all (since its more suiteble for kids). By now its seen im got a quite little more money for the Android version, and have not got paid some time for the iOS version.
« Last Edit: May 22, 2014, 08:13:48 pm by spacefractal »

The Musician for the RetroBytes Portal Projects.


Offline flash

  • Administrator
  • Blue Gene Super Computer
  • **********
    • Posts: 13180
Reply #1 on: May 27, 2014, 11:12:31 am
We have been a little quiet.

Currently, HK is working on another project that is rather important, and in the mean time, we are working on WinSol.

We recently added Apple Controller support to Jungool as well, and will release an update on AppStore soon.

Other than that, there really are no other projects in production atm. I did have a play with Balders running under Unity, but have not touched that for over a month.

Coding for the love of it!


Offline Sokurah

  • RBP Member
  • Cray-1 Super Computer
  • *****
    • Posts: 724
    • Tardis Remakes
Reply #2 on: May 27, 2014, 08:25:04 pm
I've been working on a new Spectrum game for a while now.
...well, "worked" is a fancy word for having just begun working on it again about a week ago, after a three month pause of doing nothing. :)



Offline spacefractal

  • RBP Team Member
  • Blue Gene Super Computer
  • *****
    • Posts: 4138
Reply #3 on: May 31, 2014, 09:22:38 am
im was forget this thread, hehe.

How hard was its to add the Apple Gamecontroller support? Here im had focus to have Gamecontroller support on Android instead with remapping support (here all wrote in Java, and call it from c++). Im believe its better and eaiser on Android as well cheeper too. The price on iOS seen have been quite too high. But anyway im might support them anyway in a future, but is still not good with c# code, soon its going to have objects (im much better with Java here).

So by now im are doing a recycle game with reused graphics. Im still creating mazes (im are in the village 5). Im have not worked on the little race game yet in a while (which due its nature would not support gamecontroller and would property have been a iPad & Kindle Fire exclusive).
« Last Edit: May 31, 2014, 09:25:15 am by spacefractal »

The Musician for the RetroBytes Portal Projects.


Offline headkaze

  • Administrator
  • Blue Gene Super Computer
  • **********
    • Posts: 7838
Reply #4 on: May 31, 2014, 10:33:13 am
Game controller support isn't too hard to add. I wrote an 'InputView' class that handles touch input (with rotation support), iCade and recently added Apple Game Controller. Just add it as a UIView and call setActive and it will process all input. This is directly from Jungool which was coded mostly in C++ so it places input data into C style data structs.

InputView.h
Code: [Select]
//
//  InputView.h
//  Jungool
//
//  Created by Ben Baker on 19/11/10.
//  Copyright 2010 Headsoft. All rights reserved.
//

#import <Foundation/Foundation.h>

#import "ESRenderer.h"
#import "GamePadState.h"

/*
 P1 UP ON,OFF  = w,e
 P1 RT ON,OFF  = d,c
 P1 DN ON,OFF  = x,z
 P1 LT ON,OFF  = a,q
 P1 A  ON,OFF  = y,t
 P1 B  ON,OFF  = h,r
 P1 C  ON,OFF  = u,f
 P1 D  ON,OFF  = j,n
 P1 E  ON,OFF  = i,m
 P1 F  ON,OFF  = k,p
 P1 G  ON,OFF  = o,g
 P1 H  ON,OFF  = l,v
 P2 UP ON,OFF  = W,E
 P2 RT ON,OFF  = D,C
 P2 DN ON,OFF  = X,Z
 P2 LT ON,OFF  = A,Q
 P2 A  ON,OFF  = Y,T
 P2 B  ON,OFF  = H,R
 P2 C  ON,OFF  = U,F
 P2 D  ON,OFF  = J,N
 P2 E  ON,OFF  = I,M
 P2 F  ON,OFF  = K,P
 P2 G  ON,OFF  = O,G
 P2 H  ON,OFF  = L,V
 */

#define APPLE_MAX_JOYCOUNT 4

@protocol GamePadEventDelegate <NSObject>

@optional
- (void)stateChanged:(GamePadState)state;
- (void)buttonDown:(GamePadState)button;
- (void)buttonUp:(GamePadState)button;
@end

@interface InputView : UIView <UIKeyInput, UIAccelerometerDelegate, GamePadEventDelegate>
{
@public;
ESRenderer *m_renderer;
UIView *m_inputView;
    GamePadState m_gamePadState;
    id<GamePadEventDelegate> m_delegate;
long long m_inputDown[APPLE_MAX_JOYCOUNT];
   
    struct
{
        bool stateChanged:1;
        bool buttonDown:1;
        bool buttonUp:1;
    } m_delegateFlags;
}

@property (readwrite, retain) ESRenderer *renderer;
@property (nonatomic, assign) GamePadState gamePadState;
@property (nonatomic, assign) id<GamePadEventDelegate> delegate;
@property (nonatomic, assign) BOOL active;

- (void)addObservers;
- (void)removeObservers;
- (void)didEnterBackground;
- (void)didBecomeActive;

@end

InputView.m
Code: [Select]
//
//  InputView.m
//  Jungool
//
//  Created by Ben Baker on 19/11/10.
//  Copyright 2010 Headsoft. All rights reserved.
//

#import "GameController/GCController.h"
#import "InputView.h"
#include "Globals.h"

static const char *ON_STATES  = "wdxayhujikolWDXAYHUJIKOL";
static const char *OFF_STATES = "eczqtrfnmpgvECZQTRFNMPGV";

@implementation InputView

@synthesize renderer = m_renderer;
@synthesize active = m_active;
@synthesize gamePadState = m_gamePadState;
@synthesize delegate = m_delegate;

- (id)initWithFrame:(CGRect)frame
{
    if ((self = [super initWithFrame:frame]))
{
m_inputView = [[UIView alloc] initWithFrame:CGRectZero];

[self setMultipleTouchEnabled:YES];
[self addObservers];
[self setDelegate:self];

memset(m_inputDown, sizeof(m_inputDown[0]) * APPLE_MAX_JOYCOUNT, 0);

// iOS 7 Game Controller
if(SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0"))
[self gameControllerConnect];
}

    return self;
}

- (void)dealloc
{
[self removeObservers];

    [super dealloc];
}

#pragma mark Touch methods

- (CGPoint)rotateTouch:(CGPoint) point
{
float tempX = 0;

point.x *= g_inputScreen->Scale;
point.y *= g_inputScreen->Scale;

switch(g_inputScreen->Angle)
{
case ROTATION_0:
break;
case ROTATION_90:
tempX = point.x;
point.x = g_inputScreen->DisplaySize.width - point.y;
point.y = tempX;
break;
case ROTATION_180:
point.x = g_inputScreen->DisplaySize.width - point.x;
point.y = g_inputScreen->DisplaySize.height - point.y;
break;
case ROTATION_270:
tempX = point.x;
point.x = point.y;
point.y = g_inputScreen->DisplaySize.height - tempX;
break;

default:
break;
}

//DEBUGLOG("X:%.2f of %.0f Y:%.2f of %.0f", point.x, g_displaySize.width, point.y, g_displaySize.height);

return point;
}

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
NSArray *touchArray = [touches allObjects];
NSInteger touchCount = [touchArray count];
//NSSet *allTouches = [event allTouches];

for(int i=0; i<touchCount; i++)
{
UITouch *touch = [touchArray objectAtIndex:i];
int id = (int)touch;

for(int j=0; j<TOUCH_MAX; j++)
{
if(g_touchCurrent[j].Id == 0)
{
CGPoint point = [self rotateTouch:[touch locationInView:self]];

g_touchCurrent[j].Id = id;
g_touchCurrent[j].Type = TOUCH_DOWN;
g_touchCurrent[j].Position = Vector2DMake(point.x, point.y);
g_touchCurrent[j].PositionNormal = Vector2DMake(point.x / g_inputScreen->DisplaySize.width, point.y / g_inputScreen->DisplaySize.height);
g_touchCurrent[j].PositionWorld = Vector2DMake(g_touchCurrent[j].PositionNormal.x * g_inputScreen->ScreenRect.width - g_inputScreen->ScreenRect.width * 0.5f, -(g_touchCurrent[j].PositionNormal.y * g_inputScreen->ScreenRect.height - g_inputScreen->ScreenRect.height * 0.5f));
g_touchCurrent[j].TouchRegion = (g_touchCurrent[j].PositionNormal.x < 0.5f ? REGION_LEFT : (g_touchCurrent[j].PositionNormal.x >= 0.5f ? REGION_RIGHT : 0));
g_touchCurrent[j].TouchRegion |= (g_touchCurrent[j].PositionNormal.y < 0.5f ? REGION_TOP : (g_touchCurrent[j].PositionNormal.y >= 0.5f ? REGION_BOTTOM : 0));
g_touchCurrent[j].TouchDown = &g_touchDown[j];
g_touchCurrent[j].TouchMove = NULL;
g_touchCurrent[j].TouchUp = NULL;
g_touchCurrent[j].TouchPrevious = NULL;

g_touchDown[j] = g_touchCurrent[j];

//DEBUGLOG("TOUCH %d (%3.3f,%3.3f)", j,  - g_touchCurrent[j].Position.y + 320.0f, g_touchCurrent[j].Position.x);

g_touchAll[i] = &g_touchCurrent[j];
break;
}
}
}

if(g_touchAll[0] == NULL)
return;

[m_renderer touchDown:g_touchAll touchCount:touchCount touches:touches withEvent:event];
}

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
NSArray *touchArray = [touches allObjects];
NSInteger touchCount = [touchArray count];
//NSSet *allTouches = [event allTouches];

for(int i=0; i<touchCount; i++)
{
UITouch *touch = [touchArray objectAtIndex:i];
int id = (int)touch;

for(int j=0; j<TOUCH_MAX; j++)
{
if(g_touchCurrent[j].Id == id)
{
CGPoint point = [self rotateTouch:[touch locationInView:self]];

g_touchPrevious[j] = g_touchCurrent[j];

g_touchCurrent[j].Id = id;
g_touchCurrent[j].Type = TOUCH_MOVE;
g_touchCurrent[j].Position = Vector2DMake(point.x, point.y);
g_touchCurrent[j].PositionNormal = Vector2DMake(point.x / g_inputScreen->DisplaySize.width, point.y / g_inputScreen->DisplaySize.height);
g_touchCurrent[j].PositionWorld = Vector2DMake(g_touchCurrent[j].PositionNormal.x * g_inputScreen->ScreenRect.width - g_inputScreen->ScreenRect.width * 0.5f, -(g_touchCurrent[j].PositionNormal.y * g_inputScreen->ScreenRect.height - g_inputScreen->ScreenRect.height * 0.5f));
g_touchCurrent[j].TouchRegion = (g_touchCurrent[j].PositionNormal.x < 0.5f ? REGION_LEFT : (g_touchCurrent[j].PositionNormal.x >= 0.5f ? REGION_RIGHT : 0));
g_touchCurrent[j].TouchRegion |= (g_touchCurrent[j].PositionNormal.y < 0.5f ? REGION_TOP : (g_touchCurrent[j].PositionNormal.y >= 0.5f ? REGION_BOTTOM : 0));
g_touchCurrent[j].TouchDown = &g_touchDown[j];
g_touchCurrent[j].TouchMove = &g_touchMove[j];
g_touchCurrent[j].TouchUp = NULL;
g_touchCurrent[j].TouchPrevious = &g_touchPrevious[j];

g_touchMove[j] = g_touchCurrent[j];

//DEBUGLOG("MOVED %d (%3.3f,%3.3f)", j,  - g_touchCurrent[j].Position.y + 320.0f, g_touchCurrent[j].Position.x);

g_touchAll[i] = &g_touchCurrent[j];
break;
}
}
}

if(g_touchAll[0] == NULL)
return;

[m_renderer touchMove:g_touchAll touchCount:touchCount touches:touches withEvent:event];
}

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
NSArray *touchArray = [touches allObjects];
NSInteger touchCount = [touchArray count];
//NSSet *allTouches = [event allTouches];

for(int i=0; i<touchCount; i++)
{
UITouch *touch = [touchArray objectAtIndex:i];
int id = (int)touch;

for(int j=0; j<TOUCH_MAX; j++)
{
if(g_touchCurrent[j].Id == id)
{
CGPoint point = [self rotateTouch:[touch locationInView:self]];

g_touchPrevious[j] = g_touchCurrent[j];

g_touchCurrent[j].Id = id;
g_touchCurrent[j].Type = TOUCH_UP;
g_touchCurrent[j].Position = Vector2DMake(point.x, point.y);
g_touchCurrent[j].PositionNormal = Vector2DMake(point.x / g_inputScreen->DisplaySize.width, point.y / g_inputScreen->DisplaySize.height);
g_touchCurrent[j].PositionWorld = Vector2DMake(g_touchCurrent[j].PositionNormal.x * g_inputScreen->ScreenRect.width - g_inputScreen->ScreenRect.width * 0.5f, -(g_touchCurrent[j].PositionNormal.y * g_inputScreen->ScreenRect.height - g_inputScreen->ScreenRect.height * 0.5f));
g_touchCurrent[j].TouchRegion = (g_touchCurrent[j].PositionNormal.x < 0.5f ? REGION_LEFT : (g_touchCurrent[j].PositionNormal.x >= 0.5f ? REGION_RIGHT : 0));
g_touchCurrent[j].TouchRegion |= (g_touchCurrent[j].PositionNormal.y < 0.5f ? REGION_TOP : (g_touchCurrent[j].PositionNormal.y >= 0.5f ? REGION_BOTTOM : 0));
g_touchCurrent[j].TouchDown = &g_touchDown[j];
g_touchCurrent[j].TouchMove = &g_touchMove[j];
g_touchCurrent[j].TouchUp = &g_touchUp[j];
g_touchCurrent[j].TouchPrevious = &g_touchPrevious[j];

g_touchUp[j] = g_touchCurrent[j];

g_touchAll[i] = &g_touchCurrent[j];
break;
}
}
}

if(g_touchAll[0] == NULL)
return;

[m_renderer touchUp:g_touchAll touchCount:touchCount touches:touches withEvent:event];

for(int i=0; i<touchCount; i++)
{
for(int j=0; j<TOUCH_MAX; j++)
{
UITouch *touch = [touchArray objectAtIndex:i];
int id = (int)touch;

if(g_touchCurrent[j].Id == id)
{
g_touchAll[i] = NULL;

memset(&g_touchCurrent[j], 0, sizeof(Touch));
memset(&g_touchDown[j], 0, sizeof(Touch));
memset(&g_touchMove[j], 0, sizeof(Touch));
memset(&g_touchUp[j], 0, sizeof(Touch));
memset(&g_touchPrevious[j], 0, sizeof(Touch));
}
}
}
}

- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
{
NSArray *touchArray = [touches allObjects];
NSInteger touchCount = [touchArray count];
//NSSet *allTouches = [event allTouches];

for(int i=0; i<touchCount; i++)
{
for(int j=0; j<TOUCH_MAX; j++)
{
UITouch *touch = [touchArray objectAtIndex:i];
int id = (int)touch;

if(g_touchDown[j].Id == id)
{
g_touchAll[i] = NULL;

memset(&g_touchCurrent[j], 0, sizeof(Touch));
memset(&g_touchDown[j], 0, sizeof(Touch));
memset(&g_touchMove[j], 0, sizeof(Touch));
memset(&g_touchUp[j], 0, sizeof(Touch));
memset(&g_touchPrevious[j], 0, sizeof(Touch));
}
}
}
}

- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event
{
[m_renderer motionEnded:motion withEvent:event];
}

- (void)accelerometer:(UIAccelerometer*)accelerometer didAccelerate:(UIAcceleration*)acceleration
{
[m_renderer accelerometer:accelerometer didAccelerate:acceleration];
}

- (void)setRotation:(Rotation)rotation
{
[m_renderer setRotation:rotation];
}

- (void)resetRotation
{
[m_renderer resetRotation];
}

- (void)detectRotation
{
[m_renderer detectRotation];
}

- (void)buttonDown:(GamePadState)button
{
[m_renderer buttonDown:button];
}

- (void)buttonUp:(GamePadState)button
{
[m_renderer buttonUp:button];
}

#pragma mark -
#pragma mark UIKeyInput Protocol Methods

- (BOOL)hasText
{
    return NO;
}

- (void)insertText:(NSString *)text
{   
    char ch = [text characterAtIndex:0];
    char *pOn = strchr(ON_STATES, ch);
char *pOff = strchr(OFF_STATES, ch);
    bool stateChanged = false;

    if (pOn)
{
        int index = pOn - ON_STATES;
        m_gamePadState = (GamePadState) ((int)m_gamePadState | (1 << index));
        stateChanged = true;

        if (m_delegateFlags.buttonDown)
{
            [m_delegate buttonDown:(GamePadState)(1 << index)];
        }
    }
else if(pOff)
{
int index = pOff - OFF_STATES;
m_gamePadState = (GamePadState) ((int)m_gamePadState & ~(1 << index));
stateChanged = true;

if (m_delegateFlags.buttonUp)
{
[m_delegate buttonUp:(GamePadState)(1 << index)];
}
    }

    if (stateChanged && m_delegateFlags.stateChanged)
{
        [m_delegate stateChanged:m_gamePadState];
    }
   
static int cycleResponder = 0;
   
if (++cycleResponder > 20)
{
        // necessary to clear a buffer that accumulates internally
        cycleResponder = 0;
        [self resignFirstResponder];
        [self becomeFirstResponder];
    }
}

- (void)deleteBackward
{
    // This space intentionally left blank to complete protocol
}

#pragma mark -
#pragma mark Apple Game Controller

- (void)gameControllerDidConnect
{
[self gameControllerConnect];
}

- (void)gameControllerDidDisconnect
{
[self gameControllerConnect];
}

- (void)gameControllerConnect
{
int controllerCount = [[GCController controllers] count];

NSLog(@"ControllerCount %d", controllerCount);

if(controllerCount > 0)
g_inputDown |= DEVICE_APPLE;
else
g_inputDown &= ~DEVICE_APPLE;

[self configureConnectedGameControllers];
}

- (void) configureConnectedGameControllers
{
NSLog(@"configureConnectedGameControllers");
// First deal with the controllers previously set to a player
for (GCController *controller in [GCController controllers])
{
NSInteger playerIndex = (controller.playerIndex == GCControllerPlayerIndexUnset ? 0 : controller.playerIndex);
GCExtendedGamepad *profile = controller.extendedGamepad;

controller.controllerPausedHandler = ^(GCController *controller)
{
// Controller paused
// ok, we need this to be used for pause
g_inputDown |= INPUT_PAUSE;
};

profile.valueChangedHandler = ^(GCExtendedGamepad *gamepad, GCControllerElement *element)
{
if(element == gamepad.dpad)
{
float xValue = gamepad.dpad.xAxis.value;
float yValue = gamepad.dpad.yAxis.value;

float distance = hypotf(xValue, yValue);

if(gamepad.dpad.up.isPressed)
m_inputDown[playerIndex] |= APPLE_DPAD_UP;
else
m_inputDown[playerIndex] &= ~APPLE_DPAD_UP;

if(gamepad.dpad.down.isPressed)
m_inputDown[playerIndex] |= APPLE_DPAD_DOWN;
else
m_inputDown[playerIndex] &= ~APPLE_DPAD_DOWN;

if(gamepad.dpad.left.isPressed)
m_inputDown[playerIndex] |= APPLE_DPAD_LEFT;
else
m_inputDown[playerIndex] &= ~APPLE_DPAD_LEFT;

if(gamepad.dpad.right.isPressed)
m_inputDown[playerIndex] |= APPLE_DPAD_RIGHT;
else
m_inputDown[playerIndex] &= ~APPLE_DPAD_RIGHT;

if (distance > 0.0f)
[m_renderer gameControllerAnalogInput:playerIndex xValue:xValue yValue:yValue];
}
else if(element == gamepad.buttonA)
{
if(gamepad.buttonA.isPressed)
m_inputDown[playerIndex] |= APPLE_BUTTON_A;
else
m_inputDown[playerIndex] &= ~APPLE_BUTTON_A;
}
else if(element == gamepad.buttonB)
{
if(gamepad.buttonB.isPressed)
m_inputDown[playerIndex] |= APPLE_BUTTON_B;
else
m_inputDown[playerIndex] &= ~APPLE_BUTTON_B;
}
else if(element == gamepad.buttonX)
{
if(gamepad.buttonX.isPressed)
m_inputDown[playerIndex] |= APPLE_BUTTON_X;
else
m_inputDown[playerIndex] &= ~APPLE_BUTTON_X;
}
else if(element == gamepad.buttonY)
{
if(gamepad.buttonY.isPressed)
m_inputDown[playerIndex] |= APPLE_BUTTON_Y;
else
m_inputDown[playerIndex] &= ~APPLE_BUTTON_Y;
}

else if(element == gamepad.leftThumbstick)
{
NSLog(@"LEFT THUMB");

float xValue = gamepad.leftThumbstick.xAxis.value;
float yValue = gamepad.leftThumbstick.yAxis.value;
//float distance = hypotf(xValue, yValue);

if(gamepad.leftThumbstick.up.isPressed)
m_inputDown[playerIndex] |= APPLE_THUMB_LEFT_UP;
else
m_inputDown[playerIndex] &= ~APPLE_THUMB_LEFT_UP;

if(gamepad.leftThumbstick.down.isPressed)
m_inputDown[playerIndex] |= APPLE_THUMB_LEFT_DOWN;
else
m_inputDown[playerIndex] &= ~APPLE_THUMB_LEFT_DOWN;

if(gamepad.leftThumbstick.left.isPressed)
m_inputDown[playerIndex] |= APPLE_THUMB_LEFT_LEFT;
else
m_inputDown[playerIndex] &= ~APPLE_THUMB_LEFT_LEFT;

if(gamepad.leftThumbstick.right.isPressed)
m_inputDown[playerIndex] |= APPLE_THUMB_LEFT_RIGHT;
else
m_inputDown[playerIndex] &= ~APPLE_THUMB_LEFT_RIGHT;

// if (distance > 0.0f)
[m_renderer gameControllerAnalogInput:playerIndex xValue:xValue yValue:yValue];
}

else if(element == gamepad.rightThumbstick)
{
float xValue = gamepad.rightThumbstick.xAxis.value;
float yValue = gamepad.rightThumbstick.yAxis.value;
//float distance = hypotf(xValue, yValue);

if(gamepad.rightThumbstick.up.isPressed)
m_inputDown[playerIndex] |= APPLE_THUMB_RIGHT_UP;
else
m_inputDown[playerIndex] &= ~APPLE_THUMB_RIGHT_UP;

if(gamepad.rightThumbstick.down.isPressed)
m_inputDown[playerIndex] |= APPLE_THUMB_RIGHT_DOWN;
else
m_inputDown[playerIndex] &= ~APPLE_THUMB_RIGHT_DOWN;

if(gamepad.rightThumbstick.left.isPressed)
m_inputDown[playerIndex] |= APPLE_THUMB_RIGHT_LEFT;
else
m_inputDown[playerIndex] &= ~APPLE_THUMB_RIGHT_LEFT;

if(gamepad.rightThumbstick.right.isPressed)
m_inputDown[playerIndex] |= APPLE_THUMB_RIGHT_RIGHT;
else
m_inputDown[playerIndex] &= ~APPLE_THUMB_RIGHT_RIGHT;

//if (distance > 0.0f)
[m_renderer gameControllerAnalogInput:playerIndex xValue:xValue yValue:yValue];
}
else if(element == gamepad.leftShoulder)
{
if(gamepad.leftShoulder.isPressed)
m_inputDown[playerIndex] |= APPLE_SHOULDER_LEFT;
else
m_inputDown[playerIndex] &= ~APPLE_SHOULDER_LEFT;
}
else if(element == gamepad.rightShoulder)
{
if(gamepad.rightShoulder.isPressed)
m_inputDown[playerIndex] |= APPLE_SHOULDER_RIGHT;
else
m_inputDown[playerIndex] &= ~APPLE_SHOULDER_RIGHT;
}
else if(element == gamepad.leftTrigger)
{
if(gamepad.leftTrigger.isPressed)
m_inputDown[playerIndex] |= APPLE_TRIGGER_LEFT;
else
m_inputDown[playerIndex] &= ~APPLE_TRIGGER_LEFT;
}
else if(element == gamepad.rightTrigger)
{
if(gamepad.rightTrigger.isPressed)
m_inputDown[playerIndex] |= APPLE_TRIGGER_RIGHT;
else
m_inputDown[playerIndex] &= ~APPLE_TRIGGER_RIGHT;
}

if (g_joystick != NULL)
g_joystick->SetVisible(false); // Turn off joystick


// NSLog(@"Calling gameControllerButtonInput");
[m_renderer gameControllerButtonInput:playerIndex inputDown:m_inputDown[playerIndex]];
};
}
}

#pragma mark -
#pragma mark ***************

- (void)setDelegate:(id<GamePadEventDelegate>)delegate
{
    m_delegate = delegate;
 
if (!m_delegate)
return;
   
    m_delegateFlags.stateChanged = [m_delegate respondsToSelector:@selector(stateChanged:)];
    m_delegateFlags.buttonDown = [m_delegate respondsToSelector:@selector(buttonDown:)];
    m_delegateFlags.buttonUp = [m_delegate respondsToSelector:@selector(buttonUp:)];
}

- (UIView *) inputView
{
    return m_inputView;
}

- (void)setActive:(BOOL)value
{
    m_active = value;
   
if (m_active)
{
        [self becomeFirstResponder];
    }
else
{
        [self resignFirstResponder];
    }
}

- (void)addObservers
{
//[[UIAccelerometer sharedAccelerometer] setUpdateInterval:(1.0f / ACCELEROMETER_FREQUENCY)];
//[[UIAccelerometer sharedAccelerometer] setDelegate:self];

[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(detectRotation) name:UIDeviceOrientationDidChangeNotification object:nil];

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didEnterBackground) name:UIApplicationDidEnterBackgroundNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didBecomeActive) name:UIApplicationDidBecomeActiveNotification object:nil];

if(SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0"))
{
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(gameControllerDidConnect) name:GCControllerDidConnectNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(gameControllerDidDisconnect) name:GCControllerDidDisconnectNotification object:nil];
}
}

- (void)removeObservers
{
//[[UIAccelerometer sharedAccelerometer] setDelegate:nil];

[[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIDeviceOrientationDidChangeNotification object:nil];

[[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidEnterBackgroundNotification object:nil];
    [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidBecomeActiveNotification object:nil];

if(SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0"))
{
[[NSNotificationCenter defaultCenter] removeObserver:self name:GCControllerDidConnectNotification object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:GCControllerDidDisconnectNotification object:nil];
}
}

- (void)didEnterBackground
{
    if (self.active)
        [self resignFirstResponder];
}

- (void)didBecomeActive
{
    if (self.active)
        [self becomeFirstResponder];
}

- (BOOL)canBecomeFirstResponder
{
return YES;
}

@end



Offline spacefractal

  • RBP Team Member
  • Blue Gene Super Computer
  • *****
    • Posts: 4138
Reply #5 on: May 31, 2014, 11:34:01 am
the main problem here, there is allready a hidden UIview which glbasic uses (which supports iCade), which im cant do anything with completly at all. So im pretty sure there might been some UIview conflict here. glbasic do handle orientation correctly for MOUSESTATE. So im only want a function which can returns status of a button.

in xcode when im calls from glbasic im need to something like this without using a class (but internal of course can uses classes):

Code: [Select]
const char* StoreGetPrice(const char* productid)
{ NSString *ProductID = [[NSString alloc] initWithUTF8String:productid];
NSDictionary *prices = [[MKStoreManager sharedManager] pricesDictionary];
NSString *upgradePrice = [prices objectForKey:ProductID];

if (upgradePrice)
{ strcpy(iPrice, [upgradePrice UTF8String]);
}
return iPrice;
}

Im do pretty sure its can been added to the GameController function im created in glbasic/Java for Android, so its intefere with iOS instead.

On Android the orientation is automatic handled by the system. Im have only set one orientation value in the boot (to correct the navigation bar). In Karma Miwa its is handel by using "sensorLandscape" in its manifest, while in Greedy Mouse im used "sensor" in its manifest. For Greedy Mouse im did required checking a eventuelly surface change (but not orientation).

But im look on the code soon. Im should get one of the controller. Which one did you get?
« Last Edit: May 31, 2014, 11:37:33 am by spacefractal »

The Musician for the RetroBytes Portal Projects.


Offline headkaze

  • Administrator
  • Blue Gene Super Computer
  • **********
    • Posts: 7838
Reply #6 on: May 31, 2014, 03:05:39 pm
Check out the "#pragma mark Apple Game Controller" section for the game controller specific code.

Check for >= iOS 7 then add an 'observer' to listen for Game Controller events:
Code: [Select]
if(SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0"))
{
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(gameControllerDidConnect) name:GCControllerDidConnectNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(gameControllerDidDisconnect) name:GCControllerDidDisconnectNotification object:nil];
}

You will then get notifications calling your methods gameControllerDidConnect and gameControllerDidDisconnect.

When either of these methods are called we call configureConnectedGameControllers which basically defines all the code to process input inside an objective C "block":

ie.
Code: [Select]
profile.valueChangedHandler = ^(GCExtendedGamepad *gamepad, GCControllerElement *element)
{
if(gamepad.buttonA.isPressed)
// A button pressed
};

Flash actually bought the controller so I'm sure he can post what he got here.
« Last Edit: May 31, 2014, 03:13:43 pm by headkaze »



Offline flash

  • Administrator
  • Blue Gene Super Computer
  • **********
    • Posts: 13180
Reply #7 on: May 31, 2014, 03:15:56 pm
Im should get one of the controller. Which one did you get?

The one I got for testing was the Steelseries Stratus.

Rather expensive, but it does have the full compliment of buttons and 2 nubs.

http://steelseries.com/us/products/controllers/steelseries-stratus-wireless-gaming-controller
« Last Edit: May 31, 2014, 03:16:47 pm by Flash »

Coding for the love of it!


Offline spacefractal

  • RBP Team Member
  • Blue Gene Super Computer
  • *****
    • Posts: 4138
Reply #8 on: May 31, 2014, 03:26:36 pm
Much more expensive than those to Android with full profile. That is the issue with ios7 game controller really.

For android I'm even got a wired x-box and ps3 controller to work for my game. I'm also like ouya.

But very thanks for the code. I'm will look on that one. I'm do want to get one from eu, due vat and fee is high when import to Denmark.

The Musician for the RetroBytes Portal Projects.


Offline spacefractal

  • RBP Team Member
  • Blue Gene Super Computer
  • *****
    • Posts: 4138
Reply #9 on: June 03, 2014, 09:19:49 pm
while im diddent have seen those iOS gamecontroller got its succes, due too expensive prices (im do hopefully support it soon throught), then one thing im do like on the yesterday presentation:
Swift

If im should do something iOS exclusive programmer again, this could been possible and many people seen like it what they saw (include me). Would you have plans to uses it for a new project? Its mightbeen iOS8 exclusive, but its seen a cool language for causel games.

But until then its does not have its strenth against multi playform like glbasic have, which im still use.

Howover Genius Greedy Mouse was never a succes in freemium, and have not got any payment since (unlike Android version). So im upload a v2.0 which the game goes back to the Premium again. those who download now can get the game for free (and even have change the current inaopp purchase for now. People can still support me using the "Unlock All Levels" inapp purchase, im do wont remove. Its not a required purchase for complete the game anyway.

Im did that move because is would not work quite very well with Relaxed Greedy Mouse Maze, which have a quite fewer levels (until now its have 45 levels + 17 levels from removed light version (was Android exclusive long time ago). The main focus in this new spinoff is a relaxed gameplay without focus on puzzles (its more a trail & error gameplay). Im have used fake doors this time, but later will implement light off levels. Relaxed Greedy Mouse Maze would been a new app as a cheaper price (but free with ads on Android).
« Last Edit: June 03, 2014, 09:21:00 pm by spacefractal »

The Musician for the RetroBytes Portal Projects.


Offline flash

  • Administrator
  • Blue Gene Super Computer
  • **********
    • Posts: 13180
Reply #10 on: June 03, 2014, 09:26:01 pm
Talking of multi-platform,

Balders on the PS Vita.. :)


Coding for the love of it!


Offline spacefractal

  • RBP Team Member
  • Blue Gene Super Computer
  • *****
    • Posts: 4138
Reply #11 on: June 03, 2014, 09:28:14 pm
unity is great for multiplatform too, hehe. how goes with that. Here im have focus for iOS and Android, mostly Android really (this is property im are a much better Java coder than C-Objetive coder).

Swift is of course Apple exclusive, but nice one.

The Musician for the RetroBytes Portal Projects.


Offline flash

  • Administrator
  • Blue Gene Super Computer
  • **********
    • Posts: 13180
Reply #12 on: June 03, 2014, 09:36:58 pm
I have had a read of Swift (https://itunes.apple.com/us/book/the-swift-programming-language/id881256329?mt=11) and it looks ok. Anything is better than the hideous ObjC... though I am sure there is a ton of limitations.

Unity is handy because you can use C# (AWESOME) or JavaScipt (UnityScript). Of course, you still have all the issues with resolutions and inputs, but still sweet. Took 10 mins to get Balders on the Vita.

Saying that, Balders is rather sluggish on big levels? Something that did not affect the iPad noticeably. So, there is certainly the need for optimisation somewhere?

Coding for the love of it!


Offline spacefractal

  • RBP Team Member
  • Blue Gene Super Computer
  • *****
    • Posts: 4138
Reply #13 on: June 04, 2014, 09:08:07 am
of course there limitations with Swift, just like other langauges have limits in some contain point. The language was made for causel games, which im thinks its the right choice. Also games like some of my earlier games (those im wrote in BlitzMax) could have ported to.

Some AAA game have im heard is struttle a quite much on Vita. Im have not such a device.

Im did also have perforcement trouble with Ouya, which was not good fillrate, but ran both game ok with 720p, so im dropped using a 1080p surface.

Do you have plans to release Balders as a little finished product, eventuelly as a free game?

The Musician for the RetroBytes Portal Projects.


Offline flash

  • Administrator
  • Blue Gene Super Computer
  • **********
    • Posts: 13180
Reply #14 on: June 04, 2014, 09:21:35 am
I will release balders at some point as free homebrew only. It was just a games that I was comfortable to create in unity with the premise of learning the sdk. For that alone, it certainly served its purpose.

What I would really like is an artist to replace all the tile images for nice coloured hires ones for a release.

I haven't touched it for a while but have a few things I need for release.

Better graphics
Proper title screen
Completion code
More levels for the Redux level set.
Perhaps a few more objects?

And I did want to add an editor to the game? Perhaps one day when I can be bothered. Lol.


Coding for the love of it!


Offline flash

  • Administrator
  • Blue Gene Super Computer
  • **********
    • Posts: 13180
Reply #15 on: June 04, 2014, 09:22:29 am
Ps. I am quite happy to share the balders unity project to anyone who wants a play.

Coding for the love of it!


Offline spacefractal

  • RBP Team Member
  • Blue Gene Super Computer
  • *****
    • Posts: 4138
Reply #16 on: June 04, 2014, 11:48:24 am
im do wonder what Lobo is going today, even this time its of course not a paid game at all, and of course a homebrew version like our ds games. You cant uses a finished editor, like tiled. Tiled was the tile editor im used for both my games.

Its on http://www.mapeditor.org/

Im not sure you need a separate editor for game like this one? Except if you want a editor to been used on iPad of course. Then its a different matter.
« Last Edit: June 04, 2014, 11:49:31 am by spacefractal »

The Musician for the RetroBytes Portal Projects.


Offline Sokurah

  • RBP Member
  • Cray-1 Super Computer
  • *****
    • Posts: 724
    • Tardis Remakes
Reply #17 on: June 04, 2014, 01:14:16 pm
im do wonder what Lobo is going today.
Good question. His webpage, email and Twitter account doesn't exist anymore.
...whatever he's doing I hope he's doing well.



Offline flash

  • Administrator
  • Blue Gene Super Computer
  • **********
    • Posts: 13180
Reply #18 on: June 04, 2014, 01:49:43 pm
And he has not popped in here for 21 months.

Coding for the love of it!


Offline spacefractal

  • RBP Team Member
  • Blue Gene Super Computer
  • *****
    • Posts: 4138
Reply #19 on: June 09, 2014, 07:53:21 pm
Actuelly, Jungool works wonderfull with the Retina support, which im seen its a new (or have its allways been that)? Its works nice. So if its works so nice, then its should been possible to do a direct port as its are to MacOSx. Only thing im do saw that could been refine is the font on the talk bubble. Rest is perfect as its can been.

The Musician for the RetroBytes Portal Projects.


Offline flash

  • Administrator
  • Blue Gene Super Computer
  • **********
    • Posts: 13180
Reply #20 on: June 09, 2014, 09:05:14 pm
Have you tried it with the new controller support?

An osx port would have been nice once. I don't think I would consider it now. One of the main problems if the game runs at a fixed 30 fps (including physics) and making it run at a needed 60fps is a major nightmare - trust me, I have tried twice to link the physics to to update. Mostly my fault as originally all values were hard wired for a max of 60 fps (velocities and the such) as I had never had to work with variable framerates. Remember, jungool was the first game I worked on using C and a non fixed fps. It was a learning curve. Lol.

Coding for the love of it!


Offline spacefractal

  • RBP Team Member
  • Blue Gene Super Computer
  • *****
    • Posts: 4138
Reply #21 on: June 09, 2014, 10:03:16 pm
Framerate at 30 fps would not bother me. Have you tried 60fps Update for Wagga (or Camera) and let rest to been 30fps (kind of that many Amiga games did)? Howover not sure it's breaks box2d too?

But could release as it's are for Mac really.

I'm have not such of msi controllers, nor planning do have one right now. They cost as near much as a android console cost. I'm not understand they so expensive, when you compare to a standard controller.
« Last Edit: June 09, 2014, 10:20:40 pm by spacefractal »

The Musician for the RetroBytes Portal Projects.


Offline spacefractal

  • RBP Team Member
  • Blue Gene Super Computer
  • *****
    • Posts: 4138
Reply #22 on: June 12, 2014, 03:03:26 pm
A maze version of Greedy Mouse is design and technical finished. 80 levels is been included in that game. Howover im do need to wait a bit for some tips required in various places on the map.

This Greedy Mouse is choicen to been sold as own app. Im do later might do a inapp purchase for those level in Genius Greedy Mouse, but since that game is turned back to the premium model (for iOS version only, im not change model for Android, nor possible to do that), im wont do that me thinks, so better own app and a cheaper price.

EDIT:
Im except to implement MFI Game controller support for Karma Miwa in the summer. But glbasic do have its own issues, so its might not even been possible. on Android im even did even do a little doddly workaround the glbasic limit to calling Java by a import thing, but does not work with unknown controllers for Karma Miwa Android, due a simple stupid "bug". Im fix that soon.
« Last Edit: June 12, 2014, 07:37:54 pm by spacefractal »

The Musician for the RetroBytes Portal Projects.


Offline spacefractal

  • RBP Team Member
  • Blue Gene Super Computer
  • *****
    • Posts: 4138
Reply #23 on: June 23, 2014, 06:17:02 pm
While Setting up Android Icons is very easy, setting up iOS iCons is simply one of the worse peice of software ever. After 3 hours fight with that issue, xcode like constactly remame the file. Its have just the bug, its sometimes try to rename a other size icon to a allready exists one. Its toally insane stupid designed. Now im close to give up.

If you ask me, its xcode should just use the marked icon, but its have newer worked that way....

The Musician for the RetroBytes Portal Projects.


Offline spacefractal

  • RBP Team Member
  • Blue Gene Super Computer
  • *****
    • Posts: 4138
Reply #24 on: June 25, 2014, 04:09:54 pm
Finally im got the crappy icon issue working. Its a Area Android is much better, still. Why could xcode not update plist file correctly?

Howover im are heavy codning on my next game, Spot Race, which is turned to been a puzzle game now:
http://www.glbasic.com/forum/index.php?topic=9877.0

Im are not sure about the name. In this game you press on two images, which will been removed, if they can joined to a circle. This is really about it, but with few game modes as well and various grid sizes.

The game would now been focus for iOS (4.3)+ and Android (2.3+), both phones and tables.

The Musician for the RetroBytes Portal Projects.


Offline spacefractal

  • RBP Team Member
  • Blue Gene Super Computer
  • *****
    • Posts: 4138
Reply #25 on: July 02, 2014, 09:34:32 am
im are still complete noob how objects works in xcode. Im trying to do this:

Code: [Select]
#import <Foundation/NSObject.h>
#import <Foundation/NSString.h>
#import <Foundation/NSFileManager.h>
#import <Foundation/NSURL.h>
#import <Foundation/NSBundle.h>
#import <string.h>
#import <UIKit/UIKit.h>
#import <Social/Social.h>

void postToFacebook(const char* text, const char *url, const char *image)
{ NSString *Stext = [[NSString alloc] initWithUTF8String:text];
NSString *Surl = [[NSString alloc] initWithUTF8String:url];
NSString *Simage = [[NSString alloc] initWithUTF8String:image];

if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook])
{ SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[controller setInitialText:@"First post from my iPhone app"];
[controller addURL:[NSURL URLWithString:@"http://www.appcoda.com"]];
[controller addImage:[UIImage imageNamed:@"socialsharing-facebook-image.jpg"]];
[self presentViewController:controller animated:YES completion:Nil];
}
}

But its does require to change to do a object. Since im will call from glbasic directly, the function needs to been called without a object internal. Im have newer found how its actuelly works. Its or the new game.

OS. IM should also look on GameCenter, but since my games would been for both iOS and Android, im might implementing my little own system. Also there is too much cheating too on thier Leaderboards and Apple have not doing very much on that issue (as long they can send clear string without any hashing or such). Instead im might do my little own system, that works for both Android and iOS.
« Last Edit: July 02, 2014, 09:53:37 am by spacefractal »

The Musician for the RetroBytes Portal Projects.


Offline headkaze

  • Administrator
  • Blue Gene Super Computer
  • **********
    • Posts: 7838
Reply #26 on: July 03, 2014, 08:27:11 pm
Do you need your function exposed as a "C" function? In that case make your files extension .mm or make it Objective C++ format.

Next in your header surround your Objective C code in #ifdef __OBJC__ and in the #else section define your C prototypes. Then in the .mm file you can have your C functions call into your Objective C methods.

Here is my Facebook code.

-- FacebookPost.h --
Code: [Select]
//
//  FacebookPost.h
//  WinSolitaire
//
//  Created by Ben Baker on 6/10/13.
//  Copyright (c) 2013 Headsoft. All rights reserved.
//

#ifndef __FACEBOOKPOST_H__
#define __FACEBOOKPOST_H__

#ifdef __OBJC__

#import <Foundation/Foundation.h>
#import <FacebookSDK/FacebookSDK.h>

@interface FacebookPost : NSObject
{
NSString *m_name;
}

@property (retain) NSString *message;
@property (retain) NSString *name;

+ (void)postData:(NSString *)imageUrl message:(NSString *)message;
+ (void)postImage:(NSString *)imageUrl message:(NSString *)message;
+ (bool)isSessionOpen;
+ (void)openSession;
+ (void)closeSession;
+ (void)postWallImage:(NSString*)imageUrl message:(NSString *)message;

@end

#else

bool fbIsSessionOpen();
void fbOpenSession();
void fbCloseSession();

#endif

#endif

-- FacebookPost.mm --
Code: [Select]
//
//  FacebookPost.m
//  WinSolitaire
//
//  Created by Ben Baker on 6/10/13.
//  Copyright (c) 2013 Headsoft. All rights reserved.
//

#import "FacebookPost.h"
#import <FacebookSDK/FacebookSDK.h>
#import "SolitaireAppDelegate.h"
#import "GfxManager.h"

@implementation FacebookPost

static NSString *m_name = nil;

// Start here https://developers.facebook.com/docs/getting-started/getting-started-with-the-ios-sdk/
// Install the Facebook SDK, get it linked up, create an app, and get that setup correctly
// in your info.plist, appDelegate, and build settings.

+ (void)postData:(NSString *)imageUrl message:(NSString *)message
{
DEBUGLOG("postData");

[self postImage:imageUrl message:message];
}

+ (bool)isSessionOpen
{
return [[FBSession activeSession] isOpen];
}

+ (void)openSession
{
[FBSession openActiveSessionWithReadPermissions:[NSArray arrayWithObject:@"basic_info"]
allowLoginUI:!FBSession.activeSession.isOpen
completionHandler:^(FBSession *session, FBSessionState state, NSError *error)
{
[self sessionStateChanged:session state:state error:error];
}];

}

+ (void)sessionStateChanged:(FBSession *)session state:(FBSessionState) state error:(NSError *)error
{
    switch (state)
{
case FBSessionStateOpen:
if (error)
DEBUGLOG("Facebook: Session Error.");
else
DEBUGLOG("Facebook: Session Open.");
break;
case FBSessionStateClosed:
DEBUGLOG("FBSessionStateClosed: Facebook: Facebook: Closing Session.");
[FacebookPost closeSession];
[FacebookPost openSession];

break;
case FBSessionStateClosedLoginFailed:
DEBUGLOG("FBSessionStateClosedLoginFailed: Facebook: Closing Session.");
[self closeSession];
break;
default:
break;
    }
}

+ (void)closeSession
{
[FBSession.activeSession closeAndClearTokenInformation];
[FBSession.activeSession close];
// [FBSession setActiveSession:nil]; // This appeared to be causing the crash? V1.5

// Clear Facebook cookies
    NSHTTPCookieStorage* cookies = [NSHTTPCookieStorage sharedHTTPCookieStorage];
    NSArray* facebookCookies = [cookies cookiesForURL:[NSURL URLWithString:@"https://facebook.com/"]];

    for (NSHTTPCookie* cookie in facebookCookies)
        [cookies deleteCookie:cookie];
}

// https://developers.facebook.com/docs/ios/user-data-ios-sdk/
+ (void) getFacebookName
{
[FBRequestConnection startForMeWithCompletionHandler:^(FBRequestConnection *connection, id<FBGraphUser> user, NSError *error)
{
if (!error)
{
m_name = user.name;
}
}];
}

+ (void)postImage:(NSString *)imageUrl message:(NSString *)message
{
DEBUGLOG("postImage");

if ([[FBSession activeSession] isOpen])
{
// we defer request for permission to post to the moment of post, then we check for the permission
if ([FBSession.activeSession.permissions indexOfObject:@"publish_actions"] == NSNotFound)
{
// if we don't already have the permission, then we request it now
[FBSession.activeSession requestNewPublishPermissions:@[@"publish_actions"]
 defaultAudience:FBSessionDefaultAudienceEveryone
completionHandler:^(FBSession *session, NSError *error)
{
if (!error)
{
[self postWallImage:imageUrl message:message];
}
else if (error.fberrorCategory != FBErrorCategoryUserCancelled)
{
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Permission denied"
message:@"Unable to get permission to post"
delegate:nil
  cancelButtonTitle:@"OK"
  otherButtonTitles:nil];
[alertView show];
[alertView release];
}
}];
}
else
{
[self postWallImage:imageUrl message:message];
}
}
else
{
[FBSession openActiveSessionWithPublishPermissions:[NSArray arrayWithObject:@"publish_actions"]
  defaultAudience:FBSessionDefaultAudienceEveryone
 allowLoginUI:YES
completionHandler:^(FBSession *session, FBSessionState status, NSError *error)
{
[self sessionStateChanged:session state:status error:error];

if (!error)
{
if (FB_ISSESSIONOPENWITHSTATE(status))
{
[self postWallImage:imageUrl message:message];
}
}
else
{
DEBUGLOG("Error opening Facebook Session: %s", [(NSString *)[error localizedDescription] UTF8String]);
}
}];
}
}

+ (void)postWallImage:(NSString *)imageUrl message:(NSString *)message
{
DEBUGLOG("postDataWithPhoto");

// *** Example Data ***
// photoID: 1387931298109844
// currentSource: https://fbcdn-sphotos-d-a.akamaihd.net/hphotos-ak-ash4/1384079_1387931298109844_1334380320_n.jpg
// picture: https://fbcdn-photos-d-a.akamaihd.net/hphotos-ak-ash4/1384079_1387931298109844_1334380320_s.jpg
// link: https://www.facebook.com/photo.php?fbid=1387931298109844&set=p.1387931298109844&type=1

    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    [params setObject:message forKey:@"message"];
[params setObject:imageUrl forKey:@"picture"];
//[params setObject:link forKey:@"link"];
[params setObject:FACEBOOK_LINK_URL forKey:@"link"];
[params setObject:FACEBOOK_LINK_NAME forKey:@"name"];
[params setObject:FACEBOOK_LINK_CAPTION forKey:@"caption"];
[params setObject:FACEBOOK_LINK_DESCRIPTION forKey:@"description"];
//[params setObject:photoID forKey:@"object_attachment"];

    [FBRequestConnection startForPostWithGraphPath:@"me/feed"
  graphObject:(id<FBGraphObject>)[NSDictionary dictionaryWithDictionary:params]
completionHandler:^(FBRequestConnection *connection, id result, NSError *error)
{
         if (!error)
{
/* UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Success"
message:@"Your update has been posted to Facebook!"
delegate:self
  cancelButtonTitle:@"OK"
  otherButtonTitles:nil];

[alert show];
[alert release]; */
}
else
{
DEBUGLOG("postWallImage: Error opening Facebook Session: %s", [(NSString *)[error localizedDescription] UTF8String]);

             /* UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
message:@"Facebook had an error."
delegate:nil
  cancelButtonTitle:@"OK"
  otherButtonTitles:nil];

[alert show];
[alert release]; */
         }
     }];
}

@end

bool fbIsSessionOpen()
{
return [FacebookPost isSessionOpen];
}

void fbOpenSession()
{
[FacebookPost openSession];
}

void fbCloseSession()
{
[FacebookPost closeSession];
}
« Last Edit: July 03, 2014, 10:41:53 pm by headkaze »



Offline headkaze

  • Administrator
  • Blue Gene Super Computer
  • **********
    • Posts: 7838
Reply #27 on: July 13, 2014, 08:33:36 pm
Was my previous post helpful to you at all SF?



Offline spacefractal

  • RBP Team Member
  • Blue Gene Super Computer
  • *****
    • Posts: 4138
Reply #28 on: July 13, 2014, 08:58:36 pm
sorry, due the new user, im have overlooked this help. Thanks for the code, im look on that. Sadly my mac monitor got breaked, so im need to have a new (which im got a free one) and now im just need to get the vga cable tomorrow. That have take some days due that. Bugger.

glbasic do can call functions in both m and mm format. Howover im do needs to call them outside object first as easist way (im import them using a import function).

its for facebook can im see, but that would help for doing a twitter version. Im do uses facebook much more really.

But very thanks for the code HeadKaze :-D. Im look soon my mac is online again.
« Last Edit: July 13, 2014, 08:59:04 pm by spacefractal »

The Musician for the RetroBytes Portal Projects.


Offline spacefractal

  • RBP Team Member
  • Blue Gene Super Computer
  • *****
    • Posts: 4138
Reply #29 on: July 14, 2014, 08:17:36 pm
its will take a little longer time before im can look on the code. But soon its possible im will look on the facebook code here.

The Musician for the RetroBytes Portal Projects.