Example #1
0
        public void initWithSubTest(int asubtest, int nNodes)
        {
            //srandom(0);

            subtestNumber = asubtest;
            m_pSubTest = new SubTest();
            m_pSubTest.initWithSubTest(asubtest, this);

            CCSize s = Layer.VisibleBoundsWorldspace.Size;

            lastRenderedCount = 0;
            quantityNodes = 0;

			CCMenuItemFont.FontSize = 64;
			CCMenuItemFont.FontName = "arial";
            CCMenuItemFont decrease = new CCMenuItemFont(" - ", onDecrease);
            decrease.Color = new CCColor3B(0, 200, 20);
            CCMenuItemFont increase = new CCMenuItemFont(" + ", onIncrease);
            increase.Color = new CCColor3B(0, 200, 20);

            CCMenu menu = new CCMenu(decrease, increase);
            menu.AlignItemsHorizontally();
            menu.Position = new CCPoint(s.Width / 2, s.Height - 65);
            AddChild(menu, 1);

            CCLabelTtf infoLabel = new CCLabelTtf("0 nodes", "Marker Felt", 30);
            infoLabel.Color = new CCColor3B(0, 200, 20);
            infoLabel.Position = new CCPoint(s.Width / 2, s.Height - 90);
            AddChild(infoLabel, 1, PerformanceSpriteTest.kTagInfoLayer);

            // add menu
            SpriteMenuLayer pMenu = new SpriteMenuLayer(true, PerformanceSpriteTest.TEST_COUNT, PerformanceSpriteTest.s_nSpriteCurCase);
            AddChild(pMenu, 1, PerformanceSpriteTest.kTagMenuLayer);

            // Sub Tests
			CCMenuItemFont.FontSize = 32;
			CCMenuItemFont.FontName = "arial";
            CCMenu pSubMenu = new CCMenu(null);
            for (int i = 1; i <= 9; ++i)
            {
                //char str[10] = {0};
                var str = string.Format("{0}", i);
                CCMenuItemFont itemFont = new CCMenuItemFont(str, testNCallback);
                itemFont.Tag = i;
                pSubMenu.AddChild(itemFont, 10);

                if (i <= 3)
                    itemFont.Color = new CCColor3B(200, 20, 20);
                else if (i <= 6)
                    itemFont.Color = new CCColor3B(0, 200, 20);
                else
                    itemFont.Color = new CCColor3B(0, 20, 200);
            }

            pSubMenu.AlignItemsHorizontally();
            pSubMenu.Position = new CCPoint(s.Width / 2, 80);
            AddChild(pSubMenu, 2);

            // add title label
            CCLabelTtf label = new CCLabelTtf(title(), "arial", 38);
            AddChild(label, 1);
            label.Position = new CCPoint(s.Width / 2, s.Height - 32);
            label.Color = new CCColor3B(255, 255, 40);

            while (quantityNodes < nNodes)
                onIncrease(this);
        }
