hi all…
can someone who owns an ipad3 please tell us if this code detects the device??
to do this please return the ofGetWidth() or ofGetHeight()
I made the 2 BOOL for retina and ipad external and global so that they can be used in the whole project if needed…
the way I am going to approach this is I will replace all ofGetWidth() & height with 320,480 and then scale the whole project up by doing something like :
in the testapp.mm:
#include “Globals.h”
float width,height;
if (isRetina && isiPad){
//load stuff imgs etc
width = 1536/320;
height = 2048/480;
}
else if (!isRetina && !isiPad){
width = 1;
height = 1;
}
else if (isRetina && !isiPad){
width = 640/320;
height = 960/480;
}
else if (!isRetina && isiPad){
width = 768/320;
height = 1024/480;
}
ofScale(width,height);
(in the draw)
I think this is the best way to transform an app from 320 to all scales
note that if you load an hd image 500X500 and draw it lets say img.draw(0,0,10,10)
and then scale it
ofScale(12,12);
it will draw it in hd without pixels…
so in most cases just replace the image you load using the bool and load an hd…
(I havent reallly checked it on a device but i think it works… because scale is just multiplying the pixels)
///Globals.h\\\
#ifndef Butterfly_Globals_h
#define Butterfly_Globals_h
extern BOOL isRetina, isiPad;
#endif
//
// Globals.mm
#include <iostream>
BOOL isRetina, isiPad;
#include "ofMain.h"
#include "testApp.h"
#include "Globals.h"
int main(){
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) {
if ([[UIScreen mainScreen] scale] > 1)
isRetina = true;
}
if ([[UIDevice currentDevice] respondsToSelector:@selector(userInterfaceIdiom)])
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)
isiPad = true;
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad && [[UIScreen mainScreen] respondsToSelector:@selector(scale)] && [UIScreen mainScreen].scale > 1)
{
isRetina = true;
isiPad = true;
}
[pool release];
int width;
int height;
if (isRetina && isiPad){
width = 1536;
height = 2048;
}
else if (!isRetina && !isiPad){
width = 320;
height = 480;
}
else if (isRetina && !isiPad){
width = 640;
height = 960;
}
else if (!isRetina && isiPad){
width = 768;
height = 1024;
}
ofAppiPhoneWindow * iOSWindow = new ofAppiPhoneWindow();
ofSetupOpenGL(iOSWindow, width, height, OF_FULLSCREEN);
iOSWindow->enableRetinaSupport();
ofRunApp(new testApp);
}
I can test it on ipod retina on iphone and on normal ipad and it works… but I don’t have an ipad3…