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


C# GraphicsDevice.DrawImage方法代码示例

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


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

示例1: DrawSomething

 public override void DrawSomething(GraphicsDevice graphics)
 {
     if (showTitle)
     {
         graphics.DrawImage(GameImage.Title, 512, 256, (Settings.SCREEN_WIDTH - 512) / 2 - IntCameraX + 16, (Settings.SCREEN_HEIGHT - 256) / 2 - IntCameraY + 16);
     }
 }
开发者ID:sinshu,项目名称:chaos,代码行数:7,代码来源:GameSceneForTitleScene.cs

示例2: DrawBackground

 public override void DrawBackground(GraphicsDevice graphics)
 {
     graphics.DrawImage(GameImage.Background4, 1024, 512, IntBackgroundX, IntBackgroundY, 64, 64, 64);
     for (int i = 0; i < 512; i++)
     {
         int y = (int)Math.Round(16 * Math.Sin(2 * Math.PI * (i + 0.5 * Ticks) / 128));
         int color = i + 2 * Ticks;
         graphics.DrawImageAdd(GameImage.Aurora, 2, 256, 0, i, IntBackgroundX + 2 * i, y, 128, GetAuroraColorR(color), GetAuroraColorG(color), GetAuroraColorB(color));
     }
 }
开发者ID:sinshu,项目名称:chaos,代码行数:10,代码来源:GameScene20.cs

示例3: Draw

 public override void Draw(GraphicsDevice graphics)
 {
     int drawX = (int)Math.Round(position.X) - game.IntCameraX - 8;
     int drawY = (int)Math.Round(position.Y) - game.IntCameraY - 8;
     if (animation < 48)
     {
         graphics.DrawImage(GameImage.Debris, 16, 16, type, animation / 2 % 8, drawX, drawY, 64, 64, 64);
     }
     else
     {
         graphics.DrawImageAlpha(GameImage.Debris, 16, 16, type, animation / 2 % 8, drawX, drawY, 255 - 16 * (animation - 48), 64, 64, 64);
     }
 }
开发者ID:sinshu,项目名称:chaos,代码行数:13,代码来源:BlackDebris.cs

示例4: Draw

 public void Draw(GraphicsDevice graphics)
 {
     int drawX = (int)Math.Round(position.X) - game.IntCameraX;
     int drawY = (int)Math.Round(position.Y) - game.IntCameraY;
     if (visible)
     {
         if (fadeCount < 64)
         {
             graphics.DrawImageAlpha(GameImage.Block, 64, 64, 3, 0, drawX, drawY, 4 * fadeCount);
             graphics.DrawImageAlpha(GameImage.Block, 64, 64, 3, 1, drawX, drawY, 4 * fadeCount);
         }
         else if (slideCount < 20)
         {
             graphics.DrawImage(GameImage.Block, 64, 64, 3, 0, drawX, drawY);
             graphics.DrawImage2(GameImage.Block, 76 + slideCount, 196, 20 - slideCount, 60, drawX + 12, drawY + 4);
             graphics.DrawImage2(GameImage.Block, 96, 196, 20 - slideCount, 60, drawX + 32 + slideCount, drawY + 4);
         }
         else
         {
             graphics.DrawImage(GameImage.Block, 64, 64, 3, 0, drawX, drawY);
         }
     }
 }
开发者ID:sinshu,项目名称:chaos,代码行数:23,代码来源:ExitDoor.cs

示例5: DrawBackground

 public override void DrawBackground(GraphicsDevice graphics)
 {
     graphics.DrawImage(GameImage.Background2, 1024, 512, IntBackgroundX, IntBackgroundY);
 }
开发者ID:sinshu,项目名称:chaos,代码行数:4,代码来源:GameScene06.cs

