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


C# RenderTarget类代码示例

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


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

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

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

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

示例4: Draw

 public void Draw(RenderTarget window, Location offset)
 {
     rect.Rotation = -Rotation - 90;
     rect.Position = Location.Vec2f + offset.Vec2f;
     rect.Texture = texture;
     window.Draw(rect);
 }
开发者ID:WebFreak001,项目名称:ld28-one-bullet,代码行数:7,代码来源:Entity.cs

示例5: MeshShape

        public MeshShape(RenderTarget initialRenderTarget, Random random, D2DFactory d2DFactory, D2DBitmap bitmap)
            : base(initialRenderTarget, random, d2DFactory, bitmap)
        {
            FillBrush = RandomBrush();

            mesh = CoinFlip ? MeshFromRandomGeometry() : MeshFromRandomTriangles();
        }
开发者ID:Prashant-Jonny,项目名称:phever,代码行数:7,代码来源:MeshShape.cs

示例6: Draw

 protected internal override void Draw(RenderTarget renderTarget)
 {
     if (StrokeStyle != null)
         renderTarget.DrawLine(point0, point1, PenBrush, StrokeWidth, StrokeStyle);
     else
         renderTarget.DrawLine(point0, point1, PenBrush, StrokeWidth);
 }
开发者ID:Corillian,项目名称:Windows-API-Code-Pack-1.1,代码行数:7,代码来源:LineShape.cs

示例7: Draw

        public override void Draw(RenderTarget window)
        {
            if (BackgroundShape != null)
                BackgroundShape.Draw(window);

            base.Draw(window);
        }
开发者ID:eickegao,项目名称:Blazera,代码行数:7,代码来源:InfoPanel.cs

示例8: BloomTest

        public BloomTest(RenderTexture target_tex, RenderTarget target)
        {
            _target = target;

            _bloom = new Shader(null, "bloom.glsl");
            _texture = new RenderTexture((uint)GlobalProps.Width, (uint)GlobalProps.Height);
            _states.BlendMode = BlendMode.Alpha;
            _states.Shader = _bloom;
            _states.Transform = Transform.Identity;
            _states.Texture = target_tex.Texture;
            _bloom.SetParameter("referenceTex", Shader.CurrentTexture);
            _bloom.SetParameter("pixelWidth", 4);
            _bloom.SetParameter("pixelHeight", 4);

            int w = GlobalProps.Width, h = GlobalProps.Height;
            Vector2f v0 = new Vector2f(0, 0);
            Vector2f v1 = new Vector2f(w, 0);
            Vector2f v2 = new Vector2f(w, h);
            Vector2f v3 = new Vector2f(0, h);

            _verts = new Vertex[4];
            _verts[0] = new Vertex(v0, Color.White, v0);
            _verts[1] = new Vertex(v1, Color.White, v1);
            _verts[2] = new Vertex(v2, Color.White, v2);
            _verts[3] = new Vertex(v3, Color.White, v3);
        }
开发者ID:Radnen,项目名称:sphere-sfml,代码行数:26,代码来源:BloomTest.cs

示例9: Gui

        /// <summary>
        /// Contains the shared constructor code
        /// </summary>
        /// <param name="target"></param>
        private Gui(RenderTarget target)
        {
            _renderer = new Gwen.Renderer.SFML(target);

            skin = new TexturedBase(_renderer, "DefaultSkin.png");

            // load font. TODO: remove hardcoding
            using (var font = new Gwen.Font(_renderer, "OpenSans.ttf", 14))
            {
                if (_renderer.LoadFont(font))
                    _renderer.FreeFont(font);
                else
                {
                    font.FaceName = "Arial Unicode MS";
                    if (_renderer.LoadFont(font))
                        _renderer.FreeFont(font);
                    else
                    {
                        font.FaceName = "Arial";
                        _renderer.LoadFont(font);
                    }
                }

                skin.SetDefaultFont(font.FaceName, 14);
            }

            GuiCanvas = new Canvas(skin);
            GuiCanvas.SetSize((int)target.Size.X, (int)target.Size.Y);
            GuiCanvas.ShouldDrawBackground = false;
            GuiCanvas.BackgroundColor = System.Drawing.Color.Black;
            GuiCanvas.KeyboardInputEnabled = true;

            _input = new Gwen.Input.SFML();
            _input.Initialize(GuiCanvas, target);
        }
开发者ID:Sprunth,项目名称:SprunthFramework,代码行数:39,代码来源:Gui.cs

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

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

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

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

示例14: GetHeader

        public string GetHeader(RenderTarget target)
        {
            var jsQuery = new NameValueCollection();
            jsQuery["file"] = "js";

            var cssQuery = new NameValueCollection();
            cssQuery["file"] = "css";

            return string.Format(@"
            <script src=""{0}""></script>
            <link rel=""stylesheet"" href=""{1}"" type=""text/css"" />
            <script type=""text/javascript"">
            (function($){{
            $.telligent.evolution.ui.components.poll.configure({{deleteMessage:'{2}',voteMessage:'{3}',votingEndsMessage:'{4}',votingEndsResultsHiddenMessage:'{5}',votingEndedMessage:'{6}'}});
            }}(jQuery));
            </script>
            ",
                _callbackController.GetUrl(jsQuery),
                _callbackController.GetUrl(cssQuery),
                TEApi.Javascript.Encode(_translation.GetLanguageResourceValue("poll_vote_delete")),
                TEApi.Javascript.Encode(_translation.GetLanguageResourceValue("poll_vote")),
                TEApi.Javascript.Encode(_translation.GetLanguageResourceValue("poll_voting_ends")),
                TEApi.Javascript.Encode(_translation.GetLanguageResourceValue("poll_voting_ends_results_hidden")),
                TEApi.Javascript.Encode(_translation.GetLanguageResourceValue("poll_voting_ended"))
                );
        }
开发者ID:zimbra-pmason,项目名称:Samples,代码行数:26,代码来源:PollHeaderExtension.cs

示例15: CreateTileBrush

        public static SurfacePattern CreateTileBrush(TileBrush brush, Size targetSize)
        {
            var helper = new TileBrushImplHelper(brush, targetSize);
            if (!helper.IsValid)
                return null;
            
			using (var intermediate = new ImageSurface(Format.ARGB32, (int)helper.IntermediateSize.Width, (int)helper.IntermediateSize.Height))
            using (var ctx = new RenderTarget(intermediate).CreateDrawingContext())
            {
                helper.DrawIntermediate(ctx);

                var result = new SurfacePattern(intermediate);

                if ((brush.TileMode & TileMode.FlipXY) != 0)
                {
                    // TODO: Currently always FlipXY as that's all cairo supports natively. 
                    // Support separate FlipX and FlipY by drawing flipped images to intermediate
                    // surface.
                    result.Extend = Extend.Reflect;
                }
                else
                {
                    result.Extend = Extend.Repeat;
                }

                if (brush.TileMode != TileMode.None)
                {
                    var matrix = result.Matrix;
                    matrix.InitTranslate(-helper.DestinationRect.X, -helper.DestinationRect.Y);
                    result.Matrix = matrix;
                }

                return result;
            }
        }
开发者ID:Arlorean,项目名称:Perspex,代码行数:35,代码来源:TileBrushes.cs


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