Example #1
0
		public void showFont(string pFont)
		{
			CCSize s = CCDirector.SharedDirector.WinSize;

			var blockSize = new CCSize(s.Width / 3, 200);
			float fontSize = 26;

			RemoveChildByTag(kTagLabel1, true);
			RemoveChildByTag(kTagLabel2, true);
			RemoveChildByTag(kTagLabel3, true);
			RemoveChildByTag(kTagLabel4, true);


			var top = new CCLabel(pFont,"Arial", 24);

			var left = new CCLabel("alignment left", pFont, fontSize,
			                                 blockSize, CCTextAlignment.Left,
			                                 SystemFontTestScene.verticalAlignment[SystemFontTestScene.vAlignIdx]);
			var center = new CCLabel("alignment center", pFont, fontSize,
			                                   blockSize, CCTextAlignment.Center,
			                                   SystemFontTestScene.verticalAlignment[SystemFontTestScene.vAlignIdx]);
			var right = new CCLabel("alignment right", pFont, fontSize,
			                                  blockSize, CCTextAlignment.Right,
			                                  SystemFontTestScene.verticalAlignment[SystemFontTestScene.vAlignIdx]);

            top.AnchorPoint = CCPoint.AnchorMiddleBottom;
            left.AnchorPoint = CCPoint.AnchorMiddle;// new CCPoint(0, 0.5f);
			center.AnchorPoint = CCPoint.AnchorMiddle;
            right.AnchorPoint = CCPoint.AnchorMiddle;

            float yMax = s.Height / 2f + 50f;
			top.Position = new CCPoint(s.Width / 2f, s.Height - 20f);
			left.Position = new CCPoint(s.Width/3f, yMax - 50);
			center.Position = new CCPoint(s.Width/2f, yMax - 50);
			right.Position = new CCPoint(s.Width * 2f/3f, yMax - 50);

			AddChild(left, 3, kTagLabel1);
			AddChild(right, 3, kTagLabel2);
			AddChild(center, 3, kTagLabel3);
			AddChild(top, 3, kTagLabel4);
		}