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


C# Surface.Blit方法代码示例

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


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

示例1: Init

 private void Init()
 {
     mBackgroundSurf = new SdlDotNet.Graphics.Surface(IO.IO.CreateOSPath("Skins\\" + Globals.ActiveSkin + "\\General\\TaskBar\\taskbarbutton.png"));
     if (mWindow.TaskBarText != "") {
         Gfx.Font font = Logic.Graphics.FontManager.LoadFont("tahoma", 12);
         Gfx.Surface textSurf = font.Render(mWindow.TaskBarText, Color.White);
         //textSurf = textSurf.CreateStretchedSurface(new Size(130, 12));
         mBackgroundSurf.Blit(textSurf, GetCenter(mBackgroundSurf, textSurf.Size), new Rectangle(0, 0, 125, 14));
         string stateString = "?";
         switch (mWindow.WindowState) {
             case Client.Logic.Windows.WindowManager.WindowState.Normal:
                 stateString = "^";
                 break;
             case Client.Logic.Windows.WindowManager.WindowState.Minimized:
                 stateString = "v";
                 break;
             case Client.Logic.Windows.WindowManager.WindowState.Maximized:
                 stateString = "[]";
                 break;
         }
         mBackgroundSurf.Blit(font.Render(stateString, Color.White), new Point(this.Width - font.SizeText(stateString).Width - 1, 0));
         font.Close();
     }
     base.Buffer.Blit(mBackgroundSurf, new Point(0, 0));
 }
开发者ID:ChaotixBluix,项目名称:PMU-Client,代码行数:25,代码来源:TaskBarButton.cs

示例2: DarknessOverlay

        public DarknessOverlay(int newRange)
        {
            disposed = false;
            range = newRange;
            buffer = new Surface(40 * Constants.TILE_WIDTH, 30 * Constants.TILE_HEIGHT);
            Surface holepart = new Surface(14 * Constants.TILE_WIDTH, 14 * Constants.TILE_HEIGHT);
            for (int x = 0; x < 14; x++) {
                for (int y = 0; y < 14; y++) {
                    holepart.Blit(GraphicsManager.Tiles[10][210 + x + 14 * y], new Point(x * Constants.TILE_WIDTH, y * Constants.TILE_HEIGHT));
                }
            }

            Surface hole = new Surface(28 * Constants.TILE_WIDTH, 28 * Constants.TILE_HEIGHT);
            hole.Blit(holepart, new Point(0,0));
            hole.Blit(holepart.CreateFlippedHorizontalSurface(), new Point(hole.Width / 2, -2));
            hole.Blit(holepart.CreateFlippedVerticalSurface(), new Point(0, hole.Height / 2));
            hole.Blit(holepart.CreateFlippedVerticalSurface().CreateFlippedHorizontalSurface(), new Point(hole.Width / 2, hole.Height / 2 - 2));
            hole = hole.CreateStretchedSurface(new Size((range) * Constants.TILE_WIDTH, (range) * Constants.TILE_HEIGHT));

            buffer.Blit(GraphicsManager.Tiles[10][45].CreateStretchedSurface(new Size(40 * Constants.TILE_WIDTH, 30 * Constants.TILE_HEIGHT)), new Point(0,0));
            buffer.Blit(hole, new Point(buffer.Width / 2 - hole.Width / 2, buffer.Height / 2 - hole.Height / 2));

            //buffer = hole;
            buffer.Transparent = true;

            buffer.AlphaBlending = true;
            buffer.Alpha = 180;
        }
开发者ID:blastboy,项目名称:Client,代码行数:28,代码来源:DarknessOverlay.cs

