• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Graphics.Surface类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



Surface类属于SdlDotNet.Graphics命名空间,在下文中一共展示了Surface类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: SceneGameOver

        public SceneGameOver()
        {
            sceneType = SceneType.GameOver;

            _menuItems = new MenuItem[]
            {
                new MenuItem(Key.R, Properties.Resources.MenuItem_RetryStage),
                new MenuItem(Key.M, Properties.Resources.MenuItem_MapSelect),
                new MenuItem(Key.T, Properties.Resources.MenuItem_ReturnTitle)
            };

            _keys = new Key[]
            {
                Key.UpArrow, Key.DownArrow, Key.Return, Key.Escape,
                Key.M, Key.R, Key.T
            };

            _cursor = ResourceManager.GetColoredCursorGraphic(_foreColor);

            _overImgSurface = ResourceManager.LoadSurface(Constants.Filename_GameoverImage);
            ImageUtil.SetColor(_overImgSurface, _foreColor);

            _menuSurfaces = new SurfaceCollection();
            _menuRects = new Rectangle[_menuItems.Length];
            ImageUtil.CreateStrMenu(_menuItems, _foreColor, ref _menuSurfaces, ref _menuRects, Constants.ScreenWidth);
        }
开发者ID:davinx,项目名称:PitchPitch,代码行数:26,代码来源:SceneGameOver.cs


示例2: VictoryArea

        /// <summary>
        /// Initializes a new instance of the VictoryArea class.
        /// </summary>
        /// <param name="area">Area of victory zone</param>
        public VictoryArea(Rectangle area, Context context)
            : base(area)
        {
            this.UpperLeft = new Point(area.Left, area.Top);
            this.Area = area;

            Surface toFill = new Surface(new Size(32, 32));
            int x = 0;
            int y = 0;

            // Get left upper corner
            TileManager.FromTilemap(toFill, "003-G_Ground01.png", 0 * toFill.Width, 1 * toFill.Height);
            this.Blit(toFill);

            // Upper separation of victory zone
            TileManager.FromTilemap(toFill, "003-G_Ground01.png", 1 * toFill.Width, 1 * toFill.Height);
            x += toFill.Width;
            while (x < this.Width)
            {
                this.Blit(toFill, new Point(x, 0));
                x += toFill.Width;
            }

            // Left separation of victory zone
            TileManager.FromTilemap(toFill, "003-G_Ground01.png", 0 * toFill.Width, 2 * toFill.Height);
            y += toFill.Height;
            while (y < this.Height)
            {
                this.Blit(toFill, new Point(0, y));
                y += toFill.Height;
            }

            // Center of the victory zone
            TileManager.FromTilemap(toFill, "003-G_Ground01.png", 2 * toFill.Width, 2 * toFill.Height);
            x = toFill.Width;
            y = toFill.Height;
            while (x < this.Width)
            {
                while (y < this.Height)
                {
                    this.Blit(toFill, new Point(x, y));
                    y += toFill.Height;
                }

                x += toFill.Width;
            }

            // Get left lower corner
            TileManager.FromTilemap(toFill, "003-G_Ground01.png", 0 * toFill.Width, 3 * toFill.Height);
            this.Blit(toFill, new Point(0, this.Height - toFill.Height));

            // Lower separation of victory zone
            TileManager.FromTilemap(toFill, "003-G_Ground01.png", 1 * toFill.Width, 3 * toFill.Height);
            x += toFill.Width;
            while (x < this.Width)
            {
                this.Blit(toFill, new Point(x, this.Height - toFill.Height));
                x += toFill.Width;
            }
        }
开发者ID:franckleveque,项目名称:FilsDeBerger,代码行数:64,代码来源:VictoryArea.cs


示例3: release

 private void release()
 {
     if (_prevSurface != null) _prevSurface.Dispose();
     if (_errorMessageSurface != null) foreach (Surface s in _errorMessageSurface) s.Dispose();
     _prevSurface = null;
     _errorMessageSurface = null;
 }
开发者ID:davinx,项目名称:PitchPitch,代码行数:7,代码来源:SceneError.cs


示例4: 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


示例5: MapDrawer

        public MapDrawer(Surface Screen)
        {
            MapX = 100;
            MapY = 100;

            WindowsScreen = Screen;
        }
开发者ID:TerenceWallace,项目名称:bloodbox,代码行数:7,代码来源:MapDrawer.cs