示例6: DrawWhereExitIs

 public bool DrawWhereExitIs(GraphicsDevice graphics)
 {
     Vector focus = door.Center - camera;
     ThingScreenPosition sp = GetScreenPosition(door.Center);
     switch (sp)
     {
         case ThingScreenPosition.Left:
             if (focus.Y < 16)
             {
                 graphics.DrawImage(GameImage.Hud, 32, 32, 0, 0, 0, 0);
                 graphics.DrawImage(GameImage.Hud, 64, 32, 1, 1, 32, 0);
             }
             else if (focus.Y > Settings.SCREEN_HEIGHT - 16)
             {
                 graphics.DrawImage(GameImage.Hud, 32, 32, 0, 0, 0, Settings.SCREEN_HEIGHT - 32);
                 graphics.DrawImage(GameImage.Hud, 64, 32, 1, 1, 32, Settings.SCREEN_HEIGHT - 32);
             }
             else
             {
                 graphics.DrawImage(GameImage.Hud, 32, 32, 0, 0, 0, (int)Math.Round(focus.Y) - 16);
                 graphics.DrawImage(GameImage.Hud, 64, 32, 1, 1, 32, (int)Math.Round(focus.Y) - 16);
             }
             return true;
         case ThingScreenPosition.LeftUpper:
             graphics.DrawImage(GameImage.Hud, 32, 32, 0, 1, 0, 0);
             graphics.DrawImage(GameImage.Hud, 64, 32, 1, 1, 32, 32);
             return true;
         case ThingScreenPosition.Upper:
             if (focus.X < 16) graphics.DrawImage(GameImage.Hud, 32, 32, 0, 2, 0, 0);
             else if (focus.X > Settings.SCREEN_WIDTH - 16) graphics.DrawImage(GameImage.Hud, 32, 32, 0, 2, Settings.SCREEN_WIDTH - 32, 0);
             else graphics.DrawImage(GameImage.Hud, 32, 32, 0, 2, (int)Math.Round(focus.X) - 16, 0);
             if (focus.X < 32) graphics.DrawImage(GameImage.Hud, 64, 32, 1, 1, 0, 32);
             else if (focus.X > Settings.SCREEN_WIDTH - 32) graphics.DrawImage(GameImage.Hud, 64, 32, 1, 1, Settings.SCREEN_WIDTH - 64, 32);
             else graphics.DrawImage(GameImage.Hud, 64, 32, 1, 1, (int)Math.Round(focus.X) - 32, 32);
             return true;
         case ThingScreenPosition.RightUpper:
             graphics.DrawImage(GameImage.Hud, 32, 32, 0, 3, Settings.SCREEN_WIDTH - 32, 0);
             graphics.DrawImage(GameImage.Hud, 64, 32, 1, 1, Settings.SCREEN_WIDTH - 96, 32);
             return true;
         case ThingScreenPosition.Right:
             if (focus.Y < 16)
             {
                 graphics.DrawImage(GameImage.Hud, 32, 32, 0, 4, Settings.SCREEN_WIDTH - 32, 0);
                 graphics.DrawImage(GameImage.Hud, 64, 32, 1, 1, Settings.SCREEN_WIDTH - 96, 0);
             }
             else if (focus.Y > Settings.SCREEN_HEIGHT - 16)
             {
                 graphics.DrawImage(GameImage.Hud, 32, 32, 0, 4, Settings.SCREEN_WIDTH - 32, Settings.SCREEN_HEIGHT - 32);
                 graphics.DrawImage(GameImage.Hud, 64, 32, 1, 1, Settings.SCREEN_WIDTH - 96, Settings.SCREEN_HEIGHT - 32);
             }
             else
             {
                 graphics.DrawImage(GameImage.Hud, 32, 32, 0, 4, Settings.SCREEN_WIDTH - 32, (int)Math.Round(focus.Y) - 16);
                 graphics.DrawImage(GameImage.Hud, 64, 32, 1, 1, Settings.SCREEN_WIDTH - 96, (int)Math.Round(focus.Y) - 16);
             }
             return true;
         case ThingScreenPosition.RightLower:
             graphics.DrawImage(GameImage.Hud, 32, 32, 0, 5, Settings.SCREEN_WIDTH - 32, Settings.SCREEN_HEIGHT - 32);
             graphics.DrawImage(GameImage.Hud, 64, 32, 1, 1, Settings.SCREEN_WIDTH - 96, Settings.SCREEN_HEIGHT - 64);
             return true;
         case ThingScreenPosition.Lower:
             if (focus.X < 16) graphics.DrawImage(GameImage.Hud, 32, 32, 0, 6, 0, Settings.SCREEN_HEIGHT - 32);
             else if (focus.X > Settings.SCREEN_WIDTH - 16) graphics.DrawImage(GameImage.Hud, 32, 32, 0, 6, Settings.SCREEN_WIDTH - 32, Settings.SCREEN_HEIGHT - 32);
             else graphics.DrawImage(GameImage.Hud, 32, 32, 0, 6, (int)Math.Round(focus.X) - 16, Settings.SCREEN_HEIGHT - 32);
             if (focus.X < 32) graphics.DrawImage(GameImage.Hud, 64, 32, 1, 1, 0, Settings.SCREEN_HEIGHT - 64);
             else if (focus.X > Settings.SCREEN_WIDTH - 32) graphics.DrawImage(GameImage.Hud, 64, 32, 1, 1, Settings.SCREEN_WIDTH - 64, Settings.SCREEN_HEIGHT - 64);
             else graphics.DrawImage(GameImage.Hud, 64, 32, 1, 1, (int)Math.Round(focus.X) - 32, Settings.SCREEN_HEIGHT - 64);
             return true;
         case ThingScreenPosition.LeftLower:
             graphics.DrawImage(GameImage.Hud, 32, 32, 0, 7, 0, Settings.SCREEN_HEIGHT - 32);
             graphics.DrawImage(GameImage.Hud, 64, 32, 1, 1, 32, Settings.SCREEN_HEIGHT - 64);
             return true;
     }
     return false;
 }