示例3: Render

        public override Surface Render()
        {
            Surface Buffer = new Surface(Width,Height);

            for (int i = 0; i < map.Rows; i++)
            {
                for (int j = 0; j < map.Columns; j++)
                {
                    String TexName = map.DefaultTileTexture;
                    Rectangle Clip = new Rectangle(new Point(j * TileWidth, i * TileHeight), new Size(Tile.TILE_WIDTH,Tile.TILE_HEIGHT));
                    Buffer.Blit(Textures[TexName], Clip);
                }
            }

            for(int i=0; i<map.Rows; i++)
            {
                for(int j=0; j<map.Columns; j++)
                {
                    String TexName = map.Tiles[i][j].Texture;
                    Rectangle Clip = new Rectangle(new Point(j * TileWidth, i * TileHeight), new Size(Tile.TILE_WIDTH, Tile.TILE_HEIGHT));
                    Buffer.Blit(Textures[TexName], Clip);
                }
            }

            Box Border = new Box(new Point(0, 0), new Size(Width - 1, Height - 1));

            Buffer.Draw(Border, Color.Black, true);

            return Buffer;
        }
开发者ID:jordsti,项目名称:towerdefenserpg,代码行数:30,代码来源:MapRenderer.cs

示例4: DrawGameObject

        /// <summary>
        /// 
        /// </summary>
        /// <param name="surface"></param>
        protected override void DrawGameObject(Surface surface)
        {
            int currentY = 0;

            Surface fontSurface = font.Render("Score: " + this._Score, Color.FromArgb(255, 255, 255));
            surface.Blit(fontSurface, new System.Drawing.Point(this.ScreenX, this.ScreenY + currentY));

            currentY += 20;
            fontSurface = font.Render("Blocks Destroyed: " + this._BlocksDestroyed, Color.FromArgb(255, 255, 255));
            surface.Blit(fontSurface, new System.Drawing.Point(this.ScreenX, this.ScreenY + currentY));

            currentY += 20;

            fontSurface = font.Render("Level: " + this._Level, Color.FromArgb(255, 255, 255));
            surface.Blit(fontSurface, new System.Drawing.Point(this.ScreenX, this.ScreenY + currentY));
        }
开发者ID:erin100280,项目名称:Zelda.NET,代码行数:20,代码来源:Scoreboard.cs

示例5: Initialize

        public static void Initialize()
        {
            activeAnimations = new List<Moves.IMoveAnimation>();
            srfcMoveTargetTile = new Surface(Constants.TILE_WIDTH, Constants.TILE_HEIGHT);
            srfcMoveTargetTile.Blit(GraphicsManager.Tiles[10][77], new Point(0, 0));
            srfcMoveTargetTile.Transparent = true;
            //srfcMoveTargetTile.Alpha = 150;
            //srfcMoveTargetTile.AlphaBlending = true;

            srfcMoveTargetTileHit = new Surface(Constants.TILE_WIDTH, Constants.TILE_HEIGHT);
            srfcMoveTargetTileHit.Blit(GraphicsManager.Tiles[10][91], new Point(0,0));
            srfcMoveTargetTileHit.Transparent = true;
            //srfcMoveTargetTileHit.Alpha = 150;
            //srfcMoveTargetTileHit.AlphaBlending = true;

            srfcMoveTargetTileDark = new Surface(Constants.TILE_WIDTH, Constants.TILE_HEIGHT);
            srfcMoveTargetTileDark.Blit(GraphicsManager.Tiles[10][105], new Point(0, 0));
            srfcMoveTargetTileDark.Transparent = true;

            srfcMoveTargetUnknown = new Surface(Constants.TILE_WIDTH * 3, Constants.TILE_HEIGHT * 3);
            for (int i = 0; i < 9; i++)
            {
                srfcMoveTargetUnknown.Blit(GraphicsManager.Tiles[10][8 + i % 3 + i / 3 * 14], new Point(i % 3 * Constants.TILE_WIDTH, i / 3 * Constants.TILE_HEIGHT));
            }
            srfcMoveTargetUnknown.Transparent = true;
            srfcMoveTargetUnknown.Alpha = 150;
            srfcMoveTargetUnknown.AlphaBlending = true;
        }
开发者ID:ChaotixBluix,项目名称:PMU-Client,代码行数:28,代码来源:MoveRenderer.cs

