• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Cocos2D.CCSize类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Cocos2D.CCSize的典型用法代码示例。如果您正苦于以下问题:C# CCSize类的具体用法?C# CCSize怎么用?C# CCSize使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CCSize类属于Cocos2D命名空间,在下文中一共展示了CCSize类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: CreateNativeLabel

        internal static CCTexture2D CreateNativeLabel(string text, CCSize dimensions, CCTextAlignment hAlignment,
		                                   CCVerticalTextAlignment vAlignment, string fontName,
		                                   float fontSize, CCColor4B textColor)
		{

		    if (string.IsNullOrEmpty(text))
		    {
		        return new CCTexture2D();
		    }

		    var font = CreateFont (fontName, fontSize);

            if (dimensions.Equals(CCSize.Zero))
            {
                CreateBitmap(1, 1);

                var ms = _graphics.MeasureString(text, font);
                
                dimensions.Width = ms.Width;
                dimensions.Height = ms.Height;
            }

            CreateBitmap((int)dimensions.Width, (int)dimensions.Height);

            var stringFormat = new StringFormat();

		    switch (hAlignment)
		    {
		        case CCTextAlignment.Left:
                    stringFormat.Alignment = StringAlignment.Near;
		            break;
		        case CCTextAlignment.Center:
                    stringFormat.Alignment = StringAlignment.Center;
		            break;
		        case CCTextAlignment.Right:
                    stringFormat.Alignment = StringAlignment.Far;
		            break;
		    }

		    switch (vAlignment)
		    {
		        case CCVerticalTextAlignment.Top:
        		    stringFormat.LineAlignment = StringAlignment.Near;
		            break;
		        case CCVerticalTextAlignment.Center:
        		    stringFormat.LineAlignment = StringAlignment.Center;
		            break;
		        case CCVerticalTextAlignment.Bottom:
        		    stringFormat.LineAlignment = StringAlignment.Far;
		            break;
		    }

            _graphics.DrawString(text, font, _brush, new RectangleF(0, 0, dimensions.Width, dimensions.Height), stringFormat);
            _graphics.Flush();

			var texture = new CCTexture2D();
			texture.InitWithStream (SaveToStream(), Microsoft.Xna.Framework.Graphics.SurfaceFormat.Bgra4444);

			return texture;
		}
开发者ID:Karunp,项目名称:cocos2d-xna,代码行数:60,代码来源:CCLabelUtilities-Gdi.cs


示例2: CreateScaledMenuItemLabel

        public static CCMenuItem CreateScaledMenuItemLabel(CCSize buttonSize, int labelPadding, float strokeSize, CCColor3B textColor, CCColor3B strokeColor, CCColor3B backColor, string labelText, Action action)
        {
            var menuItem = action != null ? new CCMenuItem(o => action()) : new CCMenuItem();

            var labelSize = new CCSize(buttonSize.Width - labelPadding, buttonSize.Height - labelPadding);

            // Add background
            var blockSprite = new CCSprite("images/Block_Back");
            blockSprite.ScaleTo(buttonSize);
            blockSprite.Color = backColor;

            menuItem.AddChild(blockSprite);
            menuItem.ContentSize = buttonSize;

            // Add label
            var labelTtf = new CCLabelTTF(labelText, "arial-24", 10);
            labelTtf.Color = textColor;

            // Add Stroke to label
            // if (strokeSize > 0) labelTtf.AddStroke(strokeSize, strokeColor);

            if (labelTtf.ContentSize.Width > labelSize.Width)
            {
                labelTtf.ScaleTo(labelSize);
            }

            menuItem.AddChild(labelTtf);

            return menuItem;
        }
开发者ID:Ratel13,项目名称:cocos2d-xna,代码行数:30,代码来源:MenuTestScene.cs


