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


C# RenderTarget.Draw方法代码示例

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


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

示例1: Draw

        public void Draw(RenderTarget rt)
        {
            DateTime now = DateTime.Now;

            Text message = new Text("", myFont);
            message.CharacterSize = 14;

            int removeCount = 0;
            foreach(KeyValuePair<DateTime, String> pair in msgList){
             	message.DisplayedString += pair.Value + "\n";
                if((now - pair.Key).TotalSeconds > messageLifeTime)
                    removeCount++;
            }

            msgList.RemoveRange(0, removeCount);
            message.Position = new Vector2f(14, rt.Height - 54 - message.GetRect().Height);
            rt.Draw(message);

            if(writing){
                Text display = new Text("say : " + toWrite + "_", myFont);
                display.CharacterSize = 14;
                display.Position = new Vector2f(14, rt.Height - 36 - display.GetRect().Height);
                rt.Draw(display);
            }
        }
开发者ID:CyrilPaulus,项目名称:2dThing,代码行数:25,代码来源:Chat.cs

示例2: Draw

 public void Draw(RenderTarget target, RenderStates states)
 {
     target.Draw(background, states);
     foreach (Layer l in layers) {
         target.Draw(l, states);
     }
 }
开发者ID:remy22,项目名称:game-1,代码行数:7,代码来源:Map.cs

示例3: Draw

        public void Draw(RenderTarget target, RenderStates states)
        {
            states.Transform.Combine(Transform);

            target.Draw(m_QuadArray, states);
            target.Draw(m_LineArray, states);
        }
开发者ID:deanljohnson,项目名称:PathView,代码行数:7,代码来源:SquareGridBase.cs

示例4: Draw

        public void Draw(RenderTarget target, RenderStates states)
        {
            body.FillColor = data.FillColor;

            target.Draw(body);
            target.Draw(text);
        }
开发者ID:Cellmon95,项目名称:WarGames,代码行数:7,代码来源:ButtonRenderer.cs

示例5: Draw

        public override void Draw(RenderTarget target, Vector2f position)
        {
            _icon.Position = position;
            target.Draw(_icon);

            if (_amount == 0)
            {
                var darken = new RectangleShape(new Vector2f(Hud.IconSize - Hud.IconBorderTwice, Hud.IconSize - Hud.IconBorderTwice));
                darken.Origin = new Vector2f(Hud.IconSizeHalf - Hud.IconBorder, Hud.IconSizeHalf - Hud.IconBorder);
                darken.FillColor = new Color(0, 0, 0, 200);
                darken.Position = position;
                target.Draw(darken);
            }

            if (_time > 0)
            {
                var per = _time / BuildTime;
                var box = new RectangleShape(new Vector2f(per * (Hud.IconSize - Hud.IconBorderTwice), 8));
                box.FillColor = new Color(0, 180, 0, 128);
                box.Position = position - new Vector2f(Hud.IconSizeHalf - Hud.IconBorder, Hud.IconSizeHalf - Hud.IconBorder);
                target.Draw(box);
            }

            _amountText.DisplayedString = _amount.ToString("G");
            _amountText.Position = position + new Vector2f(Hud.IconSizeHalf - Hud.Padding, Hud.IconSizeHalf - Hud.Padding);

            var bounds = _amountText.GetLocalBounds();
            _amountText.Origin = new Vector2f(bounds.Width + bounds.Left, bounds.Height + bounds.Top);

            target.Draw(_amountText);
        }
开发者ID:Rohansi,项目名称:FPCompo11,代码行数:31,代码来源:DroneLauncher.cs

示例6: Draw

        public override void Draw(RenderTarget rt)
        {
            Text title = new Text("Oh no! Something went wrong!", Assets.LoadFont(Program.DefaultFont))
            {
                Position = new Vector2f(GameOptions.Width / 2.0f, 48.0f),
                CharacterSize = 48,
                Color = Color.White
            };

            title.Center();
            title.Round();
            rt.Draw(title);

            Text blackCardText = new Text(value, Assets.LoadFont(Program.DefaultFont))
            {
                Position = new Vector2f(GameOptions.Width / 2.0f, GameOptions.Height / 2.0f),
                CharacterSize = 36,
                Color = Color.White
            };

            blackCardText.Center();
            blackCardText.Round();
            rt.Draw(blackCardText);

            base.Draw(rt);
        }
