From 261c48fe5a2e5192460ca1e583b0c9dc2d0e552d Mon Sep 17 00:00:00 2001 From: natural-law Date: Tue, 12 Jul 2011 17:46:57 +0800 Subject: [PATCH 1/2] fixed #599, Resolve the wrong orientation when exit the TouchesTest. --- tests/tests/controller.cpp | 2 ++ tests/tests/testBasic.cpp | 11 ----------- tests/tests/testBasic.h | 1 - 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/tests/tests/controller.cpp b/tests/tests/controller.cpp index ec0ac6944a6e..5b80d238b65a 100644 --- a/tests/tests/controller.cpp +++ b/tests/tests/controller.cpp @@ -113,6 +113,8 @@ static TestScene* CreateTestScene(int nIdx) TestController::TestController() : m_tBeginPos(CCPointZero) { + CCDirector::sharedDirector()->setDeviceOrientation(CCDeviceOrientationPortrait); + // add close menu CCMenuItemImage *pCloseItem = CCMenuItemImage::itemFromNormalImage(s_pPathClose, s_pPathClose, this, menu_selector(TestController::closeCallback) ); CCMenu* pMenu =CCMenu::menuWithItems(pCloseItem, NULL); diff --git a/tests/tests/testBasic.cpp b/tests/tests/testBasic.cpp index 990ef793932c..a0847d653971 100644 --- a/tests/tests/testBasic.cpp +++ b/tests/tests/testBasic.cpp @@ -44,14 +44,3 @@ TestScene::TestScene(bool bPortrait) // 54321 is the tag of BackToMainMenuLayer addChild(pLayer, 1000, 54321); } - -void TestScene::onExit() -{ - if (m_bPortrait) - { - // turn back to the default orientation - CCDirector::sharedDirector()->setDeviceOrientation(CCDeviceOrientationPortrait); - } - - CCScene::onExit(); -} diff --git a/tests/tests/testBasic.h b/tests/tests/testBasic.h index 51c5cc7196fa..42fad5f01e9d 100644 --- a/tests/tests/testBasic.h +++ b/tests/tests/testBasic.h @@ -20,7 +20,6 @@ class TestScene : public CCScene TestScene(bool bPortrait = false); virtual void runThisTest() = 0; - virtual void onExit(); protected: bool m_bPortrait; // indicate if this test case requires portrait mode From f652e513ca38495b5a09281c0b7f55361e6d7706 Mon Sep 17 00:00:00 2001 From: natural-law Date: Tue, 12 Jul 2011 18:02:40 +0800 Subject: [PATCH 2/2] The menu of BugsTest position is wrong when exit one bug test. --- tests/tests/BugsTest/BugsTest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/tests/BugsTest/BugsTest.cpp b/tests/tests/BugsTest/BugsTest.cpp index b614d929adeb..8ed92ba23e8e 100644 --- a/tests/tests/BugsTest/BugsTest.cpp +++ b/tests/tests/BugsTest/BugsTest.cpp @@ -52,7 +52,6 @@ void BugsTestMainLayer::onEnter() CCSize s = CCDirector::sharedDirector()->getWinSize(); m_pItmeMenu = CCMenu::menuWithItems(NULL); - m_pItmeMenu->setPosition( CCPointZero ); CCMenuItemFont::setFontName("Arial"); CCMenuItemFont::setFontSize(24); for (int i = 0; i < MAX_COUNT; ++i) @@ -63,6 +62,7 @@ void BugsTestMainLayer::onEnter() m_pItmeMenu->addChild(pItem, kItemTagBasic + i); } + m_pItmeMenu->setPosition(s_tCurPos); addChild(m_pItmeMenu); setIsTouchEnabled(true); }