开发者ID:sinshu,项目名称:chaos,代码行数:75,代码来源:GameScene.cs

示例7: DrawWhereEnemyIs

 public bool DrawWhereEnemyIs(GraphicsDevice graphics)
 {
     double minRange = double.MaxValue;
     Thing target = null;
     ThingScreenPosition targetPos = ThingScreenPosition.InScreen;
     foreach (Thing enemy in enemies)
     {
         ThingScreenPosition sp = GetScreenPosition(enemy.Center);
         if (sp == ThingScreenPosition.InScreen)
         {
             return false;
         }
         if (enemy is AtField || enemy is EggMachine)
         {
             continue;
         }
         Vector d = enemy.Center - player.Center;
         double range = d.X * d.X + d.Y * d.Y;
         if (range < minRange)
         {
             minRange = range;
             target = enemy;
             targetPos = sp;
         }
     }
     if (target != null)
     {
         Vector focus = target.Center - camera;
         switch (targetPos)
         {
             case ThingScreenPosition.Left:
                 if (focus.Y < 16)
                 {
                     graphics.DrawImage(GameImage.Hud, 32, 32, 0, 0, 0, 0);
                     graphics.DrawImage(GameImage.Hud, 64, 32, 1, 0, 32, 0);
                 }
                 else if (focus.Y > Settings.SCREEN_HEIGHT - 16)
                 {
                     graphics.DrawImage(GameImage.Hud, 32, 32, 0, 0, 0, Settings.SCREEN_HEIGHT - 32);
                     graphics.DrawImage(GameImage.Hud, 64, 32, 1, 0, 32, Settings.SCREEN_HEIGHT - 32);
                 }
                 else
                 {
                     graphics.DrawImage(GameImage.Hud, 32, 32, 0, 0, 0, (int)Math.Round(focus.Y) - 16);
                     graphics.DrawImage(GameImage.Hud, 64, 32, 1, 0, 32, (int)Math.Round(focus.Y) - 16);
                 }
                 return true;
             case ThingScreenPosition.LeftUpper:
                 graphics.DrawImage(GameImage.Hud, 32, 32, 0, 1, 0, 0);
                 graphics.DrawImage(GameImage.Hud, 64, 32, 1, 0, 32, 32);
                 return true;
             case ThingScreenPosition.Upper:
                 if (focus.X < 16) graphics.DrawImage(GameImage.Hud, 32, 32, 0, 2, 0, 0);
                 else if (focus.X > Settings.SCREEN_WIDTH - 16) graphics.DrawImage(GameImage.Hud, 32, 32, 0, 2, Settings.SCREEN_WIDTH - 32, 0);
                 else graphics.DrawImage(GameImage.Hud, 32, 32, 0, 2, (int)Math.Round(focus.X) - 16, 0);
                 if (focus.X < 32) graphics.DrawImage(GameImage.Hud, 64, 32, 1, 0, 0, 32);
                 else if (focus.X > Settings.SCREEN_WIDTH - 32) graphics.DrawImage(GameImage.Hud, 64, 32, 1, 0, Settings.SCREEN_WIDTH - 64, 32);
                 else graphics.DrawImage(GameImage.Hud, 64, 32, 1, 0, (int)Math.Round(focus.X) - 32, 32);
                 return true;
             case ThingScreenPosition.RightUpper:
                 graphics.DrawImage(GameImage.Hud, 32, 32, 0, 3, Settings.SCREEN_WIDTH - 32, 0);
                 graphics.DrawImage(GameImage.Hud, 64, 32, 1, 0, Settings.SCREEN_WIDTH - 96, 32);
                 return true;
             case ThingScreenPosition.Right:
                 if (focus.Y < 16)
                 {
                     graphics.DrawImage(GameImage.Hud, 32, 32, 0, 4, Settings.SCREEN_WIDTH - 32, 0);
                     graphics.DrawImage(GameImage.Hud, 64, 32, 1, 0, Settings.SCREEN_WIDTH - 96, 0);
                 }
                 else if (focus.Y > Settings.SCREEN_HEIGHT - 16)
                 {
                     graphics.DrawImage(GameImage.Hud, 32, 32, 0, 4, Settings.SCREEN_WIDTH - 32, Settings.SCREEN_HEIGHT - 32);
                     graphics.DrawImage(GameImage.Hud, 64, 32, 1, 0, Settings.SCREEN_WIDTH - 96, Settings.SCREEN_HEIGHT - 32);
                 }
                 else
                 {
                     graphics.DrawImage(GameImage.Hud, 32, 32, 0, 4, Settings.SCREEN_WIDTH - 32, (int)Math.Round(focus.Y) - 16);
                     graphics.DrawImage(GameImage.Hud, 64, 32, 1, 0, Settings.SCREEN_WIDTH - 96, (int)Math.Round(focus.Y) - 16);
                 }
                 return true;
             case ThingScreenPosition.RightLower:
                 graphics.DrawImage(GameImage.Hud, 32, 32, 0, 5, Settings.SCREEN_WIDTH - 32, Settings.SCREEN_HEIGHT - 32);
                 graphics.DrawImage(GameImage.Hud, 64, 32, 1, 0, Settings.SCREEN_WIDTH - 96, Settings.SCREEN_HEIGHT - 64);
                 return true;
             case ThingScreenPosition.Lower:
                 if (focus.X < 16) graphics.DrawImage(GameImage.Hud, 32, 32, 0, 6, 0, Settings.SCREEN_HEIGHT - 32);
                 else if (focus.X > Settings.SCREEN_WIDTH - 16) graphics.DrawImage(GameImage.Hud, 32, 32, 0, 6, Settings.SCREEN_WIDTH - 32, Settings.SCREEN_HEIGHT - 32);
                 else graphics.DrawImage(GameImage.Hud, 32, 32, 0, 6, (int)Math.Round(focus.X) - 16, Settings.SCREEN_HEIGHT - 32);
                 if (focus.X < 32) graphics.DrawImage(GameImage.Hud, 64, 32, 1, 0, 0, Settings.SCREEN_HEIGHT - 64);
                 else if (focus.X > Settings.SCREEN_WIDTH - 32) graphics.DrawImage(GameImage.Hud, 64, 32, 1, 0, Settings.SCREEN_WIDTH - 64, Settings.SCREEN_HEIGHT - 64);
                 else graphics.DrawImage(GameImage.Hud, 64, 32, 1, 0, (int)Math.Round(focus.X) - 32, Settings.SCREEN_HEIGHT - 64);
                 return true;
             case ThingScreenPosition.LeftLower:
                 graphics.DrawImage(GameImage.Hud, 32, 32, 0, 7, 0, Settings.SCREEN_HEIGHT - 32);
                 graphics.DrawImage(GameImage.Hud, 64, 32, 1, 0, 32, Settings.SCREEN_HEIGHT - 64);
                 return true;
         }
     }
     return false;
 }