示例3: updateSize

 public void updateSize(CCPoint touchLocation)
 {
     CCSize s = CCDirector.SharedDirector.WinSize;
     CCSize newSize = new CCSize(Math.Abs(touchLocation.X - s.Width / 2) * 2, Math.Abs(touchLocation.Y - s.Height / 2) * 2);
     CCLayerColor l = (CCLayerColor)GetChildByTag(kTagLayer);
     l.ContentSize = newSize;
 }
开发者ID:CartBlanche,项目名称:cocos2d-xna,代码行数:7,代码来源:LayerTest1.cs


示例4: InitWithTarget

 public bool InitWithTarget(Action<CCMenuItem> selector, CCMenuItem[] items)
 {
     base.InitWithTarget(selector);
     CascadeColorEnabled = true;
     CascadeOpacityEnabled = true;
     m_pSubItems = new List<CCMenuItem>();
     float w = float.MinValue;
     float h = float.MinValue;
     foreach (CCMenuItem item in items)
     {
         m_pSubItems.Add(item);
         AddChild(item, 0);
         item.Visible = false;
         if (w < item.ContentSize.Width)
         {
             w = item.ContentSize.Width;
         }
         if (h < item.ContentSize.Height)
         {
             h = item.ContentSize.Height;
         }
         item.AnchorPoint = CCPoint.AnchorMiddle;
     }
     ContentSize = new CCSize(w, h);
     foreach (CCMenuItem item in items)
     {
         item.Position = ContentSize.Center;
     }
     m_uSelectedIndex = int.MaxValue;
     SelectedIndex = 0;
     return true;
 }
开发者ID:Ratel13,项目名称:cocos2d-xna,代码行数:32,代码来源:CCMenuItemToggle.cs


示例5: Transform

 public static CCSize Transform(CCSize size, CCAffineTransform t)
 {
     var s = new CCSize();
     s.Width = (float) ((double) t.a * size.Width + (double) t.c * size.Height);
     s.Height = (float) ((double) t.b * size.Width + (double) t.d * size.Height);
     return s;
 }
开发者ID:Ratel13,项目名称:cocos2d-xna,代码行数:7,代码来源:CCAffineTransform.cs


示例6: ApplicationDidFinishLaunching

        /// <summary>
        ///  Implement CCDirector and CCScene init code here.
        /// </summary>
        /// <returns>
        ///  true  Initialize success, app continue.
        ///  false Initialize failed, app terminate.
        /// </returns>
        public override bool ApplicationDidFinishLaunching()
        {
            //initialize director
            CCDirector pDirector = CCDirector.SharedDirector;
            pDirector.SetOpenGlView();

            CCSpriteFontCache.RegisterFont("arial", 12, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 38, 50, 64);
            CCSpriteFontCache.RegisterFont("MarkerFelt", 16, 18, 22);
            CCSpriteFontCache.RegisterFont("MarkerFelt-Thin", 12, 18);
            CCSpriteFontCache.RegisterFont("Paint Boy", 26);
            CCSpriteFontCache.RegisterFont("Schwarzwald Regular", 26);
            CCSpriteFontCache.RegisterFont("Scissor Cuts", 26);
            CCSpriteFontCache.RegisterFont("A Damn Mess", 26);
            CCSpriteFontCache.RegisterFont("Abberancy", 26);
            CCSpriteFontCache.RegisterFont("Abduction", 26);

            // turn on display FPS
            pDirector.DisplayStats = true;
            // set FPS. the default value is 1.0/60 if you don't call this
            pDirector.AnimationInterval = 1.0 / 60;

            CCSize designSize = new CCSize(480, 320);

            if (CCDrawManager.FrameSize.Height > 320)
            {
                CCSize resourceSize = new CCSize(960, 640);
                CCContentManager.SharedContentManager.SearchPaths.Add("hd");
                pDirector.ContentScaleFactor = resourceSize.Height / designSize.Height;
            }

            CCDrawManager.SetDesignResolutionSize(designSize.Width, designSize.Height, CCResolutionPolicy.ShowAll);

/*
#if WINDOWS || WINDOWSGL
            CCDrawManager.SetDesignResolutionSize(1280, 768, CCResolutionPolicy.ExactFit);
#else
            CCDrawManager.SetDesignResolutionSize(800, 480, CCResolutionPolicy.ShowAll);
            //CCDrawManager.SetDesignResolutionSize(480, 320, CCResolutionPolicy.ShowAll);
#endif
*/

            // create a scene. it's an autorelease object
            CCScene pScene = new CCScene();
            CCLayer pLayer = new TestController();
            
            /*           
            CCScene pScene = CCScene.node();
            var pLayer = Box2DView.viewWithEntryID(0);
            pLayer.scale = 10;
            pLayer.anchorPoint = new CCPoint(0, 0);
            pLayer.position = new CCPoint(CCDirector.sharedDirector().getWinSize().width / 2, CCDirector.sharedDirector().getWinSize().height / 4);
            */

            pScene.AddChild(pLayer);
            pDirector.RunWithScene(pScene);

            return true;
        }
