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

C# ISprite类代码示例

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

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



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

示例1: Render

        public void Render(ISprite sprite, Offset offset)
        {
            if (sprite == null)
                throw new ArgumentNullException("sprite");
            if (offset == null)
                throw new ArgumentNullException("offset");

            var consoleColorBackup = Console.BackgroundColor;

            Console.Clear(); // yeaks!

            var width = sprite.Size.Width;
            var height = sprite.Size.Height;

            for (int i = widthBorderOffset; i < width + widthBorderOffset; i++)
            {
                Console.SetCursorPosition(i, 0);
                Console.Write('-');
                Console.SetCursorPosition(i, height + heightBorderOffset);
                Console.Write('-');
            }
            for (int j = heightBorderOffset; j < height + heightBorderOffset; j++)
            {
                Console.SetCursorPosition(0, j);
                Console.Write('|');
                Console.SetCursorPosition(width + widthBorderOffset, j);
                Console.Write('|');
            }
            Console.SetCursorPosition(0, 0);
            Console.Write('/');
            Console.SetCursorPosition(width + widthBorderOffset, 0);
            Console.Write('\\');
            Console.SetCursorPosition(0, height + heightBorderOffset);
            Console.Write('\\');
            Console.SetCursorPosition(width + widthBorderOffset, height + heightBorderOffset);
            Console.Write('/');

            var consoleBounds = new { Width = Console.WindowWidth, Height = Console.WindowHeight };
            for (var i = 0; i < sprite.Size.Width; i++)
            {
                for (var j = 0; j < sprite.Size.Height; j++)
                {
                    var x = offset.Left + i + widthBorderOffset;
                    var y = offset.Top + j + heightBorderOffset;

                    var brushBackground = sprite[i, j];

                    if (!((x >= 0) && (x < consoleBounds.Width) && (y >= 0)) || brushBackground == Color.Transparent)
                    {
                        continue;
                    }

                    Console.SetCursorPosition(x, y);
                    Console.BackgroundColor = brushBackground.ToConsoleColor();
                    Console.Write(_brushSymbol);
                }
            }

            Console.BackgroundColor = consoleColorBackup;
        }
开发者ID:MarkiyanMatsekh,项目名称:MultiplayerTetris,代码行数:60,代码来源:ConsoleRenderer.cs


示例2: AGSSingleFrameAnimation

		public AGSSingleFrameAnimation (ISprite sprite) : base(new AGSAnimationConfiguration { Loops = 1 },
			new AGSAnimationState(), 1)
		{
			AGSAnimationFrame frame = new AGSAnimationFrame (sprite) { Delay = -1 };
			Frames.Add (frame);
			Setup ();
		}
开发者ID:tzachshabtay,项目名称:MonoAGS,代码行数:7,代码来源:AGSSingleFrameAnimation.cs


示例3: HandleCollision

 public override void HandleCollision(ISprite movSprite)
 {
     sounds.PlayCoin();
     scene.mario.Coins += 1;
     scene.mario.Points += 200;
        // scene.Sprites.Remove(this);
 }
开发者ID:CurtisHolton1,项目名称:MarioGame,代码行数:7,代码来源:ItemSprite.cs


示例4: CanDrawSprite

        /// <summary>
        /// Checks if a <see cref="ISprite"/> is valid to be drawn.
        /// </summary>
        /// <param name="sprite">The sprite to draw.</param>
        /// <returns>True if the <paramref name="sprite"/> can be used to draw; otherwise false.</returns>
        static bool CanDrawSprite(ISprite sprite)
        {
            if (sprite == null)
            {
                const string errmsg = "Attempted to draw using a null sprite.";
                if (log.IsWarnEnabled)
                    log.Warn(errmsg);
                return false;
            }

            if (sprite.Texture == null || sprite.Texture.IsDisposed)
            {
                const string errmsg = "Attempted to draw using sprite `{0}`, but the texture is not set or is disposed.";
                if (log.IsWarnEnabled)
                    log.WarnFormat(errmsg, sprite);
                return false;
            }

            if (sprite.Size.X < 1 || sprite.Size.Y < 1)
            {
                const string errmsg = "Attempted to draw using sprite `{0}`, but the size (width and/or height) is < 1.";
                if (log.IsWarnEnabled)
                    log.WarnFormat(errmsg, sprite);
                return false;
            }

            return true;
        }
