GLBasic 64-bit

spacefractal · 53641

Offline headkaze

  • Administrator
  • Blue Gene Super Computer
  • **********
    • Posts: 7838
Reply #60 on: May 03, 2015, 12:32:39 pm
If you're losing input check the first responder code for your main UIView in your UIViewController.

Add the following code and then call [yourView setActive:YES]; to force it to accept input again.

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

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

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

- (BOOL)canBecomeFirstResponder
{
return YES;
}
« Last Edit: May 03, 2015, 12:34:35 pm by headkaze »



Offline spacefractal

  • RBP Team Member
  • Blue Gene Super Computer
  • *****
    • Posts: 4138
Reply #61 on: May 03, 2015, 04:49:29 pm
im can still not get it correct. Here is the two files im have modificed (im remove the files when downloaded):

(files have been downloadaed 3 times, so im thinks you got the file, otherwise im pm it.


« Last Edit: May 04, 2015, 05:51:17 am by spacefractal »

The Musician for the RetroBytes Portal Projects.


Offline spacefractal

  • RBP Team Member
  • Blue Gene Super Computer
  • *****
    • Posts: 4138
Reply #62 on: May 09, 2015, 09:20:04 pm
I'm hope I'm soon can fix this annoying so I'm can have great rotation support in y games. I'm did testede the code, but still issues and diddent work correctly.

However im can't do anything this or balder before next week, due upgrade issues and "burnt" both my CPUs. Damn. I'm now waiting for a new motherboard.

The Musician for the RetroBytes Portal Projects.


Offline headkaze

  • Administrator
  • Blue Gene Super Computer
  • **********
    • Posts: 7838
Reply #63 on: May 10, 2015, 04:19:11 pm
We still have rotation issues in WinSol that are yet to be solved. Apparently iOS 8.3 should fix some of these issues so I would just wait until it's released.

Quote
Rotation and Orientation fixes – A multitude of fixes are in iOS 8.3 for performance slowdowns related to app rotation and also orientation problems where devices fail to recognise which way they are being held or lock in one orientation.



Offline spacefractal

  • RBP Team Member
  • Blue Gene Super Computer
  • *****
    • Posts: 4138
Reply #64 on: May 10, 2015, 07:16:12 pm
Sorry about the confuction.

Its was more the focus issue, which seen was not fixed after inserted the code and calling it. There is something happens between UIViewController and UIView.

Im cant do anything more about rotation, which seens works correcrly in either landscape or portrait (but just not in both way, but that is much less important and something not need to look on at all). So nothing about this one, its just the damn focus issue.

checkout the project im gave you in pm as well the 4 changes files.
« Last Edit: May 10, 2015, 07:18:25 pm by spacefractal »

The Musician for the RetroBytes Portal Projects.


Offline headkaze

  • Administrator
  • Blue Gene Super Computer
  • **********
    • Posts: 7838
Reply #65 on: May 10, 2015, 11:50:11 pm
Sorry I could not get the input working on your app SF.

A couple of things I would suggest. Remove the threading code. Remove the message pump code. Use event driven code for iOS.

CFRunLoopRunInMode is bad. Use a timer or the recommended way CADisplayLink.



Offline spacefractal

  • RBP Team Member
  • Blue Gene Super Computer
  • *****
    • Posts: 4138
Reply #66 on: May 11, 2015, 05:20:39 am
im now home, so im edit a abit:

This input thing is happens soon I'm added the uiviewcontroller view (iphoneviewcontroller.m), which was commented out in iphoneappcontroller.m. The mouse code is in iphoneeaglview.m. Then im tried the focus code, which seen diddent do anything at all (im even commented out the iCade, who does something similar, just in case). Mightbeen im still do something wrong with that. Im thinks that is the main issue with the input.

The touchesBegan is not called at all when im enable uiviewcontroller (which does the auto rotations), but do im disable the uiviewcontroller, then touches works. But then rotation is in wrong again (which need to been set in portrait mode allways, so its a easy fix, but ui like keyboard does no longer follow systembar).

This is currently the main issue why I'm need help here. Sorry for the confuction.

Also the main screen is not animated at all, but you can see the game loading in the start.

Im do can tryout comment out the thread thing and see what its happens. Im do remember im did got a black screen since (but im testing very soon).
« Last Edit: May 11, 2015, 11:27:10 am by spacefractal »

The Musician for the RetroBytes Portal Projects.


Offline spacefractal

  • RBP Team Member
  • Blue Gene Super Computer
  • *****
    • Posts: 4138
Reply #67 on: May 11, 2015, 12:11:18 pm
im have commented out the thread.

im send you a new project with it and also demonstrate the issue.

if you use nrewrotation=1 (near top in iphoneappcontroller.m), then will try to uses iPhoneViewControllerWithRotation for the auto rotation. When im does that, then focus is lost. Im also thinks im might missing something to the responder code.

if im set it to nrewrotation=0, then the responder works fine in uiview.m (but rotation mightbeen 90 degree wrong, but dont worry about it at all here, im have just not set SETORIENTATION 1 which im normally need and set xcode to PORTRAIT mode).

Im thinks its still a responder issue.

im have no idea what CFRunLoopRunInMode and CADisplayLink does. Im do not thinks its a issue there at all?

its all about UIViewController, that take the responder as its not should do that. Rotation will works when this is fixed.

The Musician for the RetroBytes Portal Projects.


Offline headkaze

  • Administrator
  • Blue Gene Super Computer
  • **********
    • Posts: 7838
Reply #68 on: May 11, 2015, 03:00:22 pm
I understand what the problem is. I can't get input to work at all. No TouchesBegan event is ever fired. I also tried commenting out the iCade view. Nothing I tried work.

The thing is the way the app is designed is very different to a normal app. It is running the main loop in a custom thread and then calls the message pump manually. This is not the recommended way for a game loop on iOS. The recommended way is to use CADisplayLink.

I spent about an hour trying to fix it. Sorry I cannot help.
« Last Edit: May 11, 2015, 03:54:25 pm by headkaze »



Offline spacefractal

  • RBP Team Member
  • Blue Gene Super Computer
  • *****
    • Posts: 4138
Reply #69 on: May 11, 2015, 09:55:15 pm
Look like UiViewController have been broken by Apple. Sad. So no smooth orientation like on Android, which works pretty nice.

So im revert to the old code without using UiViewController complelty and dedicated to giving up UiViewController. Its just dont work correctly.

But very thanks for the help.

The only thing im can do and hope works is something like this in iPhoneSETORIENTATION() and hopefullly Keyboard rotate and touch still works:
[[UIDevice currentDevice] setValue:[NSNumber numberWithInteger:UIDeviceOrientationLandscapeRight] forKey:@"orientation"];



« Last Edit: May 11, 2015, 10:13:29 pm by spacefractal »

The Musician for the RetroBytes Portal Projects.


Offline spacefractal

  • RBP Team Member
  • Blue Gene Super Computer
  • *****
    • Posts: 4138
Reply #70 on: May 11, 2015, 10:33:56 pm
im thinks im have found a workaround. Its actuelly very wierd and was not excepted.

im using this code:
Code: [Select]
int iPhoneSETORIENTATION(int orig) {
if(orig==-1) {
if (nrewrotation==0) return 0;
            [gpimainView setActive:YES];
if (UIInterfaceOrientationLandscapeLeftSupported==YES || UIInterfaceOrientationLandscapeRightSupported==YES)
{ printf("islandscape, ");
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0"))
{ printf("0\n");
return 0;
}
printf("1\n");
return 1;
}
printf("0\n");
return 0;
}

        if(orig==0) {
            [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait];
            if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0")) {
[[UIDevice currentDevice] setValue:[NSNumber numberWithInteger:UIInterfaceOrientationPortraitUpsideDown] forKey:@"orientation"];
printf("UIInterfaceOrientationPortraitUpsideDown\n");
            }
        }
        if(orig==1) {
            [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight];
            if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0")) {
[[UIDevice currentDevice//] setValue:[NSNumber numberWithInteger:UIDeviceOrientationLandscapeLeft] forKey:@"orientation"];
printf("UIDeviceOrientationLandscapeLeft\n");
            }
        }
        if(orig==2) {
            [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortraitUpsideDown];
            if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0")) {
[[UIDevice currentDevice] setValue:[NSNumber numberWithInteger:UIDeviceOrientationPortrait] forKey:@"orientation"];
printf("UIDeviceOrientationPortrait\n");
            }
        }
        if(orig==3) {
            [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeLeft];
            if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0")) {
[[UIDevice currentDevice] setValue:[NSNumber numberWithInteger:UIDeviceOrientationLandscapeRight] forKey:@"orientation"];
printf("UIDeviceOrientationLandscapeRight\n");
            }
        }