开发者ID:p07r0457,项目名称:cocos2d-xna,代码行数:65,代码来源:AppDelegate.cs


示例7: LCC3GraphicsTexture

 public LCC3GraphicsTexture(int tag, string name)
     : base(tag, name)
 {
     _size = new LCC3IntSize(0, 0);
     _coverage = CCSize.Zero;
     _hasMipmap = false;
     _isFlippedVertically = true;
     _hasPremultipliedAlpha = false;
     this.TextureParameters = this.DefaultTextureParameters;
 }
开发者ID:rtabbara,项目名称:Cocos3D-XNA,代码行数:10,代码来源:LCC3GraphicsTexture.cs


示例8: OnHandlePropTypeSize

 protected override void OnHandlePropTypeSize(CCNode node, CCNode parent, string propertyName, CCSize pSize, CCBReader reader)
 {
     if (propertyName == PROPERTY_CONTENTSIZE)
     {
         ((CCScrollView) node).ViewSize = pSize;
     }
     else
     {
         base.OnHandlePropTypeSize(node, parent, propertyName, pSize, reader);
     }
 }
开发者ID:Ratel13,项目名称:cocos2d-xna,代码行数:11,代码来源:CCScrollViewLoader.cs


示例9: InitWithTileFile

        public bool InitWithTileFile(string tile, string mapFile, int tileWidth, int tileHeight)
        {
            LoadTgAfile(mapFile);
            CalculateItemsToRender();

            if (base.InitWithTileFile(tile, tileWidth, tileHeight, m_nItemsToRender))
            {
                m_pPosToAtlasIndex = new Dictionary<CCGridSize, int>();
                UpdateAtlasValues();
                ContentSize = new CCSize(m_pTGAInfo.width * m_uItemWidth, m_pTGAInfo.height * m_uItemHeight);
                return true;
            }
            return false;
        }
开发者ID:Karunp,项目名称:cocos2d-xna,代码行数:14,代码来源:CCTileMapAtlas.cs


示例10: CCSizeFromString

		public static CCSize CCSizeFromString(string pszContent)
		{
			CCSize ret = new CCSize();
			
			do
			{
				List<string> strs = new List<string>();
				if (!CCUtils.SplitWithForm(pszContent, strs)) break;
				
				float width = CCUtils.CCParseFloat(strs[0]);
				float height = CCUtils.CCParseFloat(strs[1]);
				
				ret = new CCSize(width, height);
			} while (false);
			
			return ret;
		}
开发者ID:Ratel13,项目名称:cocos2d-xna,代码行数:17,代码来源:CCSizeConverter.cs