开发者ID:mateuscezar,项目名称:netgore,代码行数:33,代码来源:ISpriteBatchExtensions.cs


示例5: Z_NormalEatingRenderBehavior

 public Z_NormalEatingRenderBehavior()
     : base()
 {
     sprite = SCSServices.Instance.ResourceManager.GetResource<ISprite>("Zombies/Nameless/Attack");
     SpriteBound = new Rectangle(0, 0, 89, 101);
     sprite.Play();
 }
开发者ID:doanhtdpl,项目名称:plants-vs-zombies-gameonmobile-uit-term7,代码行数:7,代码来源:Z_NormalEatingRenderBehavior.cs


示例6: CheckCollision

        public override bool CheckCollision(ISprite sprite)
        {
            Player player = (Player)sprite;
            Rectangle rectangle = new Rectangle((int)player._Position.X, (int)player._Position.Y, player.Texture.Width, player.Texture.Height);

            return CoinRectangle.Intersects(rectangle);
        }
开发者ID:djastin,项目名称:XNA2DGame,代码行数:7,代码来源:Coin.cs


示例7: CompositeSpriteHolder

        public CompositeSpriteHolder(ISprite Tileset, int[,,] Tiles, int TileSize)
        {
            if (!(Tileset.FullSize.Width/(float) TileSize).IsInteger() ||
                !(Tileset.FullSize.Height/(float) TileSize).IsInteger())
                throw new Exception("The TileSize doesn't fit the image.");

            this.Tileset = Tileset;
            this.TileSize = TileSize;

            var sizeX = Tiles.GetLength(0);
            var sizeY = Tiles.GetLength(1);
            var sizeZ = Tiles.GetLength(2);
            var tilesX = Tileset.FullSize.Width/TileSize;
            var tiles = new Tuple<int, int>[sizeX, sizeY, sizeZ];

            for (int i = 0; i < sizeX; i++)
                for (int j = 0; j < sizeY; j++)
                    for (int k = 0; k < sizeZ; k++)
                        tiles[i, j, k] = new Tuple<int, int>(Tiles[i, j, k]%tilesX, Tiles[i, j, k]/tilesX);

            this.Tiles = tiles;

            MinDepth = 0.5f;
            MaxDepth = 0.5f;
        }
开发者ID:iLambda,项目名称:Freemwork,代码行数:25,代码来源:CompositeSpriteHolder.cs


示例8: Sprite

 protected Sprite(ISprite other)
 {
     _size = other.Size;
     _layout = new Color[_size.Width, _size.Height];
     for (int i = 0; i < _size.Width; i++)
         for (int j = 0; j < _size.Height; j++)
             _layout[i, j] = other[i, j];
 }
开发者ID:MarkiyanMatsekh,项目名称:MultiplayerTetris,代码行数:8,代码来源:Sprite.cs


示例9: Render

 public void Render(ISprite sprite)
 {
     ExecuteThreadSafe(copiedRenderers =>
     {
         foreach (var renderer in copiedRenderers)
             renderer.Render(sprite);
     });
 }
开发者ID:MarkiyanMatsekh,项目名称:MultiplayerTetris,代码行数:8,代码来源:ProxyRenderer.cs


示例10: doesCollideWith

        public virtual bool doesCollideWith(ISprite otherSprite)
        {
            // no collision with self.
            if (Equals(otherSprite))
                return false;

            return GetBoundingBox().Intersects(otherSprite.GetBoundingBox());
        }
开发者ID:knutdr,项目名称:Space_defender,代码行数:8,代码来源:Sprite.cs


示例11: RenderDiff

 public void RenderDiff(ISprite oldSprite, ISprite newSprite)
 {
     ExecuteThreadSafe(copiedRenderers =>
     {
         foreach (var renderer in copiedRenderers)
             renderer.RenderDiff(oldSprite, newSprite);
     });
 }
开发者ID:MarkiyanMatsekh,项目名称:MultiplayerTetris,代码行数:8,代码来源:ProxyRenderer.cs


示例12: ThrowFireLeftDecorator

 public ThrowFireLeftDecorator(IMario mario, Game1 game)
 {
     this.mario = mario;
     this.myGame = game;
     WorldManager.SetPlayer(this);
     sprite = MarioSpriteFactory.CreateFireThrowLeft();
 }
开发者ID:Bartholomew-m134,项目名称:BuckeyeGameEngine,代码行数:7,代码来源:ThrowFireLeftDecorator.cs