开发者ID:sinshu,项目名称:chaos,代码行数:100,代码来源:GameScene.cs

示例8: DrawBackground

 public override void DrawBackground(GraphicsDevice graphics)
 {
     graphics.DrawImage(GameImage.Background1, 1024, 512, IntBackgroundX, IntBackgroundY, 32 + (255 - skyColorCount) * 7 / 8, 32 + (255 - skyColorCount) * 3 / 8, 32);
 }
开发者ID:sinshu,项目名称:chaos,代码行数:4,代码来源:GameScene05.cs

示例9: DrawBackground

 public override void DrawBackground(GraphicsDevice graphics)
 {
     int color = 192 + skyColorCount / 4;
     graphics.DrawImage(GameImage.Background2, 1024, 512, IntBackgroundX, IntBackgroundY, color, color, color);
 }
开发者ID:sinshu,项目名称:chaos,代码行数:5,代码来源:GameScene07.cs

示例10: Draw

 public override void Draw(GraphicsDevice graphics)
 {
     int drawX = (int)Math.Round(position.X) - game.IntCameraX;
     int drawY = (int)Math.Round(position.Y) - game.IntCameraY;
     graphics.DrawImage(GameImage.Item, 32, 32, 0, animation / 2, drawX, drawY);
 }
开发者ID:sinshu,项目名称:chaos,代码行数:6,代码来源:MachinegunItem.cs

