diff --git a/samples/HelloCpp/Resources/iphonehd/HelloWorld.png.REMOVED.git-id b/samples/HelloCpp/Resources/iphonehd/HelloWorld.png.REMOVED.git-id index d81514b887..9540c0bfb7 100644 --- a/samples/HelloCpp/Resources/iphonehd/HelloWorld.png.REMOVED.git-id +++ b/samples/HelloCpp/Resources/iphonehd/HelloWorld.png.REMOVED.git-id @@ -1 +1 @@ -e35126a63c774b4967e6b0e31082d7a32f58ed02 \ No newline at end of file +6b7a2544be32ce26e75737865743649598d83bdf \ No newline at end of file diff --git a/samples/SimpleGame/Classes/AppDelegate.cpp b/samples/SimpleGame/Classes/AppDelegate.cpp index a614d78518..e810c9fa23 100644 --- a/samples/SimpleGame/Classes/AppDelegate.cpp +++ b/samples/SimpleGame/Classes/AppDelegate.cpp @@ -31,17 +31,15 @@ bool AppDelegate::applicationDidFinishLaunching() { } else if (target == kTargetIphone) { - if (CCEGLView::sharedOpenGLView()->enableRetina()) + if (CCDirector::sharedDirector()->enableRetinaDisplay(true)) { - // well, it's a iPhone 4 and above, with 960x480 Retina resolution + // well, it's a iPhone 4, iPhone 4S or iPhone 5 CCFileUtils::sharedFileUtils()->setResourceDirectory("hd"); - CCEGLView::sharedOpenGLView()->setDesignResolutionSize(960, 640, kResolutionNoBorder); } else { // iPhone 3GS and before, with 480x320 resolution CCFileUtils::sharedFileUtils()->setResourceDirectory("sd"); - CCEGLView::sharedOpenGLView()->setDesignResolutionSize(480, 320, kResolutionNoBorder); } } else diff --git a/samples/SimpleGame/Classes/HelloWorldScene.cpp b/samples/SimpleGame/Classes/HelloWorldScene.cpp index 04e523e338..50708b2e56 100755 --- a/samples/SimpleGame/Classes/HelloWorldScene.cpp +++ b/samples/SimpleGame/Classes/HelloWorldScene.cpp @@ -4,8 +4,6 @@ using namespace cocos2d; -extern float g_scaleRatio; - HelloWorld::~HelloWorld() { if (_targets) @@ -28,18 +26,7 @@ HelloWorld::HelloWorld() :_targets(NULL) ,_projectiles(NULL) ,_projectilesDestroyed(0) -,_scaleRatio(1.0) { - if ( 0 == strcmp(CCFileUtils::sharedFileUtils()->getResourceDirectory(), "hd/") ) - { - // AppDelegate.cpp used hd resource & 960x640 design resolution - _scaleRatio = 2.0; - } - else - { - // sd - _scaleRatio = 1.0; - } } CCScene* HelloWorld::scene() @@ -106,7 +93,7 @@ bool HelloWorld::init() ///////////////////////////// // 2. add your codes below... - CCSprite *player = CCSprite::create("Player.png", CCRectMake(0, 0, 27*_scaleRatio, 40*_scaleRatio) ); + CCSprite *player = CCSprite::create("Player.png", CCRectMake(0, 0, 27, 40) ); player->setPosition( ccp(origin.x + player->getContentSize().width/2, origin.y + visibleSize.height/2) ); @@ -140,7 +127,7 @@ void HelloWorld::menuCloseCallback(CCObject* pSender) // cpp with cocos2d-x void HelloWorld::addTarget() { - CCSprite *target = CCSprite::create("Target.png", CCRectMake(0,0,27*_scaleRatio,40*_scaleRatio) ); + CCSprite *target = CCSprite::create("Target.png", CCRectMake(0,0,27,40) ); // Determine where to spawn the target along the Y axis CCSize winSize = CCDirector::sharedDirector()->getVisibleSize(); @@ -212,7 +199,7 @@ void HelloWorld::ccTouchesEnded(CCSet* touches, CCEvent* event) // Set up initial location of projectile CCSize winSize = CCDirector::sharedDirector()->getVisibleSize(); - CCSprite *projectile = CCSprite::create("Projectile.png", CCRectMake(0, 0, 20*_scaleRatio, 20*_scaleRatio)); + CCSprite *projectile = CCSprite::create("Projectile.png", CCRectMake(0, 0, 20, 20)); projectile->setPosition( ccp(20, winSize.height/2) ); // Determinie offset of location to projectile diff --git a/samples/SimpleGame/Classes/HelloWorldScene.h b/samples/SimpleGame/Classes/HelloWorldScene.h index d88c7aa81b..c1fcbd2f1c 100755 --- a/samples/SimpleGame/Classes/HelloWorldScene.h +++ b/samples/SimpleGame/Classes/HelloWorldScene.h @@ -38,7 +38,6 @@ protected: cocos2d::CCArray *_targets; cocos2d::CCArray *_projectiles; int _projectilesDestroyed; - float _scaleRatio; void addTarget();