return orig;
}

- When im doing the [[UIDevice currentDevice] line when GLB_IN_A_THREAD is defined, then the controller stops working after that line.
- But if im comment that define out, then its seens works.

wierd... So something with the costume thread does not working correctly. But that is something we cant do at all.

Also some commands send the pump command. This property due that way timers works in glbasic (here im mostly uses GETTIMERALL()) for gameplay timer).

PS. Here im do NOT using the UiViewController (im didicated to use a variable, so the smooth orientation can try fixed later one, but if above works, then its fine by now).

PPS. Again thanks for trying and for help.
« Last Edit: May 11, 2015, 10:43:28 pm by spacefractal »

The Musician for the RetroBytes Portal Projects.


Offline spacefractal

  • RBP Team Member
  • Blue Gene Super Computer
  • *****
    • Posts: 4138
Reply #71 on: May 12, 2015, 01:12:00 pm
Here is what im have tried to day:

Im tick "Portrait" mode in xXode only.

Then im can orientation the game correct and the systembar correctly too. BUT alert (just tested) is displayed wrong, which is still rotated in portrait:


That seen its require to tick "Landscape Left" and Landscape Right" to get it working.

BUT...
when doing that, its look like this:


damn, but in both cases touch input works nicely and there is no issues in first iPad.

