public virtual bool init() { double num = 1 / this.kDefaultFPS; double num1 = num; this.m_dAnimationInterval = num; this.m_dOldAnimationInterval = num1; this.m_eProjection = ccDirectorProjection.kCCDirectorProjection3D; this.m_bDisplayFPS = false; int num2 = 0; uint num3 = (uint)num2; this.m_uFrames = (uint)num2; this.m_uTotalFrames = num3; this.m_pszFPS = ""; this.m_bPaused = false; this.m_bPaused = false; this.m_bPurgeDirecotorInNextLoop = false; CCSize cCSize = new CCSize(0f, 0f); CCSize cCSize1 = cCSize; this.m_obWinSizeInPoints = cCSize; this.m_obWinSizeInPixels = cCSize1; this.m_eDeviceOrientation = ccDeviceOrientation.kCCDeviceOrientationPortrait; this.m_bRetinaDisplay = false; this.m_fContentScaleFactor = 1f; this.m_bIsContentScaleSupported = false; return(true); }
protected void applyLandscape() { CCDirector pDirector = CCDirector.sharedDirector(); CCSize winSize = pDirector.displaySizeInPixels; float w = winSize.width / 2; float h = winSize.height / 2; ccDeviceOrientation orientation = pDirector.deviceOrientation; switch (orientation) { case ccDeviceOrientation.CCDeviceOrientationPortraitUpsideDown: //glTranslatef(w,h,0); //glRotatef(180,0,0,1); //glTranslatef(-w,-h,0); break; case ccDeviceOrientation.CCDeviceOrientationLandscapeLeft: //glTranslatef(w,h,0); //glRotatef(-90,0,0,1); //glTranslatef(-h,-w,0); break; case ccDeviceOrientation.CCDeviceOrientationLandscapeRight: //glTranslatef(w,h,0); //glRotatef(90,0,0,1); //glTranslatef(-h,-w,0); break; default: break; } }
public void newOrientation() { ccDeviceOrientation orientation = CCDirector.sharedDirector().deviceOrientation; switch (orientation) { case ccDeviceOrientation.CCDeviceOrientationLandscapeLeft: orientation = ccDeviceOrientation.CCDeviceOrientationPortrait; break; case ccDeviceOrientation.CCDeviceOrientationPortrait: orientation = ccDeviceOrientation.CCDeviceOrientationLandscapeRight; break; case ccDeviceOrientation.CCDeviceOrientationLandscapeRight: orientation = ccDeviceOrientation.CCDeviceOrientationPortraitUpsideDown; break; case ccDeviceOrientation.CCDeviceOrientationPortraitUpsideDown: orientation = ccDeviceOrientation.CCDeviceOrientationLandscapeLeft; break; } CCDirector.sharedDirector().deviceOrientation = orientation; }
/// <summary> /// initializes a CCMenu with it's items /// </summary> bool initWithItems(params CCMenuItem[] item) { if (base.init()) { this.m_bIsTouchEnabled = true; // menu in the center of the screen CCSize s = CCDirector.sharedDirector().getWinSize(); this.m_bIsRelativeAnchorPoint = false; anchorPoint = new CCPoint(0.5f, 0.5f); this.contentSize = s; // XXX: in v0.7, winSize should return the visible size // XXX: so the bar calculation should be done there CCRect r; CCApplication.sharedApplication().statusBarFrame(out r); ccDeviceOrientation orientation = CCDirector.sharedDirector().deviceOrientation; if (orientation == ccDeviceOrientation.CCDeviceOrientationLandscapeLeft || orientation == ccDeviceOrientation.CCDeviceOrientationLandscapeRight) { s.height -= r.size.width; } else { s.height -= r.size.height; } position = new CCPoint(s.width / 2, s.height / 2); if (item != null) { foreach (var menuItem in item) { this.addChild(menuItem); } } // [self alignItemsVertically]; m_pSelectedItem = null; m_eState = tCCMenuState.kCCMenuStateWaiting; return(true); } return(false); }
protected bool initWithItems(params CCMenuItem[] item) { CCRect cCRect; if (!base.init()) { return(false); } this.m_bIsTouchEnabled = true; CCSize winSize = CCDirector.sharedDirector().getWinSize(); this.m_bIsRelativeAnchorPoint = false; this.anchorPoint = new CCPoint(0.5f, 0.5f); this.contentSize = winSize; CCApplication.sharedApplication().statusBarFrame(out cCRect); ccDeviceOrientation _ccDeviceOrientation = CCDirector.sharedDirector().deviceOrientation; if (_ccDeviceOrientation == ccDeviceOrientation.kCCDeviceOrientationLandscapeLeft || _ccDeviceOrientation == ccDeviceOrientation.kCCDeviceOrientationLandscapeRight) { CCSize cCSize = winSize; cCSize.height = cCSize.height - cCRect.size.width; } else { CCSize cCSize1 = winSize; cCSize1.height = cCSize1.height - cCRect.size.height; } this.position = new CCPoint(winSize.width / 2f, winSize.height / 2f); if (item != null) { CCMenuItem[] cCMenuItemArray = item; for (int i = 0; i < (int)cCMenuItemArray.Length; i++) { this.addChild(cCMenuItemArray[i]); } } this.m_pSelectedItem = null; this.m_eState = tCCMenuState.kCCMenuStateWaiting; return(true); }
public virtual bool init() { //scene m_dOldAnimationInterval = m_dAnimationInterval = 1.0 / kDefaultFPS; // Set default projection (3D) m_eProjection = ccDirectorProjection.kCCDirectorProjectionDefault; // projection delegate if "Custom" projection is used //m_pProjectionDelegate = NULL; //FPS m_bDisplayFPS = false; m_uTotalFrames = m_uFrames = 0; m_pszFPS = ""; m_bPaused = false; //paused? m_bPaused = false; //purge? m_bPurgeDirecotorInNextLoop = false; m_obWinSizeInPixels = m_obWinSizeInPoints = new CCSize(0, 0); // portrait mode default m_eDeviceOrientation = ccDeviceOrientation.CCDeviceOrientationPortrait; m_bRetinaDisplay = false; m_fContentScaleFactor = 1; m_bIsContentScaleSupported = false; return true; }