GLBasic forum

Main forum => GLBasic - en => Topic started by: BasicMe on 2012-Oct-09

Title: iPad 1 vs. iPad 2?
Post by: BasicMe on 2012-Oct-09
Is there a way for GLBasic to distinguish between 1st & 2nd generation iPads?  The screen resolution is the same, and PLATFORMINFO/DEVICE is supposed to give "IPAD" for both.

I ask, because the iPad 2 has twice the memory.  My current program runs fine on the 2, but runs out of memory on the 1.

I can tone down some of my graphics to let it run on the iPad 1, but I'd really like to keep the big animations on the iPad 2 for that extra polish.
Title: Re: iPad 1 vs. iPad 2?
Post by: spacefractal on 2012-Oct-09
yes, but require some c# code.

UIDeviceHardware.m (include that in xcode manual):
Code (glbasic) Select

//
//  UIDeviceHardware.m
//
//  Used to determine EXACT version of device software is running on.

#include <sys/types.h>
#include <sys/sysctl.h>

char iDevice[1024]="";

const char* deviceName()
{
    size_t size;
    sysctlbyname("hw.machine", NULL, &size, NULL, 0);
    char *machine = malloc(size);
    sysctlbyname("hw.machine", machine, &size, NULL, 0);
    NSString *platform = [NSString stringWithUTF8String:machine];
    strcpy(iDevice, [platform UTF8String]);
    free(machine);
    return iDevice;
}


in glbasic, retrive model number tas this:

Code (glbasic) Select

?IFDEF IPHONE
IMPORT "C" const char* deviceName()
devicefull$ = deviceName()
?ENDIF


Here is a list over codes (iPhone and iPod 5 missing but its iPhone4 and iPod5 (not sure minor number):
http://stackoverflow.com/questions/448162/determine-device-iphone-ipod-touch-with-iphone-sdk

There is rumors as iPad Mini got iPad2,5 and iPad2,6.
Title: Re: iPad 1 vs. iPad 2?
Post by: BasicMe on 2012-Oct-10
Ah cool, I'll try that.  Thanks, spacefractal!