示例6: Main

        public static void Main(string[] args)
        {
            Events.Quit += new EventHandler<QuitEventArgs>(ApplicationQuitEventHandler);

            Surface plate = Video.SetVideoMode(220, 220, 32, false, false, false, true);
            Surface pic = new Surface("nyanbig.png");
            pic.Update();

            Population fellows = new Population(15, 100);
            List<float> fitnesses;

            while (fellows.members[0].fitness < 700f)
            {
                fitnesses = new List<float>();
                foreach (Genome g in fellows.members)
                {
                    g.Draw(plate);
                    Console.Read();
                    float f = g.GetFitness(plate, pic);
                    fitnesses.Add(f);
                    g.fitness = f;
                }

                fellows.members.Sort();
                fellows.members[0].Draw(plate);
                Console.WriteLine(fellows.members[0].fitness);
                int x = 0;
            }
        }
开发者ID:tgy,项目名称:CSharp,代码行数:29,代码来源:Program.cs


示例7: Sprite

        public Sprite(Surface surface2)
        {
            this.surface = surface2;
            texture = new SurfaceGl(surface, true);
            texture.WrapS = WrapOption.Clamp;
            texture.WrapT = WrapOption.Clamp;
            //texture.MagFilter = MagnificationOption.GL_LINEAR;
            //texture.MinFilter = MinifyingOption.GL_LINEAR_MIPMAP_LINEAR;
            int blank = surface.TransparentColor.ToArgb();
            bool[,] bitmap = new bool[surface.Width, surface.Height];
            Color[,] pixels = surface.GetColors(new System.Drawing.Rectangle(0, 0, surface.Width, surface.Height));

            for (int x = 0; x < bitmap.GetLength(0); ++x)
            {
                for (int y = 0; y < bitmap.GetLength(1); ++y)
                {
                    bitmap[x, y] = !(pixels[x, y].A == 0 || pixels[x, y].ToArgb() == blank);
                }
            }
            vertexes = VertexHelper.CreateRangeFromBitmap(bitmap);
            Console.WriteLine("Before {0}", GetCount);
            vertexes = VertexHelper.ReduceRange(vertexes, 1);
            vertexes = VertexHelper.ReduceRange(vertexes, 2);
            vertexes = VertexHelper.ReduceRange(vertexes, 3);
            Console.WriteLine("After {0}", GetCount);
            vertexes = VertexHelper.SubdivideRange(vertexes, 10);
            Console.WriteLine("Subdivide {0}", GetCount);
            offset = VertexHelper.GetCentroidOfRange(vertexes);
            vertexes = VertexHelper.CenterVertexesRange(vertexes);
        }
开发者ID:bsvercl,项目名称:physics2d,代码行数:30,代码来源:OpenGlObject.cs


示例8: ZX

        private string View; // View = XY, ZY or ZX (Front,Left or Top)

        #endregion Fields

        #region Constructors

        public View2D(SdlDotNet.Windows.SurfaceControl Control, string View, object _blocks, object _items, int _gridsize, object _layers)
        {
            this.View = View;
            this.Control = Control;
            this.layerStatus = (bool[])_layers;

            this.Surf = new Surface(this.Control.Width, this.Control.Height);

            this.GridSurf = new Surface(this.Control.Width, this.Control.Height);
            this.BlockSurf = new Surface(this.Control.Width, this.Control.Height);
            this.TempSurf = new Surface(this.Control.Width, this.Control.Height);

            this.GridSize = _gridsize;

            this.blocks = _blocks;
            this.items = _items;

            SdlDotNet.Core.Events.Tick +=  new EventHandler<TickEventArgs>(OnTick);

            this.levelSize = 256;

            this.scrollLocalX = this.levelSize*this.GridSize/2;
            this.scrollLocalY = this.levelSize*this.GridSize/ 2;

            this.UpdateGrid();
            this.UpdateBlocks();
            this.UpdateTemp();
        }
开发者ID:dankar,项目名称:zombies,代码行数:34,代码来源:2DView.cs


