/// <summary> /// initializes a transition with duration and incoming scene /// </summary> public virtual bool initWithDuration(float t, CCScene scene) { if (scene == null) { throw (new ArgumentNullException("scene", "Target scene must not be null")); } if (base.init()) { m_fDuration = t; // retain m_pInScene = scene; m_pOutScene = CCDirector.sharedDirector().runningScene; m_eSceneType = ccSceneFlag.ccTransitionScene; if (m_pInScene == m_pOutScene) { throw (new ArgumentException("scene", "Target and source scenes must be different")); } // disable events while transitions CCTouchDispatcher.sharedDispatcher().IsDispatchEvents = false; this.sceneOrder(); return(true); } else { return(false); } }
public static CCTouchDispatcher sharedDispatcher() { if (CCTouchDispatcher.pSharedDispatcher == null) { CCTouchDispatcher.pSharedDispatcher = new CCTouchDispatcher(); CCTouchDispatcher.pSharedDispatcher.init(); } return(CCTouchDispatcher.pSharedDispatcher); }
private void setNewScene(float dt) { base.unschedule(new SEL_SCHEDULE(this.setNewScene)); CCDirector cCDirector = CCDirector.sharedDirector(); this.m_bIsSendCleanupToScene = cCDirector.isSendCleanupToScene(); cCDirector.replaceScene(this.m_pInScene); CCTouchDispatcher.sharedDispatcher().IsDispatchEvents = true; this.m_pOutScene.visible = true; }
/// <summary> /// singleton of the CCTouchDispatcher /// </summary> public static CCTouchDispatcher sharedDispatcher() { // synchronized ?? if (pSharedDispatcher == null) { pSharedDispatcher = new CCTouchDispatcher(); pSharedDispatcher.init(); } return(pSharedDispatcher); }
/// <summary> /// singleton of the CCTouchDispatcher /// </summary> public static CCTouchDispatcher sharedDispatcher() { // synchronized ?? if (pSharedDispatcher == null) { pSharedDispatcher = new CCTouchDispatcher(); pSharedDispatcher.init(); } return pSharedDispatcher; }
public void setOpenGLView() { this.m_obWinSizeInPoints = CCApplication.sharedApplication().getSize(); this.m_obWinSizeInPixels = new CCSize(this.m_obWinSizeInPoints.width * this.m_fContentScaleFactor, this.m_obWinSizeInPoints.height * this.m_fContentScaleFactor); this.setGLDefaultValues(); if (this.m_fContentScaleFactor != 1f) { this.updateContentScaleFactor(); } CCTouchDispatcher cCTouchDispatcher = CCTouchDispatcher.sharedDispatcher(); CCApplication.sharedApplication().TouchDelegate = cCTouchDispatcher; cCTouchDispatcher.IsDispatchEvents = true; }
public override void onExit() { if (this.m_bIsTouchEnabled) { CCTouchDispatcher.sharedDispatcher().removeDelegate(this); } if (this.m_bIsAccelerometerEnabled) { throw new NotImplementedException(); } bool mBIsKeypadEnabled = this.m_bIsKeypadEnabled; base.onExit(); }
private void setNewScene(float dt) { // [self unschedule:_cmd]; // "_cmd" is a local variable automatically defined in a method // that contains the selector for the method this.unschedule(this.setNewScene); CCDirector director = CCDirector.sharedDirector(); // Before replacing, save the "send cleanup to scene" m_bIsSendCleanupToScene = director.isSendCleanupToScene(); director.replaceScene(m_pInScene); // enable events while transitions CCTouchDispatcher.sharedDispatcher().IsDispatchEvents = true; // issue #267 m_pOutScene.visible = true; }
public void setOpenGLView() { // set size m_obWinSizeInPoints = CCApplication.sharedApplication().getSize(); m_obWinSizeInPixels = new CCSize(m_obWinSizeInPoints.width * m_fContentScaleFactor, m_obWinSizeInPoints.height * m_fContentScaleFactor); setGLDefaultValues(); if (m_fContentScaleFactor != 1) { updateContentScaleFactor(); } CCTouchDispatcher pTouchDispatcher = CCTouchDispatcher.sharedDispatcher(); CCApplication.sharedApplication().TouchDelegate = pTouchDispatcher; pTouchDispatcher.IsDispatchEvents = true; }
public virtual bool Init() { const double DefaultFPS = 60.0; this._animationInterval = 1.0 / DefaultFPS; this.IsPaused = false; this._isPurgeDirecotorInNextLoop = false; this._contentScaleFactor = 1.0f; // Set default projection (3D) this._projection = DirectorProjection.ProjectionDefault; this.Projection = DirectorProjection.ProjectionDefault; Application.SharedApplication.ScreenScaleFactor = this.ContentScaleFactor; Application.SharedApplication.TouchDelegate = CCTouchDispatcher.sharedDispatcher(); CCTouchDispatcher.sharedDispatcher().IsDispatchEvents = true; return(true); }
public override void onExit() { if (m_bIsTouchEnabled) { CCTouchDispatcher.sharedDispatcher().removeDelegate(this); } // remove this layer from the delegates who concern Accelerometer Sensor if (m_bIsAccelerometerEnabled) { ///@todo throw new NotImplementedException(); } // remove this layer from the delegates who concern the kaypad msg if (m_bIsKeypadEnabled) { } base.onExit(); }
public virtual bool Init() { // scenes m_pRunningScene = null; m_pNextScene = null; m_pNotificationNode = null; 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_fAccumDt = 0.0f; m_fFrameRate = 0.0f; m_pFPSLabel = null; m_pSPFLabel = null; m_pDrawsLabel = null; m_bDisplayStats = false; m_uTotalFrames = m_uFrames = 0; // paused ? m_bPaused = false; // purge ? m_bPurgeDirecotorInNextLoop = false; m_obWinSizeInPixels = m_obWinSizeInPoints = CCSize.Zero; //m_pobOpenGLView = null; m_fContentScaleFactor = 1.0f; // scheduler m_pScheduler = new CCScheduler(); // action manager m_pActionManager = new CCActionManager(); m_pScheduler.ScheduleUpdateForTarget(m_pActionManager, CCScheduler.kCCPrioritySystem, false); // touchDispatcher m_pTouchDispatcher = new CCTouchDispatcher(); m_pTouchDispatcher.Init(); // KeypadDispatcher m_pKeypadDispatcher = new CCKeypadDispatcher(); // Accelerometer #if !PSM &&!NETFX_CORE m_pAccelerometer = new CCAccelerometer(); #endif // create autorelease pool //CCPoolManager::sharedPoolManager()->push(); m_NeedsInit = false; return true; }
/// <summary> /// @todo /// </summary> //virtual void didAccelerate(CCAcceleration* pAccelerationValue) {CC_UNUSED_PARAM(pAccelerationValue);} /** If isTouchEnabled, this method is called onEnter. Override it to change the * way CCLayer receives touch events. * ( Default: CCTouchDispatcher::sharedDispatcher()->addStandardDelegate(this,0); ) * Example: * void CCLayer::registerWithTouchDispatcher() * { * CCTouchDispatcher::sharedDispatcher()->addTargetedDelegate(this,INT_MIN+1,true); * } * @since v0.8.0 */ public virtual void registerWithTouchDispatcher() { ///@todo CCTouchDispatcher.sharedDispatcher().addStandardDelegate(this, 0); }
public override void registerWithTouchDispatcher() { CCTouchDispatcher.sharedDispatcher().addTargetedDelegate(this, -128, true); }
public override void registerWithTouchDispatcher() { CCTouchDispatcher.sharedDispatcher().addTargetedDelegate(this, kCCMenuTouchPriority, true); }
public virtual void registerWithTouchDispatcher() { CCTouchDispatcher.sharedDispatcher().addTargetedDelegate(this, 0, false); }