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


C# Surface.Fill方法代码示例

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


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

示例1: CreateSurface

        protected override Surface CreateSurface()
        {
            if (ParentScreen.Background == null && ParentScreen.UseTiles) {
                Surface surf = new Surface (Width, Height);
                surf.Fill (new Rectangle (new Point (0,0), new Size (Width, Height)),
                       Color.FromArgb (0,0,0,0));
                surf.TransparentColor = Color.Black; /* XXX */

                Pcx pal = new Pcx ();
                pal.ReadFromStream ((Stream)Mpq.GetResource ("unit\\cmdbtns\\ticon.pcx"),
                            -1, -1);

                /* tile the top border */
                TileRow (surf, tileGrp, pal.Palette, TILE_TL, TILE_T, TILE_TR, 0);

                /* tile everything down to the bottom border */
                for (int y = tileGrp.Height - 2; y < surf.Height - tileGrp.Height; y += tileGrp.Height - 2)
                    TileRow (surf, tileGrp, pal.Palette, TILE_L, TILE_C, TILE_R, y);

                /* tile the bottom row */
                TileRow (surf, tileGrp, pal.Palette, TILE_BL, TILE_B, TILE_BR, surf.Height - tileGrp.Height);
                return surf;
            }
            else
                return null;
        }
开发者ID:directhex,项目名称:scsharp,代码行数:26,代码来源:DialogBoxElement.cs

示例2: Main

	public static void Main (string[] args)
	{
		MpqContainer mpq = new MpqContainer ();
		mpq.Add (new MpqArchive ("/home/toshok/src/starcraft/sc-cd/install.exe"));
		mpq.Add (new MpqArchive ("/home/toshok/src/starcraft/starcraft/StarDat.mpq"));

		Fnt fnt = (Fnt)mpq.GetResource ("files\\font\\font16.fnt");
		Console.WriteLine ("loading font palette");
		Stream palStream = (Stream)mpq.GetResource ("glue\\Palmm\\tFont.pcx");
		Pcx pcx1 = new Pcx ();
		pcx1.ReadFromStream (palStream, -1, -1);

		Painter.InitializePainter (false, 300);

		Surface textSurf1 = GuiUtil.ComposeText (str1, fnt, pcx1.Palette);
		Surface textSurf2 = GuiUtil.ComposeText (str2, fnt, pcx1.Palette);
		Surface textSurf3 = GuiUtil.ComposeText (str3, fnt, pcx1.Palette);
		Surface textSurf4 = GuiUtil.ComposeText (str4, fnt, pcx1.Palette);

		Surface backgroundSurface = new Surface (Painter.SCREEN_RES_X, Painter.SCREEN_RES_Y);
		backgroundSurface.Fill (new Rectangle (new Point (0, 0), backgroundSurface.Size), Color.Red);

		Painter.Add (Layer.UI,
			     delegate (DateTime now) {
				int y = 0;
				Painter.Blit (textSurf1, new Point (0, y)); y += textSurf1.Height;
				Painter.Blit (textSurf2, new Point (0, y)); y += textSurf2.Height;
				Painter.Blit (textSurf3, new Point (0, y)); y += textSurf3.Height;
				Painter.Blit (textSurf4, new Point (0, y)); y += textSurf4.Height;
			     });

		Painter.Add (Layer.Background,
			     delegate (DateTime now) {
				     Painter.Blit (backgroundSurface);
			     });

		Events.KeyboardUp += delegate (object o, KeyboardEventArgs keyargs) {
			if (keyargs.Key == Key.Escape)
				Events.QuitApplication();
		};

		Events.Run ();
	}
开发者ID:carriercomm,项目名称:scsharp,代码行数:43,代码来源:font-foo.cs


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