Alex's iOS improvements

…have just landed in revision control. If you have an iOS project,
PLEASE update your copy of SDL if at all possible and let us know if
anything has totally blown up, as this is slated to ship soon in 2.0.4.

A quick list of improvements and fixes Alex made are noted here:

 https://hg.libsdl.org/SDL/rev/cf8fab52e33b

If you don’t want to screw around with Mercurial, this link will give
you a zipfile of the complete source code to the latest revision, just
download (about 7 megabytes), unzip, and point XCode at it:

 https://hg.libsdl.org/SDL/archive/default.zip

A big thank you to Alex for an enormous amount of work on this!

–ryan.

Also, keep in mind that retina-resolution handling for iOS was changed (it?s now consistent with SDL?s high-dpi APIs, and with how SDL works in OS X, as mentioned in the list of changes.)

Existing code using SDL for iOS that expected to have retina-resolution output but didn?t use SDL_WINDOW_ALLOW_HIGHDPI and SDL_GL_GetDrawableSize or SDL_GetRendererOutputSize will need to be updated.> On Apr 9, 2015, at 11:58 PM, Ryan C. Gordon wrote:

If you have an iOS project, PLEASE update your copy of SDL if at all possible and let us know if anything has totally blown up, as this is slated to ship soon in 2.0.4.

This is a large enough change that I feel justified in confirming that everything worked for me. ~150 kloc iOS codebase. Tested on the XCode 6.3 that shipped recently, no less. Tested on simulator and an iPad Air 2.

Thanks to Alex and Ryan for working on this!

Michael Labb?
@frogtoss> On Apr 9, 2015, at 7:58 PM, Ryan C. Gordon wrote:

…have just landed in revision control. If you have an iOS project, PLEASE update your copy of SDL if at all possible and let us know if anything has totally blown up, as this is slated to ship soon in 2.0.4.

A quick list of improvements and fixes Alex made are noted here:

https://hg.libsdl.org/SDL/rev/cf8fab52e33b

If you don’t want to screw around with Mercurial, this link will give you a zipfile of the complete source code to the latest revision, just download (about 7 megabytes), unzip, and point XCode at it:

https://hg.libsdl.org/SDL/archive/default.zip

A big thank you to Alex for an enormous amount of work on this!

–ryan.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Tested also on latest XCode 6.3 / iPhoneOS8.3.sdk and almost all
worked fine, I only notice :

1/ Indeed, we need to add the SDL_WINDOW_ALLOW_HIGHDPI flag when
creating the window + getting the renderer size by calling
SDL_GetRendererOutputSize.
Just wondering if it wouldn’t be easier if SDL_GetDisplayMode could
give the high dpi mode ?

2/ When testing Landscape mode on a real IPod Touch 4 (ios 6.1.6), I notice :

  • The device is in Portait. the Application draws in Portrait
    orientation with a Landscape Shape (a letterbox mode, with black on
    top and bottom). Bad.
    (and also with wrong touch coordinates)

  • When I rotate the device to landscape, it autorates to Landscape and
    lock in landscape. Ok.

I was expecting, as before, that it would automatically rotates to
landscape and lock to landscape.

To be in landscape, my Info.plist contains :
“UIInterfaceOrientation” and “UISupportedOrientation” both set to
"UIInterfaceOrientationLandscapeRight"
The hint “SDL_HINT_ORIENTATIONS” is set to “LandscapeLeft
LandscapeRight” (only “LandscapeLeft” or “LandscapeRight” is not
enough to have landscape )

3/ Probably ok. “SDL_uikview:setSDLWindow()” is always called twice.
(I have a splash screen).

Thanks to Alex and Ryan for this works!On Fri, Apr 10, 2015 at 10:18 AM, Michael Labb? wrote:

This is a large enough change that I feel justified in confirming that
everything worked for me. ~150 kloc iOS codebase. Tested on the XCode 6.3
that shipped recently, no less. Tested on simulator and an iPad Air 2.

Thanks to Alex and Ryan for working on this!

Michael Labb?
@frogtoss

On Apr 9, 2015, at 7:58 PM, Ryan C. Gordon wrote:

…have just landed in revision control. If you have an iOS project, PLEASE
update your copy of SDL if at all possible and let us know if anything has
totally blown up, as this is slated to ship soon in 2.0.4.

