public override void RegisterWithTouchDispatcher() { CCTouchDispatcher pDispatcher = CCDirector.SharedDirector.TouchDispatcher; /* * if (m_pScriptHandlerEntry) * { * if (m_pScriptHandlerEntry->isMultiTouches()) * { * pDispatcher->addStandardDelegate(this, 0); * LUALOG("[LUA] Add multi-touches event handler: %d", m_pScriptHandlerEntry->getHandler()); * } * else * { * pDispatcher->addTargetedDelegate(this, * m_pScriptHandlerEntry->getPriority(), * m_pScriptHandlerEntry->getSwallowsTouches()); * LUALOG("[LUA] Add touch event handler: %d", m_pScriptHandlerEntry->getHandler()); * } * return; * } */ if (m_bIsSingleTouchEnabled) { pDispatcher.AddTargetedDelegate(this, 0, true); } if (m_bIsMultiTouchEnabled) { pDispatcher.AddStandardDelegate(this, 0); } }
public virtual void RegisterWithTouchDispatcher() { CCTouchDispatcher pDispatcher = CCDirector.SharedDirector.TouchDispatcher; /* * if (m_pScriptHandlerEntry) * { * if (m_pScriptHandlerEntry->isMultiTouches()) * { * pDispatcher->addStandardDelegate(this, 0); * LUALOG("[LUA] Add multi-touches event handler: %d", m_pScriptHandlerEntry->getHandler()); * } * else * { * pDispatcher->addTargetedDelegate(this, * m_pScriptHandlerEntry->getPriority(), * m_pScriptHandlerEntry->getSwallowsTouches()); * LUALOG("[LUA] Add touch event handler: %d", m_pScriptHandlerEntry->getHandler()); * } * return; * } */ if (m_eTouchMode == CCTouchMode.AllAtOnce) { pDispatcher.AddStandardDelegate(this, 0); } else { pDispatcher.AddTargetedDelegate(this, m_nTouchPriority, true); } }
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.Default; // 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); }
public virtual bool Init() { SetDefaultValues(); // scenes m_pRunningScene = null; m_pNextScene = null; m_pNotificationNode = null; m_dOldAnimationInterval = m_dAnimationInterval = 1.0 / kDefaultFPS; // Set default projection (3D) m_eProjection = CCDirectorProjection.Default; // projection delegate if "Custom" projection is used m_pProjectionDelegate = null; // FPS m_fAccumDt = 0.0f; m_pFPSLabel = null; m_pUpdateTimeLabel = null; m_pDrawTimeLabel = null; m_pDrawsLabel = null; m_bDisplayStats = false; m_uTotalFrames = 0; m_pStopwatch = new Stopwatch(); // paused ? m_bPaused = false; // purge ? m_bPurgeDirecotorInNextLoop = false; 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(); // KeyboardDispatcher m_pKeyboardDispatcher = new CCKeyboardDispatcher(); // Accelerometer #if !PSM &&!NETFX_CORE m_pAccelerometer = new CCAccelerometer(); #endif // create autorelease pool //CCPoolManager::sharedPoolManager()->push(); m_NeedsInit = false; return true; }
public void SetHandlerPriority(int newPriority) { CCTouchDispatcher pDispatcher = CCDirector.SharedDirector.TouchDispatcher; pDispatcher.SetPriority(newPriority, this); }