示例11: Enemy

        private CCSize _winSize; // Contains the dimensions of the game window

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Creates a new instance of an enemy using the Enemy content and mask.
        /// </summary>
        public Enemy()
            : base(GameObjectType.Enemy, "Images/Enemy", "Enemy")
        {
            // Create a new instance of the shots list
            _shots = new List<GameObject>();

            // Get the dimensions of the window
            _winSize = CCDirector.SharedDirector.WinSize;

            // Set the speed of the enemy
            _speed = CollisionGame.Rand.Next(2, 7);

            // Get the next time that a shot will be fired
            _nextShot = CollisionGame.Rand.Next(2, 5);

            // Tell Cocos2d-XNA to schedule a call to this sprite's Update method
            ScheduleUpdate();
        }
开发者ID:blueshirt13,项目名称:Cocos2D-XNA-Tutorials,代码行数:27,代码来源:Enemy.cs


示例12: updateAlignment

        private void updateAlignment()
        {
            var blockSize = new CCSize(200, 160);
            CCSize s = CCDirector.SharedDirector.WinSize;

            if (m_plabel != null)
            {
                m_plabel.RemoveFromParentAndCleanup(true);
            }

            m_plabel = new CCLabelTTF(getCurrentAlignment(), "Marker Felt", 32,
                                         blockSize, m_eHorizAlign, m_eVertAlign);

            m_plabel.AnchorPoint = new CCPoint(0, 0);
            m_plabel.Position = new CCPoint((s.Width - blockSize.Width) / 2, (s.Height - blockSize.Height) / 2);

            AddChild(m_plabel);
        }
开发者ID:CartBlanche,项目名称:cocos2d-xna,代码行数:18,代码来源:LabelTTFTest.cs


示例13: GetAbsolutePosition

        public static CCPoint GetAbsolutePosition(CCPoint pt, CCBPositionType nType, CCSize containerSize, string pPropName)
        {
            CCPoint absPt = new CCPoint(0, 0);
            
            if (nType == CCBPositionType.RelativeBottomLeft)
            {
                absPt = pt;
            }
            else if (nType == CCBPositionType.RelativeTopLeft)
            {
                absPt.X = pt.X;
                absPt.Y = containerSize.Height - pt.Y;
            }
            else if (nType == CCBPositionType.RelativeTopRight)
            {
                absPt.X = containerSize.Width - pt.X;
                absPt.Y = containerSize.Height - pt.Y;
            }
            else if (nType == CCBPositionType.RelativeBottomRight)
            {
                absPt.X = containerSize.Width - pt.X;
                absPt.Y = pt.Y;
            }
            else if (nType == CCBPositionType.Percent)
            {
                absPt.X = (int) (containerSize.Width * pt.X / 100.0f);
                absPt.Y = (int) (containerSize.Height * pt.Y / 100.0f);
            }
            else if (nType == CCBPositionType.MultiplyResolution)
            {
                float resolutionScale = CCBReader.ResolutionScale;

                absPt.X = pt.X * resolutionScale;
                absPt.Y = pt.Y * resolutionScale;
            }

            return absPt;
        }
开发者ID:Karunp,项目名称:cocos2d-xna,代码行数:38,代码来源:CCBPosition.cs


示例14: LabelTTFTest

        public LabelTTFTest()
        {
            var blockSize = new CCSize(200, 160);
            CCSize s = CCDirector.SharedDirector.WinSize;

            CCLayerColor colorLayer = new CCLayerColor(new CCColor4B(100, 100, 100, 255), blockSize.Width, blockSize.Height);
            colorLayer.AnchorPoint = new CCPoint(0, 0);
            colorLayer.Position = new CCPoint((s.Width - blockSize.Width) / 2, (s.Height - blockSize.Height) / 2);

            AddChild(colorLayer);

            CCMenuItemFont.FontSize = 30;
            CCMenu menu = new CCMenu(
                new CCMenuItemFont("Left", setAlignmentLeft),
                new CCMenuItemFont("Center", setAlignmentCenter),
                new CCMenuItemFont("Right", setAlignmentRight)
                );
            menu.AlignItemsVerticallyWithPadding(4);
            menu.Position = new CCPoint(50, s.Height / 2 - 20);
            AddChild(menu);

            menu = new CCMenu(
                new CCMenuItemFont("Top", setAlignmentTop),
                new CCMenuItemFont("Middle", setAlignmentMiddle),
                new CCMenuItemFont("Bottom", setAlignmentBottom)
                );
            menu.AlignItemsVerticallyWithPadding(4);
            menu.Position = new CCPoint(s.Width - 50, s.Height / 2 - 20);
            AddChild(menu);

            m_plabel = null;
            m_eHorizAlign = CCTextAlignment.CCTextAlignmentLeft;
            m_eVertAlign = CCVerticalTextAlignment.CCVerticalTextAlignmentTop;

            updateAlignment();
        }