示例6: CreateSurface

		protected override Surface CreateSurface ()
		{
			if (calc_width) {
				Surface textSurf = GuiUtil.ComposeText (Text, Font, Palette, -1, -1,
									Sensitive ? 4 : 24);
				Width = (ushort)textSurf.Width;
				Height = (ushort)textSurf.Height;

				return textSurf;
			}
			else {
				/* this is wrong */
				Surface surf = new Surface (Width, Height);

				Surface textSurf = GuiUtil.ComposeText (Text, Font, Palette, Width, Height,
									Sensitive ? 4 : 24);

				int x = 0;
				if (Type == ElementType.LabelRightAlign)
					x += Width - textSurf.Width;
				else if (Type == ElementType.LabelCenterAlign)
					x += (Width - textSurf.Width) / 2;

				surf.Blit (textSurf, new Point (x, 0));

				surf.TransparentColor = Color.Black /* XXX */;
				return surf;
			}
		}
开发者ID:carriercomm,项目名称:scsharp,代码行数:29,代码来源:LabelElement.cs

示例7: Draw

        public override void Draw(Surface dest, Rectangle Camera)
        {
            Camera.X = m_rect.X - Camera.X;
            Camera.Y = m_rect.Y - Camera.Y;
            Camera.Width = m_rect.Width;
            Camera.Height = m_rect.Height;

            dest.Blit(m_tileset, Camera);
        }
开发者ID:kfdm,项目名称:murasaki,代码行数:9,代码来源:CActorBullet.cs

示例8: Render

        public virtual void Render(Surface s, Point p)
        {
            s.Blit(_graphic, new Point(p.X - (int)(_width / 2.0), p.Y - (int)(_height / 2.0)));

            foreach (Point offset in _collisionPoints)
            {
                s.Fill(new Rectangle(p.X - offset.X, p.Y - offset.Y, 1, 1), Color.Red);
            }
        }
开发者ID:davinx,项目名称:PitchPitch,代码行数:9,代码来源:GameObj.cs

示例9: Achtergrond

        public Achtergrond(Surface vid)
        {
            mVideo = vid;
            mAfbeelding = new Surface("background.jpg");
            mVideo.Blit(mAfbeelding);

            //Events.Tick += new EventHandler<TickEventArgs>(Events_Tick);
            Events.KeyboardDown += new EventHandler<SdlDotNet.Input.KeyboardEventArgs>(Events_KeyboardDown);
            Events.KeyboardUp += new EventHandler<SdlDotNet.Input.KeyboardEventArgs>(Events_KeyboardUp);
        }
开发者ID:tompeetersartesis,项目名称:DesignPatternsCSharp,代码行数:10,代码来源:Achtergrond.cs

示例10: ScoreCard

        public ScoreCard(Player player, Point displayPosition)
        {
            this.player = player;

            this.displayPosition = displayPosition;

            this.kills = 0;
            this.defeats = 0;
            this.suicides = 0;

            this.font = new Font(Configuration.InfoBar.PlayerStatusDisplayFontFilename, Configuration.InfoBar.PlayerStatusDisplayFontSize);

            Surface scoreCardSurface = new Surface(Configuration.InfoBar.PlayerStatusDisplayImageFilename);

            Point position = new Point(Configuration.InfoBar.XBuffer, Configuration.InfoBar.YBuffer);

            // Show the ship's picture.
            scoreCardSurface.Blit(this.player.Ship.ShipPhotoSurface, position);

            position.X += this.player.Ship.ShipPhotoSurface.Width + Configuration.InfoBar.XBuffer;

            using (Surface text = font.Render(string.Format("Player {0}", player.Number), Configuration.Ships.Shields.InfoDisplayPlayerFontColor))
            {
                text.Transparent = true;
                scoreCardSurface.Blit(text, position);
            }

            int xPosition = position.X + Configuration.InfoBar.FirstColumn_PixelsToIndent;

            this.shieldsText = font.Render("Shields:", Configuration.Ships.Shields.InfoDisplayStrongColor, true);
            this.shieldsText.Transparent = true;
            scoreCardSurface.Blit(shieldsText, new Point(xPosition, position.Y + this.font.LineSize + 1));

            this.bulletsText = font.Render("Bullets:", Configuration.Ships.Cannon.InfoDisplayStrongBulletCountColor, true);
            this.bulletsText.Transparent = true;
            scoreCardSurface.Blit(bulletsText, new Point(xPosition, position.Y + this.font.LineSize * 2 + 1));

            xPosition = position.X + Configuration.InfoBar.SecondColumn_PixelsToIndent;

            this.killsText = font.Render("Kills:", Configuration.InfoBar.CounterTextColor, true);
            this.killsText.Transparent = true;
            scoreCardSurface.Blit(killsText, new Point(xPosition, position.Y));

            this.defeatsText = font.Render("Defeats:", Configuration.InfoBar.CounterTextColor, true);
            this.defeatsText.Transparent = true;
            scoreCardSurface.Blit(defeatsText, new Point(xPosition, position.Y + this.font.LineSize + 1));

            this.suicidesText = font.Render("Suicides:", Configuration.InfoBar.CounterTextColor, true);
            this.suicidesText.Transparent = true;
            scoreCardSurface.Blit(suicidesText, new Point(xPosition, position.Y + this.font.LineSize * 2 + 1));

            this.scoreCard = scoreCardSurface.Convert(Video.Screen, true, false);
        }
