Author Topic: Universal build  (Read 2135 times)

peajey

  • Guest
Universal build
« on: July 30, 2012, 04:12:49 pm »
Is it possible to create a universal build for booth iPads and IPhones?

nednones

  • Guest
Re: Universal build
« Reply #1 on: July 31, 2012, 12:38:07 am »
You can but heres the way you should do it with DFSDK.

In your main app code, if an image/view is loaded to be say the  centre of the screen then you would use #if IPAD #else IPHONE #end and obtain the coordinates for your device to load the view correclty in the centre. Likewise, apply this to all your code scenarios when loading images/views and then when you submit your app just change the header file to either iPad or iPhone to ensure the correct .dll file is built with your app. That way you can easily create two folders for your iPad and iPhone. Hope that helps

tim

  • Administrator
  • Hero Member
  • *****
  • Posts: 1595
  • Karma: +11/-1
    • View Profile
    • DragonFireSDK
Re: Universal build
« Reply #2 on: July 31, 2012, 07:53:22 am »
We can certainly create a universal build when you're ready to go to the App Store.  Simply let us know when you submit your app that it needs to be a universal build...
Tim Sommers
DragonFireSDK Team

nednones

  • Guest
Re: Universal build
« Reply #3 on: July 31, 2012, 01:04:20 pm »
Tim, does this mean that we only need to create a single project and providing that an image which is located dependent on size of the device is specified then DFSDK will create two builds for us? If so how will you go about doing this. I'm currently working on an app for both iPad/iPhone and I want to be able to create only build. If I provide a section in my project which specifies which code to execute, e.g. #if iPad viewadd(image,ipadx,ipady) #else viewadd(image,iphonex,iphoney) #end. I'm confused as to how you will do this?

tim

  • Administrator
  • Hero Member
  • *****
  • Posts: 1595
  • Karma: +11/-1
    • View Profile
    • DragonFireSDK
Re: Universal build
« Reply #4 on: August 01, 2012, 08:38:30 am »
You will need to detect which device you are running on and load the appropriate assets.  The DeviceGetUIType() function will return a value that will let you know what type of device you are using.

You may want to separate out your images based on device class into folders of their own, e.g. Images/iPad or Images/iPhone.

This way you can (once and for all) set up the path for your images:

Code: [Select]
int DeviceType;
char ImagePath[100];
...
DeviceType=DeviceGetUIType(); // 0=iPhone; 1=iPad
if (DeviceType==0)
{
    strcpy(ImagePath,"Images/iPhone/");
}
else
{
    strcpy(ImagePath,"Images/iPad/");
}

Of course this is just off the top of my head, and you'll probably want to write your own method of accomplishing the same thing...

Hope this helps!
Tim Sommers
DragonFireSDK Team

peajey

  • Guest
Re: Universal build
« Reply #5 on: August 02, 2012, 03:47:24 pm »
This is great, Thanks!