If im adding the UiViewController, then the bounds seen to been fixed, but of course. There is a just another issue:

TouchBegan events newer respons.

So im didcated:
Apple have fucked Landscape mode pretty much very up and for some very odd reason nothing fellow the statusbar which its should really do. So im fell stupid and tired right now.

Im property not doing a another game for iOS currectly (while im havent started a new game in quite half year). But Android is currectly MUCH easier now and have not seen any issues like that after im fixed a similar orientation issue years back and was just called one java line to fix that. This one is much harder.

Im do more thinks something is totally wrong in this function (if its also possible to fix that one):
Code: [Select]
-(CGRect)boundsForOrientation{
    UIScreen *screen = [UIScreen mainScreen];
    CGRect screenRect;
    if (![screen respondsToSelector:@selector(fixedCoordinateSpace)] && UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation)) {
        printf("boundsForOrientation 1 ok\n");
        screenRect = CGRectMake(screen.bounds.origin.x, screen.bounds.origin.y, screen.bounds.size.height, screen.bounds.size.width);
    } else {
        printf("boundsForOrientation 2 ok\n");
        screenRect = screen.bounds;
printf("x: %f", screen.bounds.origin.x);
printf(" y: %f", screen.bounds.origin.y);
printf(" w: %f", screen.bounds.size.width);
printf(" h: %f", screen.bounds.size.height);
printf("\n");
    }

    return screenRect;
}
« Last Edit: May 12, 2015, 01:14:09 pm by spacefractal »

The Musician for the RetroBytes Portal Projects.


Offline headkaze

  • Administrator
  • Blue Gene Super Computer
  • **********
    • Posts: 7838
Reply #72 on: May 12, 2015, 01:28:45 pm
I actually do rotation manually in WinSol. It works fine for the most part. It might help you as I have the centre issue sorted.

You may need to modify it slightly as WinSol for the iPad displays a special PopoverViewController (hence the weird values in "IS_IPAD() ? CGRectMake(0, 0, 480, screenSize.height - 56)")

This code goes into your UIView.

