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


C# Sprite.Draw方法代码示例

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


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

示例1: GaussianBlurRadius11_ShouldBlur

        public void GaussianBlurRadius11_ShouldBlur()
        {
            preblur = new RenderImage("testGaussianBlur", 1280, 768);
            _gaussianBlur = new GaussianBlur(_resourceManager);

            _gaussianBlur.SetRadius(11);
            _gaussianBlur.SetAmount(2);
            _gaussianBlur.SetSize(new Vector2f(preblur.Width, preblur.Height));

            while (CluwneLib.IsRunning)
            {
                var lastFrameTime = clock.ElapsedTime.AsSeconds();
                clock.Restart();
                _frameEvent = new FrameEventArgs(lastFrameTime);
                CluwneLib.ClearCurrentRendertarget(Color.Black);
                CluwneLib.Screen.DispatchEvents();

                preblur.BeginDrawing(); // set temp as CRT (Current Render Target)
                //preblur.Clear();       //Clear
                sprite = _resourceManager.GetSprite("flashlight_mask");
                sprite.Position = new Vector2f();
                sprite.Draw();
                preblur.EndDrawing();  // set previous rendertarget as CRT (screen in this case)

                //_gaussianBlur.PerformGaussianBlur(preblur); // blur rendertarget

                preblur.Blit(0,0, preblur.Width, preblur.Height,Color.White, BlitterSizeMode.Crop ); // draw blurred nosprite logo

                CluwneLib.Screen.Display();

            }
        }
开发者ID:MSylvia,项目名称:space-station-14,代码行数:32,代码来源:GaussianBlur_Test.cs

示例2: DrawImage

        /// <summary>
        /// Draws a rectangle with an image.
        /// If the image doesn't match the size of the rectangle, the image is repeated.
        /// </summary>
        /// <param name="img">Image to use.</param>
        /// <param name="imgSrcRect">Source region of the image to use.</param>
        /// <param name="rect">Rectangle to draw.</param>
        /// <param name="color">Tint to give to the image.</param>
        public void DrawImage(Texture img, FloatRect rect, IntRect imgSrcRect, Color color)
        {
            img.Repeated = true;
            Sprite srect = new Sprite(img, imgSrcRect);
            srect.Position = new Vector2f(rect.Left + Translation.X, rect.Top + Translation.Y);
            srect.Scale = new Vector2f(rect.Width / (float)imgSrcRect.Width, rect.Height / (float)imgSrcRect.Height);
            srect.Color = ActualColor(color);

            srect.Draw(myTarget, RenderStates.Default);
        }
开发者ID:Ziple,项目名称:NOubliezPas,代码行数:18,代码来源:Painter.cs

示例3: Blit

        /// <summary>
        /// Creates a Sprite from RenderImage Texture and draws it to the screen
        /// </summary>
        /// <param name="Position"> Position of Texture </param>
        /// <param name="Size"> Size of the Texture </param>
        /// <param name="color"> Global color of object </param>
        public void Blit(SFML.System.Vector2f position, SFML.System.Vector2f Size, SFML.Graphics.Color color)
        {
            isStillDrawing();
            blitsprite = new SFML.Graphics.Sprite(Texture);
            blitsprite.Position = position;
            blitsprite.Color = color;
            var bounds = blitsprite.GetLocalBounds();

            if (Mode == BlitterSizeMode.Scale)
            {
                SFML.System.Vector2f scale = new SFML.System.Vector2f(( Size.X / bounds.Width ),( Size.Y / bounds.Height ));
                blitsprite.Scale = scale;

            }
            else if (Mode == BlitterSizeMode.Crop)
            {
                IntRect crop = new IntRect((int)position.X, (int)position.Y, (int)Size.X, (int)Size.Y);
                blitsprite.TextureRect = crop;

            }

            if (CluwneLib.CurrentRenderTarget == this)
                return;

            blitsprite.Draw();
        }
开发者ID:MSylvia,项目名称:space-station-14,代码行数:32,代码来源:RenderImage.cs

示例4: RenderWorking

        private void RenderWorking()
        {
            window.Clear(Color.Black);

            textureOne.Clear(Color.White);
            textureOne.Display();

            var renderSprite = new Sprite(textureOne.Texture);

            // Note #2
            // renderSprite.Position = new Vector2f(Mouse.GetPosition(window).X, Mouse.GetPosition(window).Y);

            renderSprite.Draw(window, RenderStates.Default);

            // Note #1
            // window.Display();
        }
开发者ID:nathanchere,项目名称:Spikes_SfmlRenderTexture,代码行数:17,代码来源:FboTest.cs


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