Exemple #1
0
 public ParallaxDemo()
 {
     _GamePadDPadDelegate = new CCGamePadDPadDelegate(MyOnGamePadDPadUpdate);
     _GamePadButtonDelegate = new CCGamePadButtonDelegate(MyOnGamePadButtonUpdate);
     _GamePadStickDelegate = new CCGamePadStickUpdateDelegate(MyOnGameStickUpdate);
     _GamePadTriggerDelegate = new CCGamePadTriggerDelegate(MyGamePadTriggerUpdate);
 }
Exemple #2
0
 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);
 }
 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);
 }
Exemple #5
0
 //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();
 }
Exemple #6
0
        //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();
        }
Exemple #7
0
        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);
        }
Exemple #8
0
        public TestController()
        {
            // add close menu
            var pCloseItem = new CCMenuItemImage(TestResource.s_pPathClose, TestResource.s_pPathClose, closeCallback);
            var pMenu      = new CCMenu(pCloseItem);
            var s          = CCDirector.SharedDirector.WinSize;

#if !XBOX && !OUYA
            TouchEnabled = true;
#else
            GamePadEnabled = true;
            KeypadEnabled  = true;
#endif
#if WINDOWS || WINDOWSGL || MACOS
            GamePadEnabled = true;
#endif

            pMenu.Position      = CCPoint.Zero;
            pCloseItem.Position = new CCPoint(s.Width - 30, s.Height - 30);
#if !PSM && !WINDOWS_PHONE
#if NETFX_CORE
            CCLabelTTF versionLabel = new CCLabelTTF("v" + this.GetType().GetAssemblyName().Version.ToString(), "arial", 12);
#else
            CCLabelTTF versionLabel = new CCLabelTTF("v" + this.GetType().Assembly.GetName().Version.ToString(), "arial", 12);
#endif
            versionLabel.Position            = new CCPoint(versionLabel.ContentSizeInPixels.Width / 2f, s.Height - 18f);
            versionLabel.HorizontalAlignment = CCTextAlignment.Left;
            AddChild(versionLabel, 20000);
#endif
            // add menu items for tests
            m_pItemMenu = new CCMenu();
            for (int i = 0; i < (int)(TestCases.TESTS_COUNT); ++i)
            {
                var label     = new CCLabelTTF(Tests.g_aTestNames[i], "arial", 24);
                var pMenuItem = new CCMenuItemLabel(label, menuCallback);
                pMenuItem.Color = CCColor3B.White;
                label.Color     = CCColor3B.White;

                pMenuItem.UserData = i;
                m_pItemMenu.AddChild(pMenuItem, 10000);
#if XBOX || OUYA
                pMenuItem.Position = new CCPoint(s.Width / 2, -(i + 1) * LINE_SPACE);
#else
                pMenuItem.Position = new CCPoint(s.Width / 2, (s.Height - (i + 1) * LINE_SPACE));
#endif

                CCLog.Log("Label {0} at {1}", Tests.g_aTestNames[i], pMenuItem.Position);

                _Items.Add(pMenuItem);
            }

            m_pItemMenu.ContentSize = new CCSize(s.Width, ((int)TestCases.TESTS_COUNT + 1) * LINE_SPACE);
#if XBOX || OUYA
            CCSprite sprite = new CCSprite("Images/aButton");
            AddChild(sprite, 10001);
            _menuIndicator = sprite;
            // Center the menu on the first item so that it is
            // in the center of the screen
            _HomePosition = new CCPoint(0f, s.Height / 2f + LINE_SPACE / 2f);
            _LastPosition = new CCPoint(0f, _HomePosition.Y - (_Items.Count - 1) * LINE_SPACE);
#else
            _HomePosition = s_tCurPos;
#endif
            m_pItemMenu.Position = _HomePosition;
            AddChild(m_pItemMenu);

            AddChild(pMenu, 1);

            _GamePadDPadDelegate   = new CCGamePadDPadDelegate(MyOnGamePadDPadUpdate);
            _GamePadButtonDelegate = new CCGamePadButtonDelegate(MyOnGamePadButtonUpdate);

            // set the first one to have the selection highlight
            _CurrentItemIndex = 0;
            SelectMenuItem();
        }