Code: [Select]
- (void)rotateView:(UIInterfaceOrientation) orientation
{
CGSize screenSize = [[UIScreen mainScreen] bounds].size;

//DEBUGLOG("UIRotateView width: %.f height: %.f", screenSize.width, screenSize.height);

if(SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0"))
{
if (screenSize.width > screenSize.height && UIInterfaceOrientationIsPortrait(orientation))
screenSize = CGSizeMake(screenSize.height, screenSize.width);
else if (screenSize.height > screenSize.width && UIInterfaceOrientationIsLandscape(orientation))
screenSize = CGSizeMake(screenSize.height, screenSize.width);
}
else
screenSize = UIInterfaceOrientationIsPortrait(orientation) ? CGSizeMake(screenSize.height, screenSize.width) : screenSize;

self.bounds = IS_IPAD() ? CGRectMake(0, 0, 480, screenSize.height - 56) : CGRectMake(0, 0, screenSize.width, screenSize.height);
self.center = CGPointMake(self.bounds.size.width / 2, self.bounds.size.height / 2);

//CGRect toolBarFrame = self.toolBar.frame;
//toolBarFrame.size.width = self.bounds.size.width;
//self.toolBar.frame = toolBarFrame;
;

DEBUGLOG("[%s] UIRotateView width: %.f height: %.f (%s)", [NSStringFromClass([self class]) UTF8String], screenSize.width, screenSize.height, UIInterfaceOrientationIsPortrait(orientation) ? "Portrait" : "Landscape");

#if AUTOROTATE_MODE == 0
self.center = CGPointMake(self.bounds.size.width / 2, self.bounds.size.height / 2);
self.transform = CGAffineTransformIdentity;

switch (orientation)
{
case UIInterfaceOrientationPortrait:
self.transform = CGAffineTransformMakeRotation(DEGREES_TO_RADIANS(0));
break;
case UIInterfaceOrientationLandscapeRight:
self.transform = CGAffineTransformMakeRotation(DEGREES_TO_RADIANS(90));
break;
case UIInterfaceOrientationPortraitUpsideDown:
self.transform = CGAffineTransformMakeRotation(DEGREES_TO_RADIANS(180));
break;
case UIInterfaceOrientationLandscapeLeft:
self.transform = CGAffineTransformMakeRotation(DEGREES_TO_RADIANS(-90));
break;
default:
break;
}
#endif
}
« Last Edit: May 12, 2015, 01:41:24 pm by headkaze »



Offline spacefractal

  • RBP Team Member
  • Blue Gene Super Computer
  • *****
    • Posts: 4138
Reply #73 on: May 12, 2015, 02:12:37 pm
Pretty close really.

Here is what im now get when launch in landscape mode when uiinterface is landscape:


here is the bounds code:
Code: [Select]
-(CGRect)boundsForOrientation{
    int orientation=1; // not the  correct way to do for enduser, but this is just a orintation test.
CGSize screenSize = [[UIScreen mainScreen] bounds].size;

//DEBUGLOG("UIRotateView width: %.f height: %.f", screenSize.width, screenSize.height);

if(SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0"))
{
if (screenSize.width > screenSize.height && UIInterfaceOrientationIsPortrait(orientation))
screenSize = CGSizeMake(screenSize.height, screenSize.width);
else if (screenSize.height > screenSize.width && UIInterfaceOrientationIsLandscape(orientation))
screenSize = CGSizeMake(screenSize.height, screenSize.width);
}
else
screenSize = UIInterfaceOrientationIsPortrait(orientation) ? CGSizeMake(screenSize.height, screenSize.width) : screenSize;

    CGRect screenRect = CGRectMake(0, 0, screenSize.width, screenSize.height);
    return screenRect;
}

its still not make any seance here?
« Last Edit: May 12, 2015, 02:13:48 pm by spacefractal »

The Musician for the RetroBytes Portal Projects.


Offline headkaze

  • Administrator
  • Blue Gene Super Computer
  • **********
    • Posts: 7838
Reply #74 on: May 12, 2015, 03:12:20 pm
You need to do more than set the size. Check my code again where it sets the center.

Code: [Select]
self.center = CGPointMake(self.bounds.size.width / 2, self.bounds.size.height / 2);
« Last Edit: May 12, 2015, 03:13:25 pm by headkaze »



Offline spacefractal

  • RBP Team Member
  • Blue Gene Super Computer
  • *****
    • Posts: 4138
Reply #75 on: May 12, 2015, 03:27:46 pm
-(CGRect)boundsForOrientation is invoked in the startup, not on the orientation (which fells works with SETORIENTATION command).

yes im did see the self.center, but xcode diddent gave anything in UiApplication, so im trought its was a UiViewController thing (which im cant uses)?

Im do tryout that later today or tomorrow.

The Musician for the RetroBytes Portal Projects.


Offline spacefractal

  • RBP Team Member
  • Blue Gene Super Computer
  • *****
    • Posts: 4138
Reply #76 on: May 12, 2015, 10:31:40 pm
actuelly im got it partically works, but only on iPad 1 and iPad 3.

The window.center codes seen not allways required for some odd reason.

here the bounds code:
Code: [Select]
-(CGRect)boundsForOrientation{
    int orientation=1;
//    if (UIInterfaceOrientationLandscapeLeftSupported == YES) orientation=1;
//    if (UIInterfaceOrientationLandscapeRightSupported == YES) orientation=3;
    
CGSize screenSize = [[UIScreen mainScreen] bounds].size;

//DEBUGLOG("UIRotateView width: %.f height: %.f", screenSize.width, screenSize.height);

if(SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0"))
{
if (screenSize.width > screenSize.height && UIInterfaceOrientationIsPortrait(orientation))
screenSize = CGSizeMake(screenSize.height, screenSize.width);
else if (screenSize.height > screenSize.width && UIInterfaceOrientationIsLandscape(orientation))
screenSize = CGSizeMake(screenSize.height, screenSize.width);
}
else
screenSize = UIInterfaceOrientationIsPortrait(orientation) ? CGSizeMake(screenSize.height, screenSize.width) : screenSize;

    CGRect screenRect = CGRectMake(0, 0, screenSize.width, screenSize.height);
    return screenRect;
}

Im uses this code now after have init the eagle frame:
Code: [Select]
   if(SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0"))
    {
        if(UIInterfaceOrientationLandscapeLeftSupported == YES || UIInterfaceOrientationLandscapeRightSupported == YES)
        {   int l=bounds.size.width-bounds.size.height;
            window.center = CGPointMake(bounds.size.width/2, bounds.size.height/2+l);
        }
    }

But its works only on iPad 3 (and iPad 1 also works too). The code above also does not work on iPhone 6, which seen center the window allready correctly without the window.center code (just like iPad 1), hence its can been skipped. Im do property sure iPhone 6+ would behaive same as on iPad 3.
« Last Edit: May 12, 2015, 10:34:33 pm by spacefractal »

The Musician for the RetroBytes Portal Projects.


Offline spacefractal

  • RBP Team Member
  • Blue Gene Super Computer
  • *****
    • Posts: 4138
Reply #77 on: May 12, 2015, 10:50:15 pm
im send a new project, because im want to sure its works on all devices, but im pretty sure im 95% in goal.

Mostly the most thing fixing is only required to been done in boundsForOrientation() and in window.center code.


im thinks its might not work correctly for iPhone 5, which you have.

So this is more testing than fixing.

Dont think about the UIViewController at all. This will just breaks UIView completly. so dont waste time about that. This is best im can do.

PS. The alert box is just a orientation test, its will been removed again.
« Last Edit: May 12, 2015, 10:59:10 pm by spacefractal »

The Musician for the RetroBytes Portal Projects.


Offline headkaze

  • Administrator
  • Blue Gene Super Computer
  • **********
    • Posts: 7838
Reply #78 on: May 12, 2015, 11:47:56 pm
It doesn't work on my iPhone 5. You could try using rotation notifications for rotation like we do in Jungool. Since I don't know how you're dealing with rotation already I'll post the code.

BTW Are you rotating the actual screen in OpenGL? Make sure you are only rotating the UIView OR the model view matrix in OpenGL. Do not rotate both!

Attach a notification handler for rotation (your glView should be fine)
Code: [Select]
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(detectRotation) name:UIDeviceOrientationDidChangeNotification object:nil];

put this code in your dealloc
Code: [Select]
[[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIDeviceOrientationDidChangeNotification object:nil];

This is the rotation handler
Code: [Select]
- (void)detectRotation
{
UIDeviceOrientation deviceOrientation = [[UIDevice currentDevice] orientation];
UIInterfaceOrientation interfaceOrienation;

//DEBUGLOG("EAGLView detectRotation - ORIENTATION %d", interfaceOrienation );

if(!UIDeviceOrientationIsValidInterfaceOrientation(deviceOrientation))
return;

switch(deviceOrientation)
{
case UIDeviceOrientationUnknown:
case UIDeviceOrientationFaceUp:
case UIDeviceOrientationFaceDown:
break;
case UIDeviceOrientationPortrait:
interfaceOrienation = UIInterfaceOrientationPortrait;
break;
case UIDeviceOrientationPortraitUpsideDown:
interfaceOrienation = UIInterfaceOrientationPortraitUpsideDown;
break;
case UIDeviceOrientationLandscapeRight:
interfaceOrienation = UIInterfaceOrientationLandscapeLeft;
break;
case UIDeviceOrientationLandscapeLeft:
interfaceOrienation = UIInterfaceOrientationLandscapeRight;
break;
}

[self rotateView:interfaceOrienation];
}

Notice at the end it calls my original "rotateView" method.

Also note to get the first "orientation" of the device when it starts
Code: [Select]
UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
Also to get the starting bounds before rotation you can use this
Code: [Select]
CGRect bounds = [UIScreen mainScreen].bounds;
« Last Edit: May 12, 2015, 11:49:44 pm by headkaze »



Offline headkaze

  • Administrator
  • Blue Gene Super Computer
  • **********
    • Posts: 7838
Reply #79 on: May 12, 2015, 11:48:58 pm
Keep in mind you can also use OpenGL to handle rotation.

Code: [Select]
static inline void rotateScreen()
{
if(g_isOGLES2)
{
switch(g_displayScreen->Angle)
{
case ROTATION_NONE:
case ROTATION_0:
g_modelViewMatrix *= Matrix4D::RotateZ(0);
break;
case ROTATION_90:
g_modelViewMatrix *= Matrix4D::RotateZ(90);
break;
case ROTATION_180:
g_modelViewMatrix *= Matrix4D::RotateZ(180);
break;
case ROTATION_270:
g_modelViewMatrix *= Matrix4D::RotateZ(270);
break;
}
}
else
{
switch(g_displayScreen->Angle)
{
case ROTATION_NONE:
case ROTATION_0:
glRotatef(0, 0.0f, 0.0f, 1.0f);
break;
case ROTATION_90:
glRotatef(90, 0.0f, 0.0f, 1.0f);
break;
case ROTATION_180:
glRotatef(180, 0.0f, 0.0f, 1.0f);
break;
case ROTATION_270:
glRotatef(270, 0.0f, 0.0f, 1.0f);
break;
}
}
}

As I mentioned though only use one method. UIViewController OR rotating UIView manually as in previous post OR OpenGL rotation like above.
« Last Edit: May 12, 2015, 11:51:07 pm by headkaze »



Offline spacefractal

  • RBP Team Member
  • Blue Gene Super Computer
  • *****
    • Posts: 4138
Reply #80 on: May 13, 2015, 12:07:19 pm
iOS8 landscape is still a mess!!!

Im cannot even set the windows bounds correct with just a red background screen without other content.

Here is the changed iPhoneappcontroller.m
« Last Edit: May 13, 2015, 04:34:52 pm by spacefractal »

The Musician for the RetroBytes Portal Projects.


Offline spacefractal

  • RBP Team Member
  • Blue Gene Super Computer
  • *****
    • Posts: 4138
Reply #81 on: May 13, 2015, 12:24:41 pm
im also just tried this one:
Code: [Select]
-(CGRect)boundsForOrientation{
CGSize screenSize = [[UIScreen mainScreen] bounds].size;
    printf("**** Changed orientation: %d \n", interfaceOrienation);
if(SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0"))
    {   CGRect bounds = CGRectMake(0, 0, screenSize.width, screenSize.height);
CGSize size;
screenSize = [UIScreen mainScreen].bounds.size;
if ((NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_7_1) && UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation)) {
size=CGSizeMake(screenSize.height, screenSize.width);
}
        bounds = CGRectMake(0, 0, screenSize.height, screenSize.width);
        return bounds;
    }
else
    {
screenSize = UIInterfaceOrientationIsPortrait(interfaceOrienation) ? CGSizeMake(screenSize.width, screenSize.height) : screenSize;
        CGRect bounds = CGRectMake(0, 0, screenSize.width, screenSize.height);
        return bounds;
    }
}

But still issues on iPad 3 (X/Y Swapped), but seen works on iPhone 6 and iPad 1. So im newer undstand why its so complicered to get orientation correct in that one.

Ps. Thanks for the help even it's not in goal yet. When finally fixed with this most annoying issue I'm can give you something.

« Last Edit: May 13, 2015, 12:48:39 pm by spacefractal »

The Musician for the RetroBytes Portal Projects.


Offline headkaze

  • Administrator
  • Blue Gene Super Computer
  • **********
    • Posts: 7838
Reply #82 on: May 13, 2015, 02:21:47 pm
I think part of the difficulty is you're not using Interface Builder and doing everything programmatically.

I have a sneaky suspicion the issue is related to the auto sizing mask for your OpenGL UIView.

Please take a look at http://stackoverflow.com/questions/7754851/autoresizing-masks-programmatically-vs-interface-builder-xib-nib

Yes I have had so many problems dealing with rotation issues in iOS over the years. Just ask Flash lol. I believe at one point I actually said that one of the most challenging aspects of iOS development was dealing with rotation. I think that was a lot to do with the fact it kept changing how it worked over the years. Jungool and WinSol are no doubt doing it the wrong way which is most likely why there are so many problems with it in iOS 8. That coupled with the fact Apple have acknowledged rotation issues in iOS 8 it has been for the most part a giant PITA.
« Last Edit: May 13, 2015, 02:25:40 pm by headkaze »



Offline spacefractal

  • RBP Team Member
  • Blue Gene Super Computer
  • *****
    • Posts: 4138
Reply #83 on: May 13, 2015, 02:36:51 pm
And is still not fixed in iOS8.3. Im fell its more more a bug now. Its pity when something happens on some devices.

Also as long im using portrait only set, then its actuelly works fine, but then alert boxes and other UIView does not like that. Its very pity they just can follow the systembar orientation. Im dont understand why Applie have broke that.

On Android in the other way, its works with no kind in those issues you see with iOS8.0 and im can even uses system rotation using AndroidManifest.xml, which is the correct way to do that on Android.
« Last Edit: May 13, 2015, 02:48:22 pm by spacefractal »

The Musician for the RetroBytes Portal Projects.


Offline spacefractal

  • RBP Team Member
  • Blue Gene Super Computer
  • *****
    • Posts: 4138
Reply #84 on: May 13, 2015, 03:47:56 pm
im thinks its confirmed its a totally nasty bug from Apple side :-(.

this is simply incredibly!

Its seen its just impossible to detect the app have been started from portrait mode.

when im holding it on portrait mode. Then its will insistate starting in landscape mode, not in portrait mode.

On iPad 3, this thing does correctly.

So im can only gonna see this as a bug.

The Musician for the RetroBytes Portal Projects.


Offline headkaze

  • Administrator
  • Blue Gene Super Computer
  • **********
    • Posts: 7838
Reply #85 on: May 13, 2015, 03:50:08 pm
What I've noticed is the UIWindow is not centered correctly for some reason. So no matter what you do with the UIView it will be wrong.

Does this help? http://stackoverflow.com/questions/26706050/custom-uiwindows-do-not-rotate-correctly-in-ios-8



Offline spacefractal

  • RBP Team Member
  • Blue Gene Super Computer
  • *****
    • Posts: 4138
Reply #86 on: May 13, 2015, 04:13:59 pm
the currect issue now is iPad 3 (8.3) does complete opposite than iPhone 6 (8.2) does which im dosent understand.

Now im update my iPhone to 8.3 (was 8.2, which could been the reason) and see that help.

If its does the job im will not do anything more about that. Im see.

But im do lost the emulator thing throught, which was why im diddent just update it.

The Musician for the RetroBytes Portal Projects.


Offline spacefractal

  • RBP Team Member
  • Blue Gene Super Computer
  • *****
    • Posts: 4138
Reply #87 on: May 13, 2015, 04:51:02 pm
Did not help. Iphone all ways start app in landscape mode and then soon after correct it to portrait.

But I'm need to do a way to detect the app did started I'm portrait mode, not in landscape mode.

Orientation does correctly on iPad, but not on iPhone.

I'm do thinks I'm might want to add the content thing after invoked SETORIENTATION -1, not on startup.


The Musician for the RetroBytes Portal Projects.


Offline headkaze

  • Administrator
  • Blue Gene Super Computer
  • **********
    • Posts: 7838
Reply #88 on: May 13, 2015, 05:10:44 pm
This is where I do it (note the various ways I've had to change rotation detection)

Code: [Select]
- (void)viewDidAppear:(BOOL)animated
{
//UIInterfaceOrientation orientation = [m_viewController interfaceOrientation];
//UIInterfaceOrientation orientation = [[UIDevice currentDevice] orientation];
UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];

[self rotateView:orientation];
}



Offline spacefractal

  • RBP Team Member
  • Blue Gene Super Computer
  • *****
    • Posts: 4138
Reply #89 on: May 13, 2015, 09:21:30 pm
im go back to the UiViewController again, which im fell is the only right way to do.

Im for fun tried to move touchbegan calls to UiViewController rather than UiView. That seen its did called them there.

So its seen im need to move all mouse code to the UiViewController code instead.

Since im want to that, its because the orientation does correct on both devices and does not even need some special code. Doing its programming wice seens to been to much wrong and you can trust the values you might get.

The Musician for the RetroBytes Portal Projects.