开发者ID:DatZach,项目名称:HumanityAgainstCards,代码行数:26,代码来源:ErrorMessageScreen.cs

示例7: Draw

        public override void Draw(RenderTarget rt)
        {
            Vector2f actualPosition = Position + (Selected ? new Vector2f(0, -12.0f - 5.0f * GetSelectedIndex()) : new Vector2f());

            // Draw card
            Sprite sprite = new Sprite(Assets.LoadTexture(Info.Type == CardType.White ? "CardWhite.png" : "CardBlack.png"));
            Size = new Vector2f(sprite.GetGlobalBounds().Width, sprite.GetGlobalBounds().Height);
            sprite.Position = actualPosition;
            sprite.Scale = Scale;
            rt.Draw(sprite);

            // Draw text
            Text text = GameUtility.Wrap(Info.Value, Assets.LoadFont("arialbd.ttf"), (uint)Math.Floor(24.0f * Scale.X),
                                     Math.Floor(207.0f * Scale.X));

            text.Color = Info.Type == CardType.White ? Color.Black : Color.White;
            text.Position = actualPosition + new Vector2f(16.0f * Scale.X, 10.0f * Scale.Y);
            text.Round();
            rt.Draw(text);

            // Draw decorations
            if (Info.PickCount > 1)
            {
                Sprite pickMultiple = new Sprite(Assets.LoadTexture(Info.PickCount == 2 ? "PickTwo.png" : "PickThree.png"))
                {
                    Position =
                        actualPosition +
                        new Vector2f((241.0f - 56.0f - 10.0f - 4.0f) * Scale.X, (320.0f - 10.0f - 20.0f) * Scale.Y),
                    Scale = Scale
                };

                rt.Draw(pickMultiple);
            }
        }
开发者ID:DatZach,项目名称:HumanityAgainstCards,代码行数:34,代码来源:Card.cs

示例8: Draw

        public override void Draw(RenderTarget rt)
        {
            RectangleShape bgOverlay = new RectangleShape(new Vector2f(GameOptions.Width, GameOptions.Height)) { FillColor = Color.Black };
            rt.Draw(bgOverlay);

            Text title = new Text("Game Over", Assets.LoadFont(Program.DefaultFont))
            {
                Position = new Vector2f(GameOptions.Width / 2.0f, 48.0f),
                CharacterSize = 48,
                Color = Color.White
            };

            title.Center();
            title.Round();
            rt.Draw(title);

            Text winnerTitle = new Text(GetWinnerText(), Assets.LoadFont(Program.DefaultFont))
            {
                Position = new Vector2f(GameOptions.Width / 2.0f, GameOptions.Height / 2.0f),
                CharacterSize = 48,
                Color = Color.White
            };

            winnerTitle.Center();
            winnerTitle.Round();
            rt.Draw(winnerTitle);

            base.Draw(rt);
        }
开发者ID:DatZach,项目名称:HumanityAgainstCards,代码行数:29,代码来源:GameOverScreen.cs

示例9: Draw

        public override void Draw(RenderTarget rt)
        {
            RectangleShape overylay = new RectangleShape(new Vector2f(GameOptions.Width, GameOptions.Height))
            {
                FillColor = new Color(0, 0, 0, 128)
            };

            rt.Draw(overylay);

            RectangleShape window = new RectangleShape(new Vector2f(GameOptions.Width * (1.0f - PaddingHorizontal * 2.0f), GameOptions.Height * (1.0f - PaddingVertical * 2.0f)))
            {
                Position = new Vector2f(GameOptions.Width * PaddingHorizontal, GameOptions.Height * PaddingVertical),
                FillColor = Color.White,
                OutlineColor = Color.Black,
                OutlineThickness = 2.0f
            };

            rt.Draw(window);

            Text labelSettings = new Text("Join by IP", Assets.LoadFont(Program.DefaultFont))
            {
                Position = new Vector2f(GameOptions.Width / 2.0f, GameOptions.Height * PaddingVertical + 48.0f),
                Color = Color.Black,
                CharacterSize = 32
            };

            labelSettings.Center();
            labelSettings.Round();
            rt.Draw(labelSettings);

            base.Draw(rt);
        }