开发者ID:CartBlanche,项目名称:cocos2d-xna,代码行数:36,代码来源:LabelTTFTest.cs


示例15: showFont

        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);

            CCLabelTTF top = new CCLabelTTF(pFont, "Arial", 24);
            CCLabelTTF left = new CCLabelTTF("alignment left", pFont, fontSize,
                                             blockSize, CCTextAlignment.Left,
                                             FontTestScene.verticalAlignment[FontTestScene.vAlignIdx]);
            CCLabelTTF center = new CCLabelTTF("alignment center", pFont, fontSize,
                                               blockSize, CCTextAlignment.Center,
                                               FontTestScene.verticalAlignment[FontTestScene.vAlignIdx]);
            CCLabelTTF right = new CCLabelTTF("alignment right", pFont, fontSize,
                                              blockSize, CCTextAlignment.Right,
                                              FontTestScene.verticalAlignment[FontTestScene.vAlignIdx]);

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

            top.Position = new CCPoint(s.Width / 2, s.Height - 20);
            left.Position = new CCPoint(0, s.Height / 2);
            center.Position = new CCPoint(blockSize.Width, s.Height / 2);
            right.Position = new CCPoint(blockSize.Width * 2, s.Height / 2);

            AddChild(left, 0, kTagLabel1);
            AddChild(right, 0, kTagLabel2);
            AddChild(center, 0, kTagLabel3);
            AddChild(top, 0, kTagLabel4);
        }
开发者ID:huaqiangs,项目名称:cocos2d-xna,代码行数:38,代码来源:FontTest.cs


示例16: showFont

		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);
		}
开发者ID:Ratel13,项目名称:cocos2d-xna,代码行数:41,代码来源:SystemFontTest.cs


示例17: CCLabelTTF

 public CCLabelTTF (string text, string fontName, float fontSize, CCSize dimensions, CCTextAlignment hAlignment,
                    CCVerticalTextAlignment vAlignment)
 {
     InitWithString(text, fontName, fontSize, dimensions, hAlignment, vAlignment);
 }
开发者ID:pekayatt,项目名称:cocos2d-xna,代码行数:5,代码来源:CCLabelTTF.cs


示例18: AlignItemsHorizontallyWithPadding

        public void AlignItemsHorizontallyWithPadding(float padding)
        {
            float height = 0f;
            float width = -padding;
            if (m_pChildren != null && m_pChildren.count > 0)
            {
                for (int i = 0, count = m_pChildren.count; i < count; i++)
                {
                    CCNode pChild = m_pChildren[i];
                    if (pChild.Visible)
                    {
                        width += pChild.ContentSize.Width * pChild.ScaleX + padding;
                        height = Math.Max(height, pChild.ContentSize.Height * pChild.ScaleY);
                    }
                }
            }

            float x = -width / 2.0f;

            if (m_pChildren != null && m_pChildren.count > 0)
            {
                for (int i = 0, count = m_pChildren.count; i < count; i++)
                {
                    CCNode pChild = m_pChildren[i];
                    if (pChild.Visible)
                    {
                        pChild.Position = new CCPoint(x + pChild.ContentSize.Width * pChild.ScaleX / 2.0f, 0);
                        x += pChild.ContentSize.Width * pChild.ScaleX + padding;
                        height = Math.Max(height, pChild.ContentSize.Height * pChild.ScaleY);
                    }
                }
            }
            ContentSize = new CCSize(width, height);
        }