示例11: DrawBackground

 public override void DrawBackground(GraphicsDevice graphics)
 {
     graphics.DrawImage(GameImage.Background1, 1024, 512, IntBackgroundX, IntBackgroundY, 255, 128 + (255 - skyColorCount) / 2, 255 - (skyColorCount * 7 / 8));
 }
开发者ID:sinshu,项目名称:chaos,代码行数:4,代码来源:GameScene04.cs

示例12: DrawBackground

 public override void DrawBackground(GraphicsDevice graphics)
 {
     int color = 64 + (255 - skyColorCount) * 3 / 4;
     graphics.DrawImage(GameImage.Background4, 1024, 512, IntBackgroundX, IntBackgroundY, color, color, color);
 }
开发者ID:sinshu,项目名称:chaos,代码行数:5,代码来源:GameScene18.cs

示例13: Draw

        public void Draw(GraphicsDevice graphics)
        {
            graphics.FillScreen(0, 0, 0, 192);

            graphics.DrawImageAdd(GameImage.Message, 256, 32, 3, 0, (Settings.SCREEN_WIDTH - 256) / 2, Settings.SCREEN_HEIGHT / 2 - 80, 255);

            if (currentStageIndex + 1 < 10)
            {
                graphics.DrawImageAdd(GameImage.Number, 32, 64, 0, currentStageIndex + 1, (Settings.SCREEN_WIDTH - 32) / 2, (Settings.SCREEN_HEIGHT - 64) / 2, 255);
            }
            else
            {
                graphics.DrawImageAdd(GameImage.Number, 32, 64, 0, (currentStageIndex + 1) / 10, (Settings.SCREEN_WIDTH - 64) / 2, (Settings.SCREEN_HEIGHT - 64) / 2, 255);
                graphics.DrawImageAdd(GameImage.Number, 32, 64, 0, (currentStageIndex + 1) % 10, (Settings.SCREEN_WIDTH - 64) / 2 + 32, (Settings.SCREEN_HEIGHT - 64) / 2, 255);
            }

            if (currentStageIndex > 0)
            {
                graphics.DrawImage(GameImage.Hud, 32, 32, 0, 0, Settings.SCREEN_WIDTH / 2 - 80, Settings.SCREEN_HEIGHT / 2 - 16);
            }
            if (currentStageIndex + 1 < numUnlockedStages)
            {
                graphics.DrawImage(GameImage.Hud, 32, 32, 0, 4, Settings.SCREEN_WIDTH / 2 + 48, Settings.SCREEN_HEIGHT / 2 - 16);
            }

            if (gotoGameCount > 0)
            {
                if (gotoGameCount < 16)
                {
                    graphics.FillScreen(255, 255, 255, 16 * gotoGameCount);
                }
                else
                {
                    graphics.FillScreen(255, 255, 255, 255);
                }
            }
        }
