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; 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 // reset director's member vaviables to fit visible rect
CCDirector::sharedDirector()->createStatsLabel(); CCDirector::sharedDirector()->createStatsLabel();
CCDirector::sharedDirector()->m_obWinSizeInPoints = CCDirector::sharedDirector()->m_obWinSizeInPixels = getSize(); CCDirector::sharedDirector()->m_obWinSizeInPoints = CCDirector::sharedDirector()->m_obWinSizeInPixels = getSize();
CCDirector::sharedDirector()->setGLDefaultValues();
} }
bool CCEGLViewProtocol::enableRetina() bool CCEGLViewProtocol::enableRetina()
@ -205,7 +206,7 @@ void CCEGLViewProtocol::handleTouchesBegin(int num, int ids[], float xs[], float
(y - m_obViewPortRect.origin.y) / m_fYScale); (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); CCInteger* pInterObj = new CCInteger(nUnusedIndex);
s_TouchesIntergerDict.setObject(pInterObj, id); s_TouchesIntergerDict.setObject(pInterObj, id);

View File

@ -18,10 +18,10 @@ bool AppDelegate::applicationDidFinishLaunching() {
pDirector->setOpenGLView(&CCEGLView::sharedOpenGLView()); pDirector->setOpenGLView(&CCEGLView::sharedOpenGLView());
// can not enable retina if invoke // 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. // 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 // turn on display FPS
pDirector->setDisplayStats(true); pDirector->setDisplayStats(true);

View File

@ -39,12 +39,12 @@ bool HelloWorld::init()
"CloseNormal.png", "CloseNormal.png",
"CloseSelected.png", "CloseSelected.png",
this, this,
menu_selector(HelloWorld::menuCloseCallback) ); menu_selector(HelloWorld::menuCloseCallback));
pCloseItem->setPosition( ccp(visibleSize.width - 20, origin.y + 20) ); pCloseItem->setPosition(ccp(visibleSize.width - 40 + origin.x, 40 + origin.y));
// create menu, it's an autorelease object // create menu, it's an autorelease object
CCMenu* pMenu = CCMenu::create(pCloseItem, NULL); CCMenu* pMenu = CCMenu::create(pCloseItem, NULL);
pMenu->setPosition(origin); pMenu->setPosition(CCPointZero);
this->addChild(pMenu, 1); 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()) if (!CCDirector::sharedDirector()->getOpenGLView())
{ {
CCEGLView *view = &CCEGLView::sharedOpenGLView(); CCEGLView *view = &CCEGLView::sharedOpenGLView();
view->setFrameSize(w, h); view->setSize(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);
AppDelegate *pAppDelegate = new AppDelegate(); AppDelegate *pAppDelegate = new AppDelegate();
CCApplication::sharedApplication().run(); CCApplication::sharedApplication().run();