开发者ID:netonjm,项目名称:cocos2d-xna,代码行数:34,代码来源:CCMenu.cs


示例19: InitWithString

 public bool InitWithString(string label, string fontName, float fontSize, CCSize dimensions, CCTextAlignment alignment)
 {
     return InitWithString(label, fontName, fontSize, dimensions, alignment, CCVerticalTextAlignment.Top);
 }
开发者ID:pekayatt,项目名称:cocos2d-xna,代码行数:4,代码来源:CCLabelTTF.cs


示例20: CreateFontChars

        public void CreateFontChars()
        {
            int nextFontPositionX = 0;
            int nextFontPositionY = 0;
            char prev = (char) 255;
            int kerningAmount = 0;

            CCSize tmpSize = CCSize.Zero;

            int longestLine = 0;
            int totalHeight = 0;

            int quantityOfLines = 1;

            if (String.IsNullOrEmpty(m_sString))
            {
                return;
            }

            int stringLen = m_sString.Length;

            var charSet = m_pConfiguration.CharacterSet;
            if (charSet.Count == 0)
            {
                throw (new InvalidOperationException(
                    "Can not compute the size of the font because the character set is empty."));
            }

            for (int i = 0; i < stringLen - 1; ++i)
            {
                if (m_sString[i] == '\n')
                {
                    quantityOfLines++;
                }
            }

            totalHeight = m_pConfiguration.m_nCommonHeight * quantityOfLines;
            nextFontPositionY = 0 -
                                (m_pConfiguration.m_nCommonHeight - m_pConfiguration.m_nCommonHeight * quantityOfLines);

            CCBMFontConfiguration.CCBMFontDef fontDef = null;
            CCRect rect;

            for (int i = 0; i < stringLen; i++)
            {
                char c = m_sString[i];

                if (c == '\n')
                {
                    nextFontPositionX = 0;
                    nextFontPositionY -= m_pConfiguration.m_nCommonHeight;
                    continue;
                }

                if (charSet.IndexOf(c) == -1)
                {
                    CCLog.Log("Cocos2D.CCLabelBMFont: Attempted to use character not defined in this bitmap: {0}",
                              (int) c);
                    continue;
                }

                kerningAmount = this.KerningAmountForFirst(prev, c);

                // unichar is a short, and an int is needed on HASH_FIND_INT
                if (!m_pConfiguration.m_pFontDefDictionary.TryGetValue(c, out fontDef))
                {
                    CCLog.Log("cocos2d::CCLabelBMFont: characer not found {0}", (int) c);
                    continue;
                }

                rect = fontDef.rect;
                rect = CCMacros.CCRectanglePixelsToPoints(rect);

                rect.Origin.X += m_tImageOffset.X;
                rect.Origin.Y += m_tImageOffset.Y;

                CCSprite fontChar;

                //bool hasSprite = true;
                fontChar = (CCSprite) (GetChildByTag(i));
                if (fontChar != null)
                {
                    // Reusing previous Sprite
                    fontChar.Visible = true;
                }
                else
                {
                    // New Sprite ? Set correct color, opacity, etc...
                    //if( false )
                    //{
                    //    /* WIP: Doesn't support many features yet.
                    //     But this code is super fast. It doesn't create any sprite.
                    //     Ideal for big labels.
                    //     */
                    //    fontChar = m_pReusedChar;
                    //    fontChar.BatchNode = null;
                    //    hasSprite = false;
                    //}
                    //else
                    {
//.........这里部分代码省略.........
开发者ID:huaqiangs,项目名称:cocos2d-xna,代码行数:101,代码来源:CCLabelBMFont.cs



注:本文中的Cocos2D.CCSize类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Cocos2D.CCSprite类代码示例发布时间:2022-05-24
下一篇:
C# Cocos2D.CCSequence类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap