public ParallaxDemo() { _GamePadDPadDelegate = new CCGamePadDPadDelegate(MyOnGamePadDPadUpdate); _GamePadButtonDelegate = new CCGamePadButtonDelegate(MyOnGamePadButtonUpdate); _GamePadStickDelegate = new CCGamePadStickUpdateDelegate(MyOnGameStickUpdate); _GamePadTriggerDelegate = new CCGamePadTriggerDelegate(MyGamePadTriggerUpdate); }
public CCInputScene() { m_OnGamePadButtonUpdateDelegate = new CCGamePadButtonDelegate(OnGamePadButtonUpdate); m_OnGamePadConnectionUpdateDelegate = new CCGamePadConnectionDelegate(OnGamePadConnectionUpdate); m_OnGamePadDPadUpdateDelegate = new CCGamePadDPadDelegate(OnGamePadDPadUpdate); m_OnGamePadStickUpdateDelegate = new CCGamePadStickUpdateDelegate(OnGamePadStickUpdate); m_OnGamePadTriggerUpdateDelegate = new CCGamePadTriggerDelegate(OnGamePadTriggerUpdate); }
//private bool m_bMouseEnabled; //private bool m_bGamePadEnabled; public CCLayer() { AnchorPoint = new CCPoint(0.5f, 0.5f); m_bIgnoreAnchorPointForPosition = true; CCDirector director = CCDirector.SharedDirector; if (director != null) { ContentSize = director.WinSize; } m_OnGamePadButtonUpdateDelegate = new CCGamePadButtonDelegate(OnGamePadButtonUpdate); m_OnGamePadConnectionUpdateDelegate = new CCGamePadConnectionDelegate(OnGamePadConnectionUpdate); m_OnGamePadDPadUpdateDelegate = new CCGamePadDPadDelegate(OnGamePadDPadUpdate); m_OnGamePadStickUpdateDelegate = new CCGamePadStickUpdateDelegate(OnGamePadStickUpdate); m_OnGamePadTriggerUpdateDelegate = new CCGamePadTriggerDelegate(OnGamePadTriggerUpdate); Init(); }
public TileDemo() { TouchEnabled = true; CCSize s = CCDirector.SharedDirector.WinSize; _GamePadDPadDelegate = new CCGamePadDPadDelegate(MyOnGamePadDPadUpdate); _GamePadButtonDelegate = new CCGamePadButtonDelegate(MyOnGamePadButtonUpdate); _GamePadStickDelegate = new CCGamePadStickUpdateDelegate(MyOnGameStickUpdate); _GamePadTriggerDelegate = new CCGamePadTriggerDelegate(MyGamePadTriggerUpdate); m_label = new CCLabelTTF("", "arial", 28); AddChild(m_label, 1); m_label.Position = new CCPoint(s.Width / 2, s.Height - 50); string strSubtitle = subtitle(); if (! string.IsNullOrEmpty(strSubtitle)) { CCLabelTTF l = new CCLabelTTF(strSubtitle, "arial", 16); AddChild(l, 1); l.Position = new CCPoint(s.Width / 2, s.Height - 80); m_subtitle = l; } CCMenuItemImage item1 = new CCMenuItemImage(s_pPathB1, s_pPathB2, backCallback); CCMenuItemImage item2 = new CCMenuItemImage(s_pPathR1, s_pPathR2, restartCallback); CCMenuItemImage item3 = new CCMenuItemImage(s_pPathF1, s_pPathF2, nextCallback); CCMenu menu = new CCMenu(item1, item2, item3); menu.Position = CCPoint.Zero; item1.Position = new CCPoint(s.Width / 2 - item2.ContentSize.Width * 2, item2.ContentSize.Height / 2); item2.Position = new CCPoint(s.Width / 2, item2.ContentSize.Height / 2); item3.Position = new CCPoint(s.Width / 2 + item2.ContentSize.Width * 2, item2.ContentSize.Height / 2); AddChild(menu, 1); }
public virtual void OnEnter() { // register 'parent' nodes first // since events are propagated in reverse order if (m_bTouchEnabled) { RegisterWithTouchDispatcher(); } if (m_pChildren != null && m_pChildren.count > 0) { CCNode[] elements = m_pChildren.Elements; for (int i = 0, count = m_pChildren.count; i < count; i++) { elements[i].OnEnter(); } } ResumeSchedulerAndActions(); m_bRunning = true; CCDirector director = CCDirector.SharedDirector; // add this node to concern the kaypad msg if (m_bKeypadEnabled) { director.KeypadDispatcher.AddDelegate(this); } // tell the director that this node is interested in Keyboard message if (m_bKeyboardEnabled) { director.KeyboardDispatcher.AddDelegate(this); } if (GamePadEnabled && director.GamePadEnabled) { if (!m_bGamePadDelegatesInited) { m_OnGamePadButtonUpdateDelegate = new CCGamePadButtonDelegate(OnGamePadButtonUpdate); m_OnGamePadConnectionUpdateDelegate = new CCGamePadConnectionDelegate(OnGamePadConnectionUpdate); m_OnGamePadDPadUpdateDelegate = new CCGamePadDPadDelegate(OnGamePadDPadUpdate); m_OnGamePadStickUpdateDelegate = new CCGamePadStickUpdateDelegate(OnGamePadStickUpdate); m_OnGamePadTriggerUpdateDelegate = new CCGamePadTriggerDelegate(OnGamePadTriggerUpdate); m_bGamePadDelegatesInited = true; } CCApplication application = CCApplication.SharedApplication; application.GamePadButtonUpdate += m_OnGamePadButtonUpdateDelegate; application.GamePadConnectionUpdate += m_OnGamePadConnectionUpdateDelegate; application.GamePadDPadUpdate += m_OnGamePadDPadUpdateDelegate; application.GamePadStickUpdate += m_OnGamePadStickUpdateDelegate; application.GamePadTriggerUpdate += m_OnGamePadTriggerUpdateDelegate; } /* if (m_nScriptHandler) { CCScriptEngineManager::sharedManager()->getScriptEngine()->executeFunctionWithIntegerData(m_nScriptHandler, kCCNodeOnEnter); } */ }