示例9: Enemy

        public Enemy(int x, int y,bool moveright, bool moveleft)
        {
            try
            {
                Image = new Surface("Enemy_CommanderKeen_rechts.png");
                ImageLeft = new Surface("Enemy_CommanderKeen_links.png");
                ImageRight = new Surface("Enemy_CommanderKeen_rechts.png");
            }
            catch (Exception error)
            {
                Console.WriteLine(error);
            }

            Position = new Point(x, y);
            ShowPartImage = new Rectangle(0, 0,55,71 );
            BeginPositie = Position.X;
            Collisionrectangle = new Rectangle(Position.X, Position.Y, 55, 71);
            Leftcollisionrectangle = new Rectangle(Position.X, Position.Y, 3, 71);
            Rightcollisionrectangle = new Rectangle((Position.X + 55), Position.Y, 3, 71);
            Uppercollisionrectangle = new Rectangle(Position.X, Position.Y, 55, 3);
            Lowercollisionrectangle = new Rectangle(Position.X, (Position.Y + 71), 55, 3);

            MoveLeft = moveleft;
            MoveRight = moveright;
        }
开发者ID:LorenzPut,项目名称:Project-ICT-3,代码行数:25,代码来源:Enemy.cs


示例10: Texture

        public Texture(Surface surface)
        {
            this.surface = surface;

            //this.surface.AlphaBlending = true;
            //this.Alpha = 255;
        }
开发者ID:pzaps,项目名称:CrossGFX,代码行数:7,代码来源:Texture.cs


示例11: Draw

 public override void Draw(Surface s, uint chip, Rectangle r, ChipResizeMethod m)
 {
     if (chip != 0)
     {
         s.Fill(r, _foreColor);
     }
 }
开发者ID:davinx,项目名称:PitchPitch,代码行数:7,代码来源:BinaryChipData.cs


示例12: Dialogs

        public Dialogs(Game game)
        {
            this.game = game;
            PropertyReader props = game.loader.GetPropertyReader().Select("dialog/dialog.xml");
            Border = props.GetInt("border");
            string fontName = props.GetString("font");
            int fontSize = props.GetInt("fontsize");
            Font = new SdlDotNet.Graphics.Font(game.loader.LoadRaw("dialog/" + fontName), fontSize);
            bgColor = Color.FromArgb(
                props.GetInt("background/alpha"),
                props.GetInt("background/red"),
                props.GetInt("background/green"),
                props.GetInt("background/blue"));
            selectedBorder = Color.FromArgb(
                props.GetInt("selectedborder/alpha"),
                props.GetInt("selectedborder/red"),
                props.GetInt("selectedborder/green"),
                props.GetInt("selectedborder/blue"));
            selectedBg = Color.FromArgb(
                props.GetInt("selectedbackground/alpha"),
                props.GetInt("selectedbackground/red"),
                props.GetInt("selectedbackground/green"),
                props.GetInt("selectedbackground/blue"));

            TextHeight = Font.SizeText(" ").Height;

            surface = new Surface(game.loader.LoadBitmap("dialog/windowborder.png"));
        }
开发者ID:hgabor,项目名称:kfirpgcreator,代码行数:28,代码来源:Dialogs.cs


示例13: 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


示例14: UpdateSurfaces

        public void UpdateSurfaces()
        {
            mButtonUpBounds = new Rectangle(0, 0, this.Width, 25);
            mScrollBackgroundBounds = new Rectangle(0, mButtonUpBounds.Height, this.Width, this.Height - (mButtonUpBounds.Height * 2));
            mButtonDownBounds = new Rectangle(0, mButtonUpBounds.Height + mScrollBackgroundBounds.Height, this.Width, mButtonUpBounds.Height);
            mScrollBarBounds = new Rectangle(0, mButtonUpBounds.Height, this.Width, (this.mMaximum / this.mValue) * 25);

            mBackground = new SdlDotNet.Graphics.Surface(this.Size);

            mButtonSurface = new SdlDotNet.Graphics.Surface(mButtonUpBounds.Size);
            mScrollbarBackgroundSurface = new SdlDotNet.Graphics.Surface(mScrollBackgroundBounds.Size);
            mScrollbarSurface = new SdlDotNet.Graphics.Surface(mScrollBarBounds.Size);
            mScrollbarSurface.Fill(Color.Transparent);
            //mScrollbarSurface.Transparent = true;

            mButtonSurface.Fill(mForecolor);
            Gfx.Primitives.Box border = new SdlDotNet.Graphics.Primitives.Box(new Point(0, 0), new Size(mScrollBackgroundBounds.Width - 2, mScrollBackgroundBounds.Height - 1));
            mScrollbarBackgroundSurface.Draw(border, Color.Blue);

            Gfx.Primitives.Box border2 = new SdlDotNet.Graphics.Primitives.Box(new Point(0, 0), new Size(mScrollbarSurface.Width - 2, mScrollbarSurface.Height - 2));
            mScrollbarSurface.Draw(border, Color.Red);

            mBackground.Blit(mButtonSurface);
            mBackground.Blit(mScrollbarBackgroundSurface, new Point(0, mButtonSurface.Height));
            mBackground.Blit(mScrollbarSurface, new Point(0, mButtonSurface.Height));
            mBackground.Blit(mButtonSurface, new Point(0, mButtonSurface.Height + mScrollbarBackgroundSurface.Height));
        }
