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


C# RenderWindow.Draw方法代码示例

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


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

示例1: Main

        static void Main(string[] args)
        {
            RenderWindow window = new RenderWindow(new VideoMode(800, 600), "Test01");
            window.Closed += (object sender, EventArgs e) => { (sender as Window).Close(); };

            Font font = new Font("SnowflakeLetters.ttf");
            Text text = new Text("BALD IST WEIHNACHTEN!", font);
            Color col1 = new Color(123, 12, 12);
            text.Position = new Vector2f(200, 200);
            CircleShape shape = new CircleShape(20, 8);
            shape.FillColor = Color.White;
            shape.Position = new Vector2f(50, 50);
            float a, c;
            a = c = 50f;

            while (window.IsOpen())
            {
                window.Clear(col1);
                window.Draw(text);
                if (Keyboard.IsKeyPressed(Keyboard.Key.Left) && a > 0)
                    a -= 0.1f;
                if (Keyboard.IsKeyPressed(Keyboard.Key.Right) && a < window.Size.X - shape.Radius * 2)
                    a += 0.1f;
                if (Keyboard.IsKeyPressed(Keyboard.Key.Down) && c < window.Size.Y - shape.Radius * 2)
                    c += 0.1f;
                if (Keyboard.IsKeyPressed(Keyboard.Key.Up) && c >  0)
                    c -= 0.1f;
                window.Draw(shape);
                shape.Position = new Vector2f(a, c);

                window.Display();
                window.DispatchEvents();
            }
        }
开发者ID:HanHangit,项目名称:Visual-Test,代码行数:34,代码来源:Program.cs

示例2: Main

        public static void Main(String[] args)
        {
            RenderWindow window = new RenderWindow(new VideoMode(1000, 700), "title");
            RenderTexture tex = new RenderTexture(1000, 700);
            Sprite texSprite = new Sprite(tex.Texture);

            Fractal fractal = new Fractal();

            fractal.CreateTreeFractal(500, 700, 3, 100, 0);
            Console.WriteLine(fractal.Nodes.Count);

            while (window.IsOpen())
            {
                window.Clear();
                tex.Clear(new Color(0, 0, 0, 200
                    ));
                foreach (Shape s in fractal.Nodes)
                {
                    window.Draw(s);
                }
                tex.Display();
                window.Draw(texSprite);
                window.Display();
                Image img = window.Capture();
                img.SaveToFile("C:/i.png");
                Console.ReadLine();
            }
        }
开发者ID:dolorismachina,项目名称:Space-Invaders,代码行数:28,代码来源:Program.cs

示例3: Draw

 public override void Draw(RenderWindow win, TimeSpan gameTime)
 {
     win.Draw(BackPlate);
     win.Draw(LeftSide);
     win.Draw(Center);
     win.Draw(RightSide);
     win.Draw(ButtonText);
 }
开发者ID:Tricon2-Elf,项目名称:SpaceHybridTest,代码行数:8,代码来源:TextButton.cs

示例4: Draw

        public void Draw(RenderWindow window)
        {
            window.Draw(title);

            for(int i = 0; i < 4; i++)
            {
                window.Draw(options[i]);
            }

            window.Draw(pointer);
        }
开发者ID:Jespyr,项目名称:Invasion-Grid,代码行数:11,代码来源:Menu.cs

示例5: Draw

        override public void Draw(RenderWindow window)
        {
            //code to draw our text objects on the screen
            window.Draw(title);

            for (int i = 0; i < 4; i++)
            {
                window.Draw(options[i]);
            }

            window.Draw(pointer);
        }
开发者ID:Jespyr,项目名称:Invasion-Grid,代码行数:12,代码来源:MenuState.cs

示例6: Draw

        public override void Draw(RenderWindow context, AController controller)
        {
            Controller c = (Controller)controller;

              foreach (Ball ball in c.Balls)
            ball.Draw(context);

              Text text = new Text("Splash Screen");
              context.Draw(text);

              context.Draw(Domey);
        }
开发者ID:colincapurso,项目名称:GameEngineSFML,代码行数:12,代码来源:View.cs

示例7: Draw

        public void Draw(RenderWindow window)
        {
            if(!IsVisible()) return;

            //Shadow
            Position += new Vector2f(0, 1);
            Color = Color.Black;
            window.Draw(this, RenderStates.Default);
            //Text
            Position -= new Vector2f(0, 1);
            Color = Config.Colors["text"];
            window.Draw(this, RenderStates.Default);
        }
开发者ID:EReeves,项目名称:SMUS,代码行数:13,代码来源:Song.cs

示例8: draw

 internal override void draw(RenderWindow window)
 {
     window.Draw(playerFrameSprite);
     window.Draw(insideFrameSprite);
     hpPercentText.DisplayedString = Math.Round(player.getHPpercent() * 100, 1) + "%";
     window.Draw(hpPercentText);
     //draw threat
     int threatRank = parent.getInGame().getThreatRankOnMainEnemy(player);
     if (threatRank != -1) {
         threatText.DisplayedString = threatRank + "";
         window.Draw(threatText);
     }
 }
