add interface to set test device default orientation

This commit is contained in:
yangws 2010-10-13 06:45:10 +00:00
parent ec9b95f0bb
commit 0729ec7b27
2 changed files with 11 additions and 3 deletions

View File

@ -5,6 +5,12 @@
#define LINE_SPACE 40
static int s_nPageIndex = 0;
static cocos2d::ccDeviceOrientation s_eDefaultOrientation = kCCDeviceOrientationLandscapeLeft;
void TestController::setDefaultDeviceOrientation(cocos2d::ccDeviceOrientation eOrientation)
{
s_eDefaultOrientation = eOrientation;
}
static TestScene* CreateTestScene(int nIdx)
{
@ -77,9 +83,9 @@ static TestScene* CreateTestScene(int nIdx)
return pScene;
}
TestController::TestController(cocos2d::ccDeviceOrientation nOrientation)
TestController::TestController()
{
CCDirector::getSharedDirector()->setDeviceOrientation(nOrientation);
CCDirector::getSharedDirector()->setDeviceOrientation(s_eDefaultOrientation);
// add close menu
CCMenuItemImage *pCloseItem = CCMenuItemImage::itemFromNormalImage(s_pPathClose, s_pPathClose, this, menu_selector(TestController::closeCallback) );

View File

@ -10,7 +10,7 @@ using namespace cocos2d;
class TestController : public CCLayer
{
public:
TestController(cocos2d::ccDeviceOrientation nOrientation = kCCDeviceOrientationLandscapeLeft);
TestController();
~TestController();
void menuCallback(NSObject * pSender);
@ -21,6 +21,8 @@ public:
void updateItemsText();
static void setDefaultDeviceOrientation(cocos2d::ccDeviceOrientation eOrientation);
private:
CCMenuItemLabel * m_pMenuItems[ITEM_EVERYPAGE];
unsigned int m_nUIDs[ITEM_EVERYPAGE];