A quick list of improvements and fixes Alex made are noted here:

https://hg.libsdl.org/SDL/rev/cf8fab52e33b

If you don’t want to screw around with Mercurial, this link will give you a
zipfile of the complete source code to the latest revision, just download
(about 7 megabytes), unzip, and point XCode at it:

https://hg.libsdl.org/SDL/archive/default.zip

A big thank you to Alex for an enormous amount of work on this!

–ryan.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Sylvain Becker

Thanks for testing!

The display modes are in points rather than pixels in the OS X version of SDL as well. It?s probably better this way just because the coordinate systems of display modes / display positions and window sizes / window positions are the same right now.

It would be nice to have functions to get the actual pixel dimensions of a display mode though ? it?s something I?ve wanted but never got around to making a bugzilla report for.

I pushed a couple orientation-related fixes to my fork of SDL ( https://bitbucket.org/slime73/sdl-experiments/commits/all https://bitbucket.org/slime73/sdl-experiments/commits/all ), it?d be great if you could test that and see if those issues are resolved.> On Apr 10, 2015, at 6:31 AM, Sylvain Becker <sylvain.becker at gmail.com> wrote:

Tested also on latest XCode 6.3 / iPhoneOS8.3.sdk and almost all
worked fine, I only notice :

1/ Indeed, we need to add the SDL_WINDOW_ALLOW_HIGHDPI flag when
creating the window + getting the renderer size by calling
SDL_GetRendererOutputSize.
Just wondering if it wouldn’t be easier if SDL_GetDisplayMode could
give the high dpi mode ?

2/ When testing Landscape mode on a real IPod Touch 4 (ios 6.1.6), I notice :

  • The device is in Portait. the Application draws in Portrait
    orientation with a Landscape Shape (a letterbox mode, with black on
    top and bottom). Bad.
    (and also with wrong touch coordinates)

  • When I rotate the device to landscape, it autorates to Landscape and
    lock in landscape. Ok.

I was expecting, as before, that it would automatically rotates to
landscape and lock to landscape.

To be in landscape, my Info.plist contains :
“UIInterfaceOrientation” and “UISupportedOrientation” both set to
"UIInterfaceOrientationLandscapeRight"
The hint “SDL_HINT_ORIENTATIONS” is set to “LandscapeLeft
LandscapeRight” (only “LandscapeLeft” or “LandscapeRight” is not
enough to have landscape )


Sylvain Becker


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Great, it seems to be fixed:

The first commit solves the “letterbox / landscape” issue:

Though, I see no difference by adding the second one:

Moreover, I observed that setting the hint SDL_HINT_ORIENTATIONS to
"LandscapeLeft LandscapeRight" is not need anymore (only the
pInfo.list is used, like before).

Thanks,

SylvainOn Sun, Apr 12, 2015 at 6:59 AM, Alex Szpakowski wrote:

Thanks for testing!

The display modes are in points rather than pixels in the OS X version of
SDL as well. It?s probably better this way just because the coordinate
systems of display modes / display positions and window sizes / window
positions are the same right now.

It would be nice to have functions to get the actual pixel dimensions of a
display mode though ? it?s something I?ve wanted but never got around to
making a bugzilla report for.

I pushed a couple orientation-related fixes to my fork of SDL (
https://bitbucket.org/slime73/sdl-experiments/commits/all ), it?d be great
if you could test that and see if those issues are resolved.

On Apr 10, 2015, at 6:31 AM, Sylvain Becker <@Sylvain_Becker> wrote:

Tested also on latest XCode 6.3 / iPhoneOS8.3.sdk and almost all
worked fine, I only notice :

1/ Indeed, we need to add the SDL_WINDOW_ALLOW_HIGHDPI flag when
creating the window + getting the renderer size by calling
SDL_GetRendererOutputSize.
Just wondering if it wouldn’t be easier if SDL_GetDisplayMode could
give the high dpi mode ?

2/ When testing Landscape mode on a real IPod Touch 4 (ios 6.1.6), I notice
:

  • The device is in Portait. the Application draws in Portrait
    orientation with a Landscape Shape (a letterbox mode, with black on
    top and bottom). Bad.
    (and also with wrong touch coordinates)

  • When I rotate the device to landscape, it autorates to Landscape and
    lock in landscape. Ok.

I was expecting, as before, that it would automatically rotates to
landscape and lock to landscape.

To be in landscape, my Info.plist contains :
“UIInterfaceOrientation” and “UISupportedOrientation” both set to
"UIInterfaceOrientationLandscapeRight"
The hint “SDL_HINT_ORIENTATIONS” is set to “LandscapeLeft
LandscapeRight” (only “LandscapeLeft” or “LandscapeRight” is not
enough to have landscape )


Sylvain Becker


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Thanks to Alex and Ryan for working on this!

(this was almost all Alex: literally months of work on his part, fwiw.)

–ryan.

I pulled on Friday and did some testing over the weekend. So far, I
haven’t seen any serious problems or regressions.

I also tested my entire gamut (iOS, OS X, Linux, Windows, Android),
and things look equally good. (The SDLActivitiy.java changes are
always a gotcha for me…I’m not advocating stabilizing it yet, but I
hope we eventually get to a place where it does become stable.)

Anyway, great work Alex and thank you!

Thanks,
EricOn 4/9/15, Ryan C. Gordon wrote:

…have just landed in revision control. If you have an iOS project,
PLEASE update your copy of SDL if at all possible and let us know if
anything has totally blown up, as this is slated to ship soon in 2.0.4.


Beginning iPhone Games Development
http://playcontrol.net/iphonegamebook/

Extending the SDLActivity class helps here btw. (Now that the libs that
are loaded can be defined in the derived class).

See here:
https://github.com/mgerhardy/caveexpress/blob/master/android-project/src/org/base/BaseActivity.javaAm 21.04.2015 um 11:13 schrieb Eric Wing:

On 4/9/15, Ryan C. Gordon wrote:

…have just landed in revision control. If you have an iOS project,
PLEASE update your copy of SDL if at all possible and let us know if
anything has totally blown up, as this is slated to ship soon in 2.0.4.

I pulled on Friday and did some testing over the weekend. So far, I
haven’t seen any serious problems or regressions.

I also tested my entire gamut (iOS, OS X, Linux, Windows, Android),
and things look equally good. (The SDLActivitiy.java changes are
always a gotcha for me…I’m not advocating stabilizing it yet, but I
hope we eventually get to a place where it does become stable.)

SDL crashes on launch when I try to use a subclass of SDLActivity. I’m
going to move this to a new thread, but looking at the SDLActivity
code, I don’t think it is safe to subclass.

Thanks,
EricOn 4/21/15, Martin Gerhardy <martin.gerhardy at gmail.com> wrote:

Am 21.04.2015 um 11:13 schrieb Eric Wing:

On 4/9/15, Ryan C. Gordon wrote:

…have just landed in revision control. If you have an iOS project,
PLEASE update your copy of SDL if at all possible and let us know if
anything has totally blown up, as this is slated to ship soon in 2.0.4.

I pulled on Friday and did some testing over the weekend. So far, I
haven’t seen any serious problems or regressions.

I also tested my entire gamut (iOS, OS X, Linux, Windows, Android),
and things look equally good. (The SDLActivitiy.java changes are
always a gotcha for me…I’m not advocating stabilizing it yet, but I
hope we eventually get to a place where it does become stable.)

Extending the SDLActivity class helps here btw. (Now that the libs that
are loaded can be defined in the derived class).

See here:
https://github.com/mgerhardy/caveexpress/blob/master/android-project/src/org/base/BaseActivity.java


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Beginning iPhone Games Development
http://playcontrol.net/iphonegamebook/

I’ve fixed the issue by replacing the supportedInterfaceOrientations function in SDL_uikitviewcontroller.m with:

  • (NSUInteger)supportedInterfaceOrientations
    {
    // return UIKit_GetSupportedOrientations(window);
    return UIInterfaceOrientationMaskLandscape;
    }

I just updated my iOS code to the newest SDL-2.0.4-9574, and forcing landscape orientations using Info.plist seems to crash the application on launch.

It writes this to the console on my iPhone 4 (iOS 7.1):

: *** Terminating app due to uncaught exception ‘UIApplicationInvalidInterfaceOrientation’, reason: ‘Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES’

Which is odd, because I just went into the source code and found that shouldAutorotate was being set to NO…

Either way, enabling all orientations fixes the issue, but my app is definitely only playable in landscape mode :stuck_out_tongue:

Also this is probably intended, but setting the orientation hints using SDL does nothing now.