开发者ID:nik0kin,项目名称:ProjectTurtle,代码行数:13,代码来源:RaidFrames.cs

示例9: Draw

        internal void Draw(RenderWindow window)
        {
            window.Draw(bgSprite);
            window.Draw(stripeSprite);
            window.Draw(logoSprite);

            play.draw(window);
            leaderboard.draw(window);
            stats.draw(window);
            settings.draw(window);
            help.draw(window);
            exit.draw(window);
        }
开发者ID:nik0kin,项目名称:ProjectTurtle,代码行数:13,代码来源:MenuScreen.cs

示例10: DrawAll

        public static void DrawAll(ref RenderWindow window)
        {
            window.Clear();
            window.DispatchEvents();

            foreach (Shape s in shapeList)
                window.Draw(s);

            foreach (Sprite s in spriteList)
                window.Draw(s);

            window.Display();
        }
开发者ID:bootv2,项目名称:dagamez,代码行数:13,代码来源:SpriteManager.cs

示例11: draw

        internal void draw(RenderWindow window)
        {
            pillarSprite.Position = new Vector2f(rect.Left,rect.Top);
            pillarSprite.Texture = units.Count > 0 ? pillarUsed : pillarUnused;
            window.Draw(pillarSprite);

            int i=0;
            foreach (ChampItemPair unit in units) {
                //TODO EFF this must not efficient
                unitSprite.Position = new Vector2f(rect.Left + (i++ * 50), rect.Top);
                unitSprite.Texture = getUnitTexture(unit.hero);
                window.Draw(unitSprite);
            }
        }
开发者ID:nik0kin,项目名称:ProjectTurtle,代码行数:14,代码来源:Pillar.cs

示例12: drawToolTip

        internal void drawToolTip(RenderWindow window)
        {
            if (!hover) return;
            if (disable) {
                window.Draw(icon);
                //spriteBatch.Draw(icon.text, icon.rect, Color.White);
                return;
            }

            window.Draw(bgSprite);
            window.Draw(icon);

            window.Draw(titleText);
            window.Draw(descText);
        }
开发者ID:nik0kin,项目名称:ProjectTurtle,代码行数:15,代码来源:IconToolTip.cs

示例13: Main

        public static void Main(string[] args)
        {
            window = new RenderWindow(new VideoMode(800, 600), "SFML window");
            window.SetVisible(true);
            window.SetVerticalSyncEnabled(true);
            window.Closed += OnClosed;
            window.MouseMoved += OnMouse;
            window.MouseLeft += Window_MouseLeft;
            window.Resized += Window_Resized;

            List<Button> buttons = new List<Button>();

            for (int i = 0; i < 10; i++)
            {
                buttons.Add(new Button(new Vector2f(i*200, 100), new Vector2f(75, 20)));
            }

            while (window.IsOpen)
            {
                window.DispatchEvents();
                window.Clear(new Color(50, 50, 50));
                GUIManager.GuiManager.Update(Mouse.GetPosition(window).X, Mouse.GetPosition(window).Y);
                foreach (var item in buttons)
                {
                    window.Draw(item);
                }
                window.Display();
            }
        }
开发者ID:FelixKimmerle,项目名称:SFMLGui,代码行数:29,代码来源:Program.cs

示例14: Draw

        public void Draw(RenderWindow win)
        {
            if(Sprite != null)
            {
                Sprite.Color = Color.White;
                Sprite.Texture = StoneTexture;
                win.Draw(Sprite);
                var opacity = particleSwarm.Count >= 200 ? (byte) 255 :
                                (byte) (particleSwarm.Count);
                Sprite.Color = new Color(255, 255, 255, opacity);
                Sprite.Texture = opacity == 255 ? DotTexture : GlowTexture;
                win.Draw(Sprite);
            }

            //DebugDraw(win);
        }
开发者ID:Greaka,项目名称:RuneShift,代码行数:16,代码来源:Rune.cs

示例15: Draw

        public void Draw(RenderWindow window)
        {
            // Draw outer dark circle
            CircleShape shape = new CircleShape(mass, 40);
            shape.FillColor = new Color((byte)Math.Max(color.R - 50, 0), (byte)Math.Max(color.G - 50, 0), (byte)Math.Max(color.B - 50, 0));
            shape.Position = new Vector2f(position.X - (ushort)mass, position.Y - (ushort)mass);
            window.Draw(shape);


            float diff = 4 + mass / 50;
            // Draw inner circle
            shape.Radius -= diff;
            shape.FillColor = color;
            shape.Position = new Vector2f(position.X - (ushort)mass + diff, position.Y - (ushort)mass + diff);
            window.Draw(shape);
        }
开发者ID:Shiroy,项目名称:Agar.net,代码行数:16,代码来源:Cell.cs


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