Exemple #9
0
        public TestController()
        {
            // add close menu
            var pCloseItem = new CCMenuItemImage(TestResource.s_pPathClose, TestResource.s_pPathClose, closeCallback);
            var pMenu = new CCMenu(pCloseItem);
            var s = CCDirector.SharedDirector.WinSize;
            #if !XBOX && !OUYA
            TouchEnabled = true;
            #else
            GamePadEnabled = true;
            KeypadEnabled = true;
            #endif
            #if WINDOWS || MONOMAC
            GamePadEnabled = true;
            #endif

            pMenu.Position = new CCPoint(0.0f, 0.0f);
            pCloseItem.Position = new CCPoint(s.Width - 30, s.Height - 30);
            #if !PSM && !WINDOWS_PHONE
            #if NETFX_CORE
            CCLabelTTF versionLabel = new CCLabelTTF("v" + this.GetType().GetAssemblyName().Version.ToString(), "arial", 12);
            #else
            CCLabelTTF versionLabel = new CCLabelTTF("v" + this.GetType().Assembly.GetName().Version.ToString(), "arial", 12);
            #endif
            versionLabel.Position = new CCPoint(versionLabel.ContentSizeInPixels.Width/2f, s.Height - 18f);
            versionLabel.HorizontalAlignment = CCTextAlignment.CCTextAlignmentLeft;
            AddChild(versionLabel, 20000);
            #endif
            // add menu items for tests
            m_pItemMenu = new CCMenu();
            for (int i = 0; i < (int)(TestCases.TESTS_COUNT); ++i)
            {
                var label = new CCLabelTTF(Tests.g_aTestNames[i], "arial", 24);
                var pMenuItem = CCMenuItemLabel.Create(label, menuCallback);

                pMenuItem.UserData = i;
                m_pItemMenu.AddChild(pMenuItem, 10000);
            #if XBOX || OUYA
                pMenuItem.Position = new CCPoint(s.Width / 2, -(i + 1) * LINE_SPACE);
            #else
                pMenuItem.Position = new CCPoint(s.Width / 2, (s.Height - (i + 1) * LINE_SPACE));
            #endif
                _Items.Add(pMenuItem);
            }

            m_pItemMenu.ContentSize = new CCSize(s.Width, ((int)TestCases.TESTS_COUNT + 1) * LINE_SPACE);
            #if XBOX || OUYA
            CCSprite sprite = new CCSprite("Images/aButton");
            AddChild(sprite, 10001);
            _menuIndicator = sprite;
            // Center the menu on the first item so that it is
            // in the center of the screen
            _HomePosition = new CCPoint(0f, s.Height / 2f + LINE_SPACE / 2f);
            _LastPosition = new CCPoint(0f, _HomePosition.Y - (_Items.Count - 1) * LINE_SPACE);

            #else
            _HomePosition = s_tCurPos;
            #endif
            m_pItemMenu.Position = _HomePosition;
            AddChild(m_pItemMenu);

            AddChild(pMenu, 1);

            _GamePadDPadDelegate = new CCGamePadDPadDelegate(MyOnGamePadDPadUpdate);
            _GamePadButtonDelegate = new CCGamePadButtonDelegate(MyOnGamePadButtonUpdate);

            // set the first one to have the selection highlight
            _CurrentItemIndex = 0;
            SelectMenuItem();
        }
Exemple #10
0
 public TestScene()
 {
     base.Init();
     _GamePadDPadDelegate   = new CCGamePadDPadDelegate(MyOnGamePadDPadUpdate);
     _GamePadButtonDelegate = new CCGamePadButtonDelegate(MyOnGamePadButtonUpdate);
 }
Exemple #11
0
        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);
            }
            */
        }
Exemple #12
0
 public TestScene()
 {
     base.Init();
     _GamePadDPadDelegate = new CCGamePadDPadDelegate(MyOnGamePadDPadUpdate);
     _GamePadButtonDelegate = new CCGamePadButtonDelegate(MyOnGamePadButtonUpdate);
 }