开发者ID:sinshu,项目名称:chaos,代码行数:37,代码来源:StageSelectScene.cs

示例14: Draw

        public void Draw(GraphicsDevice graphics, int r, int g, int b)
        {
            int topRow = game.IntCameraY / Settings.BLOCK_WDITH;
            int bottomRow = (game.IntCameraY + Settings.SCREEN_HEIGHT) / Settings.BLOCK_WDITH;
            int leftCol = game.IntCameraX / Settings.BLOCK_WDITH;
            int rightCol = (game.IntCameraX + Settings.SCREEN_WIDTH) / Settings.BLOCK_WDITH;

            for (int row = topRow; row <= bottomRow; row++)
            {
                for (int col = leftCol; col <= rightCol; col++)
                {
                    int block = this[row, col];
                    if (block > 0)
                    {
                        int drawX = col * Settings.BLOCK_WDITH - game.IntCameraX;
                        int drawY = row * Settings.BLOCK_WDITH - game.IntCameraY;
                        int textureRow = block / 8;
                        int textureCol = block % 8;
                        if (block != 16)
                        {
                            graphics.DrawImage(GameImage.Block, Settings.BLOCK_WDITH, Settings.BLOCK_WDITH, textureRow, textureCol, drawX, drawY, r, g, b);
                        }
                        else
                        {
                            graphics.DrawImageAlpha(GameImage.Block, Settings.BLOCK_WDITH, Settings.BLOCK_WDITH, textureRow, textureCol, drawX, drawY, 128, r, g, b);
                        }
                    }
                }
            }
        }
开发者ID:sinshu,项目名称:chaos,代码行数:30,代码来源:Map.cs

示例15: Draw

        public void Draw(GraphicsDevice graphics)
        {
            game.Draw(graphics);

            if (numTicks < 16)
            {
                graphics.FillScreen(0, 0, 0, 255 - numTicks * 16);
            }

            if (numTicks == 165)
            {
                graphics.FillScreen(255, 255, 255, 255);
            }

            if (numTicks > 180)
            {
                for (int i = 0; i < 3; i++)
                {
                    graphics.DrawImageAdd(GameImage.Message, 256, 32, i, 0, (Settings.SCREEN_WIDTH - 256) / 2, Settings.SCREEN_HEIGHT / 2 + 112 + 32 * i, (i <= 1 || !arcadeMode) ? 255 : 32);
                }
                graphics.DrawImage(GameImage.Hud, 32, 32, 0, 4, (Settings.SCREEN_WIDTH - 256) / 2 - 32 + 48, Settings.SCREEN_HEIGHT / 2 + 112 + currentSelectIndex * 32);
                graphics.DrawImage(GameImage.Hud, 32, 32, 0, 0, (Settings.SCREEN_WIDTH - 256) / 2 + 256 - 48, Settings.SCREEN_HEIGHT / 2 + 112 + currentSelectIndex * 32);
            }

            if (gotoGameCount > 0)
            {
                if (gotoGameCount < 16)
                {
                    graphics.FillScreen(255, 255, 255, 16 * gotoGameCount);
                }
                else
                {
                    graphics.FillScreen(255, 255, 255, 255);
                }
            }

            if (exitCount > 0)
            {
                if (exitCount < 16)
                {
                    graphics.FillScreen(0, 0, 0, 16 * exitCount);
                }
                else
                {
                    graphics.FillScreen(0, 0, 0, 255);
                }
            }
        }
开发者ID:sinshu,项目名称:chaos,代码行数:48,代码来源:TitleScene.cs


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