To know running idevice

Previous topic - Next topic

ampos

Is there a way to know the idevice the app is running?

-Ipad
-iPhone 2G
-iPhone 3G
-iPhone 3Gs
-iPhone 4

Jut desirees, of course... so we can adjust framerates for different devices...

:D

MrTAToad

#1
Shouldn't need to adjust frame rates :)

Its possible that few objects may be needed for some devices though...

Moebius

Adjusting frame rates for different devices could be necessary - Sandscapes Lite runs quite slowly on my earlier generation iTouch, and you would lose some of the effect by reducing the number of sand particles.

If it's difficult to get the device the app is running on, you could have a settings menu, but unlike PC users, iOS users would expect their apps to run without having to change graphics settings to lower quality - they would expect it to be done automatically.

Anyway, it should be possible (not necessarily easy) to detect the device (apps like Doodle jump must do it?).  Perhaps this could be an extension of PLATFORMINFO$("DEVICE"), which according to the help file currently can return "IPHONE", "IPOD TOUCH", and "IPAD".
Endless Loop: n., see Loop, Endless.
Loop, Endless: n., see Endless Loop.
- Random Shack Data Processing Dictionary

MrTAToad

QuoteSandscapes Lite runs quite slowly on my earlier generation iTouch
In that case the system used to generate a constant movement speed needs changing :)

Millerszone

Hardware: iMac 27", MacBook Air, PC 3.5Ghz Quad
Developing Tools: GLBasic SDK, Gideros Studio, PureBasic
Developing for: iOS, Android, Windows, OS X, webOS, HTML5

matchy

From that code reference, create a .... :nana:.... wrapper!!!! Something like this (not tested):


device.gbas
Code (glbasic) Select

DEBUG "Debug: "+glb_Device()+"\n"
?IFDEF IPHONE
IMPORT "C" void glb_Device()
?ELSE
FUNCTION glb_Device:
// instert code for other non-iphone sub platforms
ENDFUNCTION
?ENDIF


device.mm
Code (glbasic) Select


#import "UIDevice+machine.h"
#include <sys/types.h>
#include <sys/sysctl.h>

@implementation UIDevice(machine)

- (NSString *)machine
{
  size_t size;
  sysctlbyname("hw.machine", NULL, &size, NULL, 0);
  char *name = malloc(size);
  sysctlbyname("hw.machine", name, &size, NULL, 0);
  NSString *machine = [NSString stringWithCString:name];
  free(name);
  return machine;
}

@end

extern "C" void glb_Device() {} ///this should be string - someone please correct