Universal app example

a way that one can write 1 code for all apple devices.

I prepared an updated universal app example supporting iphone3g, iphone4s(retina),iphone5,ipad,ipad3.
I put it here as well for archive reasons. and to close this threat that I opened a while ago.

The example includes:

detection of each device,
retina support enabling
extends ofImage to Universal ofImage object that loads -if aditional assets are available by user- images for each device. if no assets are available it loads the standard img.

additional:

icons examples, SplashScreens examples, all added in info.plist
provides global booleans isIpad,isRetina,isIphone5 that can be used in code

gives a recommendation, a way to write one universal code and let the code scale everything up automatically based on the device. write one code for 320x480 resolution and it will be scaled to fit all devices loading all the hd graphics or 3g graphics or iphone5 - ipad graphics etc. if you prepare the separate images it loads them if not it just uses the standard images.
mapped mouseX/y to be used within the ofScale for all devices. overWritten ofGetWidth/height function to return screen size that works for all devices and not resolution. ofGetScreenWidth/height still returns resolution of each device separately

http://www.2shared.com/file/39R0GjOx/uofImageExample.html

This is super useful, an example like that should be included in the official release. Something like “UniversalDeviceSupport” example.

Thanks!

hi, I updated the example by adding a type device recognition similar to the one OF has

but instead it detects the device not by checking the NSstring that [[UIDevice currentDevice] model] returns.

So this is more accurate it works both on device and simulator and supports iphone 5 etc.

so in this example you can do:

  
  
    if (ofxGetDeviceType()== APPLE_DEVICE_IPHONE_RETINA) {  
        //<<"iphone4 iphone4s,ipod touch with retina screens";  
          
    }else if(ofxGetDeviceType()== APPLE_DEVICE_IPHONE_NONRETINA ){  
          
        //<<"older iphones iphone3gs old ipods etc";  
          
    }  

instead of:

  
  
    if (ofxiPhoneGetDeviceType()== OFXIPHONE_DEVICE_IPAD) {  
          
    } //etc...  
  
  

you can still write the single code and not touch this and let everything be scaled up for each device, but if you want to detect the device instead of using the booleans that I had on the previous you can additionally use this
method.

here is the new example:

http://www.2shared.com/file/gXDdyHQv/uofImageExample.html

The example can be found here now, https://github.com/igiso/ofxUniversalApp
data.zip (473.4 KB)

didn’t have Github back then