示例13: NewStageMinorMode

 /// <summary>
 /// Constructs the minor mode and sets up the internal
 /// sprites.
 /// </summary>
 public NewStageMinorMode()
     : base()
 {
     // Create the block with a placeholder
     block =	AssetLoader.Instance.CreateSprite("Star");
     Viewport.Add(block);
 }
开发者ID:dmoonfire,项目名称:cutegod,代码行数:11,代码来源:NewStageMinorMode.cs


示例14: DoublePipe

 public DoublePipe(Vector2 marioWarpCoordinates, Game1 game)
 {
     myGame = game;
     pipeSprite = TileSpriteFactory.CreateDoublePipeSprite();
     isWarpPipe = true;
     warpLocation = marioWarpCoordinates;
 }
开发者ID:Bartholomew-m134,项目名称:BuckeyeGameEngine,代码行数:7,代码来源:DoublePipe.cs


示例15: FigureBase

 protected FigureBase(Offset placement, PositionsCollection positions)
 {
     _positions = positions;
     _placement = placement;
     _positionNumber = 0;
     _sprite = _positions.GetPositionByNumber(0);
 }
开发者ID:MarkiyanMatsekh,项目名称:MultiplayerTetris,代码行数:7,代码来源:FigureBase.cs


示例16: Explode

 public void Explode()
 {
     FireSprite = ProjectileSpriteFactory.CreateExplodingFireSprite();
     physics.Acceleration = Vector2.Zero;
     physics.Velocity = Vector2.Zero;
     isExploded = true;
 }
开发者ID:Bartholomew-m134,项目名称:BuckeyeGameEngine,代码行数:7,代码来源:LeftFire.cs


示例17: Mario

        public Mario(Game1 game, int posX, int posY)
        {
            MarioFactory = new MarioFactory(game);
            currentSprite = (MarioSprite)MarioFactory.MakeProduct(1);
            powerupStateFactor = 0;
            actionStateFactor = 1;
            direction = 1;
            idle = new MarioIdleState(this);
            jump = new MarioJumpingState(this);
            walk = new MarioWalkingState(this);
            crouch = new MarioCrouchingState(this);
            fall = new MarioFallingState(this);
            standard = new MarioStandard(this);
            super = new MarioSuper(this);
            fire = new MarioFire(this);
            dead = new MarioDead(this);

            powerupState = standard;
            currentState = idle;
            previousState = currentState;
            previousSprite = currentSprite;

            marioVec.X = posX;
            marioVec.Y = posY;
        }
开发者ID:bergerad,项目名称:Test,代码行数:25,代码来源:Mario.cs


示例18: InvisibleFlagPoleBarrier

 public InvisibleFlagPoleBarrier(Game1 game)
 {
     hasBeenActivatedOnce = false;
     myGame = game;
     invisibleFlagPoleSprite = TileSpriteFactory.CreateInvisibleFlagPoleSprite();
     isActive = false;
 }
开发者ID:Bartholomew-m134,项目名称:BuckeyeGameEngine,代码行数:7,代码来源:InvisibleFlagPoleBarrier.cs


示例19: Brick

 public Brick(int x, int y, Camera cam, BrickState s)
 {
     xPosition = x;
     yPosition = y;
     camera = cam;
     state = s;
     switch (s)
     {
         case BrickState.qempty:
             //this never happens in our level, but it's good to have in theory.
             BrickSprite = new Sprites.HitQBlockSprite();
             break;
         case BrickState.bempty:
         case BrickState.bcoin:
         case BrickState.bstar:
             BrickSprite = new Sprites.TopBrickSprite();
             break;
         case BrickState.destroyed:
             BrickSprite = null;
             break;
         default:
             BrickSprite = new Sprites.QBlockSprite();
             break;
     }
 }
开发者ID:FrankHYB,项目名称:MarioGame,代码行数:25,代码来源:Brick.cs


示例20: FlagPole

 public FlagPole(Game1 game)
 {
     myGame = game;
     flagPoleSprite = TileSpriteFactory.CreateInactiveFlagPoleSprite();
     isActive = false;
     hasBeenActivatedOnce = false;
 }
开发者ID:Bartholomew-m134,项目名称:BuckeyeGameEngine,代码行数:7,代码来源:FlagPole.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# ISpriteBatch类代码示例发布时间:2022-05-24
下一篇:
C# ISpell类代码示例发布时间: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