开发者ID:ChaotixBluix,项目名称:PMU-Client,代码行数:27,代码来源:Scrollbar.cs


示例15: 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


示例16: Bomb

 /// <summary>
 /// 
 /// </summary>
 public Bomb(Surface bombSurface)
     : base(bombSurface)
 {
     base.Surface.TransparentColor = Color.White;
     base.Surface.Transparent = true;
     Reset();
 }
开发者ID:erin100280,项目名称:Zelda.NET,代码行数:10,代码来源:Bomb.cs


示例17: 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


示例18: TileGraphic

 public TileGraphic(int tileSet, int tileNum, Surface tile, int sizeInBytes)
 {
     this.tileSet = tileSet;
     this.tileNum = tileNum;
     this.tile = tile;
     this.sizeInBytes = sizeInBytes;
 }
开发者ID:ChaotixBluix,项目名称:PMU-Client,代码行数:7,代码来源:TileGraphic.cs


示例19: Hero

        public Hero()
        {
            try
            {
                Image = new Surface("Commander_Keen_links.png");
                ImageLeft = new Surface("Commander_Keen_links.png");
                ImageRight = new Surface("Commander_Keen_rechts.png");
            }
            catch (Exception error)
            {
                Console.WriteLine(error);

            }

            Position = new Point(300, ground);
            ShowPartImage = new Rectangle(0, 0,50,75 );
            Collisionrectangle = new Rectangle(Position.X, Position.Y, 45, 70);
            Leftcollisionrectangle = new Rectangle(Position.X, (Position.Y+10), 3, 60);
            Rightcollisionrectangle = new Rectangle((Position.X + 45), (Position.Y+10), 3, 60);
            Uppercollisionrectangle = new Rectangle((Position.X+5), Position.Y, 45, 3);
            Lowercollisionrectangle = new Rectangle((Position.X+5), (Position.Y + 75), 45, 15);

            Events.KeyboardDown += Events_KeyboardDown;
            Events.KeyboardUp += Events_KeyboardUp;
        }
开发者ID:LorenzPut,项目名称:Project-ICT-3,代码行数:25,代码来源:Hero.cs


示例20: keuzes

        private Surface[] VerschillendeLevels = new Surface[5]; // //Verschillende keuzes(2de startscherm)

        #endregion Fields

        #region Constructors

        public Manager()
        {
            play = new Audio(); //aanmaken audio
            audioThread = new Thread(new ThreadStart(play.PlayAudio));//starten tread
            laadTextarrays();//Aanmaken van textblock voor beginscherm
            startaf = new Surface("motherload_logo.png");//toewijzen van afb(1ste startscherm)
            Levelkeuze = new Surface("motherload_logo2.png");//toewijzen van afb(2de startscherm)
            LoseScreen = new Surface("explosion.png"); //Toewijzen afb eindscherm
            mVideo = Video.SetVideoMode(750,600);//Grote van window instellen
            Video.WindowCaption = "Motherload"; //Titel in titelbalk instellen
            speler = new Player();//aanmaken van speler
            level = new Level();//aanmaken van level
            gameObjecten = new List<GameObject>();
            col = new CollisionDetection();//aanmaken van nieuw collisionDetection
            removeDirt = new RemoveDirt();//Aanmaken van Removedirt
            gameObjecten.Add(speler);
            laad = new LoadLevel();
            Cheater = new CheatEngin();
            audioThread.Start();
            CreerLevens();
            Events.Fps = 60;
            Events.KeyboardDown += Events_KeyboardDown;
            Events.Quit += Events_Quit;
            Events.Tick += Events_Tick;
            Events.Run();
        }
开发者ID:thomasvanhavere,项目名称:Portfolio-EPS,代码行数:32,代码来源:Manager.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Input.KeyboardEventArgs类代码示例发布时间:2022-05-26
下一篇:
C# Configuration.Localization类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap