当前位置: 首页>>代码示例>>C#>>正文


C# Texture2D.ThrowIfNull方法代码示例

本文整理汇总了C#中Microsoft.Xna.Framework.Graphics.Texture2D.ThrowIfNull方法的典型用法代码示例。如果您正苦于以下问题:C# Texture2D.ThrowIfNull方法的具体用法?C# Texture2D.ThrowIfNull怎么用?C# Texture2D.ThrowIfNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Xna.Framework.Graphics.Texture2D的用法示例。


在下文中一共展示了Texture2D.ThrowIfNull方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WindowTexture

        public WindowTexture(Texture2D texture, int spriteWidth, int spriteHeight)
        {
            texture.ThrowIfNull("texture");

            _texture = texture;
            _spriteWidth = spriteWidth;
            _spriteHeight = spriteHeight;
            _padding = new Padding(spriteWidth, spriteHeight);
            _borderTopLeftRectangle = new Rectangle(0, 0, spriteWidth, spriteHeight);
            _borderTopRectangle = new Rectangle(spriteWidth, 0, spriteWidth, spriteHeight);
            _borderTopRightRectangle = new Rectangle(spriteWidth * 2, 0, spriteWidth, spriteHeight);
            _borderRightRectangle = new Rectangle(spriteWidth * 2, spriteHeight, spriteWidth, spriteHeight);
            _borderBottomRightRectangle = new Rectangle(spriteWidth * 2, spriteHeight * 2, spriteWidth, spriteHeight);
            _borderBottomRectangle = new Rectangle(spriteWidth, spriteHeight * 2, spriteWidth, spriteHeight);
            _borderBottomLeftRectangle = new Rectangle(0, spriteHeight * 2, spriteWidth, spriteHeight);
            _borderTextureLeftRectangle = new Rectangle(0, spriteHeight, spriteWidth, spriteHeight);
            _backgroundTopLeftRectangle = new Rectangle(0, spriteHeight * 3, spriteWidth, spriteHeight);
            _backgroundTopRectangle = new Rectangle(spriteWidth, spriteHeight * 3, spriteWidth, spriteHeight);
            _backgroundTopRightRectangle = new Rectangle(spriteWidth * 2, spriteHeight * 3, spriteWidth, spriteHeight);
            _backgroundRightRectangle = new Rectangle(spriteWidth * 2, spriteHeight + (spriteHeight * 3), spriteWidth, spriteHeight);
            _backgroundBottomRightRectangle = new Rectangle(spriteWidth * 2, (spriteHeight * 2) + (spriteHeight * 3), spriteWidth, spriteHeight);
            _backgroundBottomRectangle = new Rectangle(spriteWidth, (spriteHeight * 2) + (spriteHeight * 3), spriteWidth, spriteHeight);
            _backgroundBottomLeftRectangle = new Rectangle(0, (spriteHeight * 2) + (spriteHeight * 3), spriteWidth, spriteHeight);
            _backgroundLeftRectangle = new Rectangle(0, spriteHeight + (spriteHeight * 3), spriteWidth, spriteHeight);
            _backgroundCenterRectangle = new Rectangle(spriteWidth, spriteHeight + (spriteHeight * 3), spriteWidth, spriteHeight);
            _upArrowRectangle = new Rectangle(spriteWidth * 3, 0, spriteWidth, spriteHeight);
            _downArrowRectangle = new Rectangle(spriteWidth * 3, spriteHeight, spriteWidth, spriteHeight);
        }
开发者ID:tj-miller,项目名称:TextAdventure,代码行数:28,代码来源:WindowTexture.cs


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