issue #1405:zoom out work ok

This commit is contained in:
minggo 2012-08-07 18:24:45 +08:00
parent 5d8f909af4
commit f6115d5667
5 changed files with 10 additions and 11 deletions

View File

@ -90,11 +90,12 @@ void CCEGLViewProtocol::setDesignResolutionSize(float width, float height, Resol
m_eResolutionPolicy = resolutionPolicy;
setViewPortInPoints(0, 0, m_obScreenSize.width, m_obScreenSize.height);
//setViewPortInPoints(0, 0,m_obScreenSize.width, m_obScreenSize.height);
// reset director's member vaviables to fit visible rect
CCDirector::sharedDirector()->createStatsLabel();
CCDirector::sharedDirector()->m_obWinSizeInPoints = CCDirector::sharedDirector()->m_obWinSizeInPixels = getSize();
CCDirector::sharedDirector()->setGLDefaultValues();
}
bool CCEGLViewProtocol::enableRetina()
@ -205,7 +206,7 @@ void CCEGLViewProtocol::handleTouchesBegin(int num, int ids[], float xs[], float
(y - m_obViewPortRect.origin.y) / m_fYScale);
}
CCLog("x = %f y = %f", pTouch->getLocationInView().x, pTouch->getLocationInView().y);
CCLOG("x = %f y = %f", pTouch->getLocationInView().x, pTouch->getLocationInView().y);
CCInteger* pInterObj = new CCInteger(nUnusedIndex);
s_TouchesIntergerDict.setObject(pInterObj, id);

View File

@ -18,10 +18,10 @@ bool AppDelegate::applicationDidFinishLaunching() {
pDirector->setOpenGLView(&CCEGLView::sharedOpenGLView());
// can not enable retina if invoke
CCEGLView::sharedOpenGLView().setDesignResolutionSize(480, 320, kResolutionScaleFullScreen);
CCEGLView::sharedOpenGLView().setDesignResolutionSize(960, 640, kResolutionScaleFullScreen);
// enable High Resource Mode(2x, such as iphone4) and maintains low resource on other devices.
pDirector->enableRetinaDisplay(true);
//pDirector->enableRetinaDisplay(true);
// turn on display FPS
pDirector->setDisplayStats(true);

View File

@ -39,12 +39,12 @@ bool HelloWorld::init()
"CloseNormal.png",
"CloseSelected.png",
this,
menu_selector(HelloWorld::menuCloseCallback) );
pCloseItem->setPosition( ccp(visibleSize.width - 20, origin.y + 20) );
menu_selector(HelloWorld::menuCloseCallback));
pCloseItem->setPosition(ccp(visibleSize.width - 40 + origin.x, 40 + origin.y));
// create menu, it's an autorelease object
CCMenu* pMenu = CCMenu::create(pCloseItem, NULL);
pMenu->setPosition(origin);
pMenu->setPosition(CCPointZero);
this->addChild(pMenu, 1);
/////////////////////////////

View File

@ -1 +1 @@
da525913fe81a82968c4ba9bce5170748f5b2cbe
e35126a63c774b4967e6b0e31082d7a32f58ed02

View File

@ -25,9 +25,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi
if (!CCDirector::sharedDirector()->getOpenGLView())
{
CCEGLView *view = &CCEGLView::sharedOpenGLView();
view->setFrameSize(w, h);
// set the design resolution screen size, if you want to use Design Resoulution scaled to current screen, please uncomment next line.
view->setDesignResolutionSize(480, 320, kResolutionScaleNotFullScreen);
view->setSize(w, h);
AppDelegate *pAppDelegate = new AppDelegate();
CCApplication::sharedApplication().run();