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


C# Surface.CreateCompatibleSurface方法代码示例

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


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

示例1: SectorSprite

 /// <summary>
 /// 
 /// </summary>
 /// <param name="screen"></param>
 /// <param name="sector"></param>
 public SectorSprite(Surface screen, Sector sector)
     : base()
 {
     if (screen == null)
     {
         throw new ArgumentNullException("screen");
     }
     this.sector = sector;
     base.Surface = screen.CreateCompatibleSurface(128, 128);
     base.Surface.Fill(Color.FromArgb(0, 255, 128));
 }
开发者ID:erin100280,项目名称:Zelda.NET,代码行数:16,代码来源:SectorSprite.cs

示例2: EntitySprite

 /// <summary>
 /// constructor
 /// </summary>
 public EntitySprite(Surface screen)
     : base()
 {
     if (screen == null)
     {
         throw new ArgumentNullException("screen");
     }
     base.Surface = screen.CreateCompatibleSurface(70, 70);
     base.Surface.Fill(Color.FromArgb(0, 255, 128));
     base.Surface.Draw(new Circle(32, 32, 32), Color.FromArgb(255, 0, 0), false, true);
     base.Rectangle = new Rectangle(0, 0, 70, 70);
 }
开发者ID:erin100280,项目名称:Zelda.NET,代码行数:15,代码来源:EntitySprite.cs

示例3: Run

        public static void Run()
        {
            if (File.Exists(Path.Combine(dataDirectory, "Background1.png")))
            {
                filePath = "";
            }
            Video.WindowIcon();
            Video.WindowCaption =
                "SDL.NET - Bomb Run";
            screen = Video.SetVideoMode(640, 480);
            tempSurface = new Surface(Path.Combine(filePath, Path.Combine(dataDirectory, "Background1.png")));
            background = tempSurface.Convert();
            tempSurface = new Surface(Path.Combine(filePath, Path.Combine(dataDirectory, "Background2.png")));
            alternateBackground = tempSurface.Convert();

            temporary = screen.CreateCompatibleSurface(32, 32);
            temporary.TransparentColor = Color.FromArgb(0, 255, 0, 255);
            temporary.Transparent = true;

            player = new Player(new Surface(Path.Combine(filePath, Path.Combine(dataDirectory, "Head.bmp"))), new Point(screen.Width / 2 - 16,
                screen.Height - 32));
            players.Add(player);
            players.EnableKeyboardEvent();
            bullets.EnableTickEvent();
            master.EnableTickEvent();

            for (int i = 0; i < 25; i++)
            {
                bombs.Add(new Bomb(new Surface(Path.Combine(filePath, Path.Combine(dataDirectory, "Bomb.bmp")))));
            }
            foreach (Sprite bomb in bombs)
            {
                master.Add(bomb);
            }
            foreach (Sprite playerSprite in players)
            {
                master.Add(playerSprite);
            }

            Mouse.ShowCursor = false;
            Events.KeyboardDown +=
                new EventHandler<KeyboardEventArgs>(Keyboard);
            Events.Quit += new EventHandler<QuitEventArgs>(Quit);
            player.WeaponFired += new EventHandler<FireEventArgs>(PlayerWeaponFired);

            Events.Tick += new EventHandler<TickEventArgs>(OnTick);
            Events.Run();
        }
开发者ID:erin100280,项目名称:Zelda.NET,代码行数:48,代码来源:BombRun.cs

示例4: Go

        /// <summary>
        /// 
        /// </summary>
        public void Go()
        {
            string filePath = Path.Combine("..", "..");
            string fileDirectory = "Data";
            string fileName = "cursor.png";
            if (File.Exists(fileName))
            {
                filePath = "";
                fileDirectory = "";
            }
            else if (File.Exists(Path.Combine(fileDirectory, fileName)))
            {
                filePath = "";
            }

            string file = Path.Combine(Path.Combine(filePath, fileDirectory), fileName);

            Events.Tick += new EventHandler<TickEventArgs>(Tick);
            Events.KeyboardDown +=
                new EventHandler<KeyboardEventArgs>(this.KeyboardDown);
            Events.Quit += new EventHandler<QuitEventArgs>(this.Quit);
            Events.JoystickAxisMotion +=
                             new EventHandler<JoystickAxisEventArgs>(this.JoystickAxisChanged);
            Events.JoystickButtonDown += new EventHandler<JoystickButtonEventArgs>(this.JoystickButtonDown);
            joystick = Joysticks.OpenJoystick(0);

            try
            {
                Video.WindowIcon();
                Video.WindowCaption = "SdlDotNet - Joystick Example";
                screen = Video.SetVideoMode(width, height, true);
                Mouse.ShowCursor = false; // hide the cursor

                Surface surf =
                    screen.CreateCompatibleSurface(width, height, true);
                surf.Fill(new Rectangle(new Point(0, 0),
                    surf.Size), System.Drawing.Color.Black);

                cursor = new Surface(file);

                Events.Run();
            }
            catch
            {
                throw;
            }
        }