开发者ID:DatZach,项目名称:HumanityAgainstCards,代码行数:32,代码来源:JoinByIpOverlay.cs

示例10: Draw

        public override void Draw(RenderTarget rt)
        {
            RectangleShape checkbox = new RectangleShape(Size)
            {
                Position = Position,
                FillColor = Color.Black,
            };

            rt.Draw(checkbox);

            if (mouseIn)
            {
                RectangleShape checkboxHover = new RectangleShape(new Vector2f(48.0f - 8.0f, 48.0f - 8.0f))
                {
                    Position = Position + new Vector2f(4.0f, 4.0f),
                    FillColor = Color.Black,
                    OutlineColor = Color.White,
                    OutlineThickness = 2f
                };

                rt.Draw(checkboxHover);
            }

            Text labelText = new Text(Label, Assets.LoadFont(Program.DefaultFont))
            {
                Position = Position + new Vector2f(48.0f + 16.0f, 24.0f + 2.0f),
                CharacterSize = 32,
                Color = Color.Black
            };

            labelText.Center(false);
            labelText.Round();
            rt.Draw(labelText);

            if (Value)
            {
                RectangleShape x1 = new RectangleShape(new Vector2f(48.0f, 3.0f))
                {
                    Position = Position + new Vector2f(24.0f, 24.0f),
                    Origin = new Vector2f(24.0f, 2.0f),
                    FillColor = Color.White,
                    Rotation = -45.0f
                };

                rt.Draw(x1);

                RectangleShape x2 = new RectangleShape(new Vector2f(48.0f, 3.0f))
                {
                    Position = Position + new Vector2f(24.0f, 24.0f),
                    Origin = new Vector2f(24.0f, 2.0f),
                    FillColor = Color.White,
                    Rotation = 45.0f
                };

                rt.Draw(x2);
            }

            base.Draw(rt);
        }
开发者ID:DatZach,项目名称:HumanityAgainstCards,代码行数:59,代码来源:Checkbox.cs

示例11: Draw

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

            window.Draw(SideSquare);
            window.Draw(CenterSquare);
        }
开发者ID:eickegao,项目名称:Blazera,代码行数:8,代码来源:CombatCursorShape.cs

示例12: Draw

 public void Draw(RenderTarget target, RenderStates states)
 {
     target.Draw(rectangleShape);
     target.Draw(unitPictureBoxRenderer);
     target.Draw(healthBarRenderer);
     target.Draw(MoveButtonRenderer);
     target.Draw(AttackButtonRenderer);
 }
开发者ID:Cellmon95,项目名称:WarGames,代码行数:8,代码来源:InterfaceBarRenderer.cs

示例13: Draw

        public void Draw(RenderTarget target, RenderStates states)
        {
            if (data.PictureSprite != null)
                curentPicture = data.PictureSprite;

            target.Draw(frame);
            target.Draw(curentPicture);
        }
开发者ID:Cellmon95,项目名称:WarGames,代码行数:8,代码来源:UnitPictureBoxRenderer.cs

示例14: Draw

        public void Draw(RenderTarget target, RenderStates states)
        {
            foreach (MenuItem item in menuItems)
            {
                target.Draw(item);
            }

            target.Draw(selectionPointer);
        }
开发者ID:Blezzing,项目名称:Orbs,代码行数:9,代码来源:Menu.cs

示例15: Draw

 public override void Draw(RenderTarget target, RenderStates states)
 {
     target.Clear(Color.Black);
     target.Draw(_backgroundSprite);
     foreach (var w in Widgets)
     {
         target.Draw(w);
     }
 }
开发者ID:Tetramputechture,项目名称:Ending_0.1b,代码行数:9,代码来源:MainMenuScreen.cs


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