开发者ID:jiweaver,项目名称:orbitclash,代码行数:53,代码来源:ScoreCard.cs

示例11: DuskOverlay

 public DuskOverlay()
 {
     disposed = false;
     buffer = new Surface(20 * Constants.TILE_WIDTH, 15 * Constants.TILE_HEIGHT);
     for (int x = 0; x < 20; x++) {
         for (int y = 0; y < 15; y++) {
             buffer.Blit(GraphicsManager.Tiles[10][63], new Point(x * Constants.TILE_WIDTH, y * Constants.TILE_HEIGHT));
         }
     }
     buffer.AlphaBlending = true;
     buffer.Alpha = 60;
 }
开发者ID:blastboy,项目名称:Client,代码行数:12,代码来源:DuskOverlay.cs

示例12: DrawNormalLayer

 private void DrawNormalLayer(Surface surface, int layerIndex, ScreenSection section)
 {
     // Draw each line from left to right.
     var layer = Map.Layers[layerIndex];
     for (var y = section.TileTop; y < section.TileTop + section.TileHeight; y++) {
         for (var x = section.TileLeft; x < section.TileLeft + section.TileWidth; x++) {
             var tileIndex = layer.GetTileIndex(x, y);
             var tile = Map.GetSurfaceForTileId(tileIndex);
             var position = section.GetTilePosition(x, y);
             surface.Blit(tile, position);
         }
     }
 }
开发者ID:jonasoberschweiber,项目名称:opiso,代码行数:13,代码来源:MapDrawer.cs

示例13: FillBackground

        public Surface FillBackground()
        {
            Surface Buffer = new Surface(Width, Height);

            for (int i = 0; i < map.Rows; i++)
            {
                for (int j = 0; j < map.Columns; j++)
                {
                    Buffer.Blit(Textures[map.DefaultTileTexture], new Point(j * TileWidth, i * TileHeight));
                }
            }
            return Buffer;
        }
开发者ID:jordsti,项目名称:towerdefenserpg,代码行数:13,代码来源:MapEditRenderer.cs

示例14: Cloudy

        public Cloudy()
        {
            disposed = false;
            buffer = new Surface(20 * Constants.TILE_WIDTH, 15 * Constants.TILE_HEIGHT);
            for (int x = 0; x < 20; x++) {
                for (int y = 0; y < 15; y++) {

                    buffer.Blit(GraphicsManager.Tiles[10][59 + (x % 2) + 2 * (y % 2)], new Point(x * Constants.TILE_WIDTH, y * Constants.TILE_HEIGHT));
                }
            }
            buffer.AlphaBlending = true;
            buffer.Alpha = 50;
        }
开发者ID:blastboy,项目名称:Client,代码行数:13,代码来源:Cloudy.cs

示例15: CreateSurface

		protected override Surface CreateSurface ()
		{
			Surface surf = new Surface (Width, Height);

			surf.TransparentColor = Color.Black; /* XXX */

			text_surf = null;
			CalculateTextPosition ();

			surf.Blit (text_surf, new Point (text_x, text_y));

			return surf;
		}
开发者ID:carriercomm,项目名称:scsharp,代码行数:13,代码来源:ButtonElement.cs


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