开发者ID:erin100280,项目名称:Zelda.NET,代码行数:50,代码来源:JoystickExample.cs

示例5: Go

        /// <summary>
        /// 
        /// </summary>
        public void Go()
        {
            if (File.Exists(fileName))
            {
                filePath = "";
                fileDirectory = "";
            }
            else if (File.Exists(Path.Combine(fileDirectory, fileName)))
            {
                filePath = "";
            }

            string file = Path.Combine(Path.Combine(filePath, fileDirectory), fileName);

            Events.Tick +=
                new EventHandler<TickEventArgs>(Events_TickEvent);
            Events.KeyboardDown +=
                new EventHandler<KeyboardEventArgs>(this.KeyboardDown);
            Events.Quit += new EventHandler<QuitEventArgs>(this.Quit);

            font = new SdlDotNet.Graphics.Font(file, size);
            Video.WindowIcon();
            Video.WindowCaption = "SDL.NET - Font Example";
            screen = Video.SetVideoMode(width, height, true);

            Surface surf = screen.CreateCompatibleSurface(width, height, true);
            surf.Fill(new Rectangle(new Point(0, 0), surf.Size), Color.Black);
            Events.Run();
        }
开发者ID:erin100280,项目名称:Zelda.NET,代码行数:32,代码来源:FontExample.cs

示例6: Go

        /// <summary>
        /// 
        /// </summary>
        public void Go()
        {
            Events.KeyboardDown +=
                new EventHandler<KeyboardEventArgs>(this.KeyboardDown);
            Events.Tick += new EventHandler<TickEventArgs>(this.Tick);
            Events.Quit += new EventHandler<QuitEventArgs>(this.Quit);

            Video.WindowIcon();
            Video.WindowCaption = "SDL.NET - Primitives Example";
            Mouse.ShowCursor = false;
            screen = Video.SetVideoMode(width, height, true);
            surf =
                screen.CreateCompatibleSurface(width, height, true);
            //fill the surface with black
            surf.Fill(new Rectangle(new Point(0, 0), surf.Size), Color.Black);
            Events.Run();
        }
开发者ID:erin100280,项目名称:Zelda.NET,代码行数:20,代码来源:PrimitivesExample.cs

示例7: Go

        /// <summary>
        /// 
        /// </summary>
        public void Go()
        {
            if (File.Exists(fileName))
            {
                filePath = "";
                fileDirectory = "";
            }
            else if (File.Exists(Path.Combine(fileDirectory, fileName)))
            {
                filePath = "";
            }

            int width = 800;
            int height = 600;

            Video.WindowIcon();
            Video.WindowCaption = "SDL.NET - Triad";
            Events.KeyboardDown +=
                new EventHandler<KeyboardEventArgs>(this.KeyboardDown);
            Events.KeyboardUp +=
                new EventHandler<KeyboardEventArgs>(this.KeyboardUp);
            Events.Tick += new EventHandler<TickEventArgs>(this.Tick);
            Events.Quit += new EventHandler<QuitEventArgs>(this.Quit);

            board = new Scoreboard();
            board.X = 600;
            board.Y = 0;
            board.Size = new Size(200, 400);
            screen =
                    Video.SetVideoMode(width, height);
            surf =
                screen.CreateCompatibleSurface(width, height);
            surf.Fill(
                new Rectangle(new Point(0, 0), surf.Size), Color.Black);


            grid = new BlockGrid(new Point(20, 20), new Size(11, 13));
            grid.BlocksDestroyed +=
                new EventHandler<BlocksDestroyedEventArgs>(grid_BlocksDestroyed);
            levelUpSound = Mixer.Sound(Path.Combine(Path.Combine(filePath, fileDirectory), "levelup.wav"));
            Events.Run();
        }
开发者ID:erin100280,项目名称:Zelda.NET,代码行数:45,代码来源:TriadMain.cs


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