ios - Sprite Kit game for Iphone 3.5 inch and 4 inch screen size -
i have developed little game in sprite kit xcode 5 4-inch screen, know if , how can use 3.5-inch. when open app iphone 5, ok, if try open iphone 4s simulator, lot of things hidden outside of screen.
i read lot of posts , solution seems constraints, best solution? work spritekit? how can use it?
for example positioned child this:
aasharebubbles *sharebubbles = [[aasharebubbles alloc] initwithpoint:cgpointmake(self.view.frame.size.width/2, (self.view.frame.size.height/2)+170)
170 absolute position. (height/2)+170 ok 4-inch screen, not 3.5-inch screen.
there many ways can different device either create different textureatlas different device size or easiest way change skview
for eg
add line viewcontroller
#define is_widescreen ( fabs( ( double )[ [ uiscreen mainscreen ] bounds ].size.height - ( double )568 ) < dbl_epsilon ) -(void)addloadingscene { if (ui_user_interface_idiom() == uiuserinterfaceidiomphone) { if (is_widescreen) { //this code iphone 4 inches //get device type _devicetype=iphonebig; //define globalscalex , globalscaley in header fine //where skview reference of view _globalscalex=(1024.0f*2)/(568*2); _globalscaley=(768.0f*2)/(320*2); yourfirstscreen = [loadingscene scenewithsize:cgsizemake(_skview.bounds.size.height*_globalscalex, _milkhuntskview.bounds.size.width*_globalscaley)]; //please take @ scalemode defined spritekit yourfirstscreen.scalemode = skscenescalemodefill; } else { //this code iphone 3.5 inches _devicetype=iphone; _globalscalex=(1024.0f*2)/(480*2); _globalscaley=(768.0f*2)/(320*2); yourfirstscreen = [loadingscene scenewithsize:cgsizemake(_skview.bounds.size.height.bounds.size.height*_globalscalex, _skview.bounds.size.height bounds.size.width*_globalscaley)]; yourfirstscreen.scalemode = skscenescalemodefill; } } else { //this code ipad _devicetype=ipad; _globalscalex=1.0f; _globalscaley=1.0f; loaderscreen = [loadingscene scenewithsize:cgsizemake(_skview.bounds.size.height.bounds.size.height, _skview.bounds.size.height.bounds.size.width)]; yourfirstscreen.scalemode = skscenescalemodeaspectfill; } [_skview presentscene:loaderscreen]; }
Comments
Post a Comment