Example #2
0
        public void initWithSubTest(int asubtest, int nNodes)
        {
            //srandom(0);

            subtestNumber = asubtest;
            m_pSubTest    = new SubTest();
            m_pSubTest.initWithSubTest(asubtest, this);

            CCSize s = CCDirector.SharedDirector.WinSize;

            lastRenderedCount = 0;
            quantityNodes     = 0;

            CCMenuItemFont.FontSize = 64;
            CCMenuItemFont decrease = new CCMenuItemFont(" - ", onDecrease);

            decrease.Color = new CCColor3B(0, 200, 20);
            CCMenuItemFont increase = new CCMenuItemFont(" + ", onIncrease);

            increase.Color = new CCColor3B(0, 200, 20);

            CCMenu menu = new CCMenu(decrease, increase);

            menu.AlignItemsHorizontally();
            menu.Position = new CCPoint(s.Width / 2, s.Height - 65);
            AddChild(menu, 1);

            CCLabelTTF infoLabel = new CCLabelTTF("0 nodes", "Marker Felt", 30);

            infoLabel.Color    = new CCColor3B(0, 200, 20);
            infoLabel.Position = new CCPoint(s.Width / 2, s.Height - 90);
            AddChild(infoLabel, 1, PerformanceSpriteTest.kTagInfoLayer);

            // add menu
            SpriteMenuLayer pMenu = new SpriteMenuLayer(true, PerformanceSpriteTest.TEST_COUNT, PerformanceSpriteTest.s_nSpriteCurCase);

            AddChild(pMenu, 1, PerformanceSpriteTest.kTagMenuLayer);

            // Sub Tests
            CCMenuItemFont.FontSize = 32;
            CCMenu pSubMenu = new CCMenu(null);

            for (int i = 1; i <= 9; ++i)
            {
                //char str[10] = {0};
                var            str      = string.Format("{0}", i);
                CCMenuItemFont itemFont = new CCMenuItemFont(str, testNCallback);
                itemFont.Tag = i;
                pSubMenu.AddChild(itemFont, 10);

                if (i <= 3)
                {
                    itemFont.Color = new CCColor3B(200, 20, 20);
                }
                else if (i <= 6)
                {
                    itemFont.Color = new CCColor3B(0, 200, 20);
                }
                else
                {
                    itemFont.Color = new CCColor3B(0, 20, 200);
                }
            }

            pSubMenu.AlignItemsHorizontally();
            pSubMenu.Position = new CCPoint(s.Width / 2, 80);
            AddChild(pSubMenu, 2);

            // add title label
            CCLabelTTF label = new CCLabelTTF(title(), "arial", 38);

            AddChild(label, 1);
            label.Position = new CCPoint(s.Width / 2, s.Height - 32);
            label.Color    = new CCColor3B(255, 255, 40);

            while (quantityNodes < nNodes)
            {
                onIncrease(this);
            }
        }
        public void initWithSubTest(int asubtest, int nNodes)
        {
            //srandom(0);

            subtestNumber = asubtest;
            m_pSubTest = new SubTest();
            m_pSubTest.initWithSubTest(asubtest, this);

            CCSize s = CCDirector.sharedDirector().getWinSize();

            lastRenderedCount = 0;
            quantityNodes = 0;

            CCMenuItemFont.FontSize = 65;
            CCMenuItemFont decrease = CCMenuItemFont.itemFromString(" - ", this, onDecrease);
            decrease.Color = new ccColor3B(0, 200, 20);
            CCMenuItemFont increase = CCMenuItemFont.itemFromString(" + ", this, onIncrease);
            increase.Color = new ccColor3B(0, 200, 20);

            CCMenu menu = CCMenu.menuWithItems(decrease, increase);
            menu.alignItemsHorizontally();
            menu.position = new CCPoint(s.width / 2, s.height - 65);
            addChild(menu, 1);

            CCLabelTTF infoLabel = CCLabelTTF.labelWithString("0 nodes", "Marker Felt", 30);
            infoLabel.Color = new ccColor3B(0, 200, 20);
            infoLabel.position = new CCPoint(s.width / 2, s.height - 90);
            addChild(infoLabel, 1, PerformanceSpriteTest.kTagInfoLayer);

            // add menu
            SpriteMenuLayer pMenu = new SpriteMenuLayer(true, PerformanceSpriteTest.TEST_COUNT, PerformanceSpriteTest.s_nSpriteCurCase);
            addChild(pMenu, 1, PerformanceSpriteTest.kTagMenuLayer);

            // Sub Tests
            CCMenuItemFont.FontSize = 32;
            CCMenu pSubMenu = CCMenu.menuWithItems(null);
            for (int i = 1; i <= 9; ++i)
            {
                //char str[10] = {0};
                string str;
                //sprintf(str, "%d ", i);
                str = string.Format("{0:D}", i);
                CCMenuItemFont itemFont = CCMenuItemFont.itemFromString(str, this, testNCallback);
                itemFont.tag = i;
                pSubMenu.addChild(itemFont, 10);

                if (i <= 3)
                    itemFont.Color = new ccColor3B(200, 20, 20);
                else if (i <= 6)
                    itemFont.Color = new ccColor3B(0, 200, 20);
                else
                    itemFont.Color = new ccColor3B(0, 20, 200);
            }

            pSubMenu.alignItemsHorizontally();
            pSubMenu.position = new CCPoint(s.width / 2, 80);
            addChild(pSubMenu, 2);

            // add title label
            CCLabelTTF label = CCLabelTTF.labelWithString(title(), "Arial", 40);
            addChild(label, 1);
            label.position = new CCPoint(s.width / 2, s.height - 32);
            label.Color = new ccColor3B(255, 255, 40);

            while (quantityNodes < nNodes)
                onIncrease(this);
        }