當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。