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


C# RenderTarget.MapPixelToCoords方法代码示例

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


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

示例1: Draw

        public override void Draw(RenderTarget target, RenderStates states)
        {
            target.Clear(Color.Black);

            target.SetView(_view);

            _game._mouseLight.SetPosition(target.MapPixelToCoords(InputHandler.MousePosition));
            _game.Map.Draw(target, states);
            if (_fpsToggle)
                _msFLabel.Draw(target, states);
        }
开发者ID:Tetramputechture,项目名称:Ending_0.1b,代码行数:11,代码来源:GameScreen.cs

示例2: DrawBufferToTarget

        /// <summary>
        /// Gets the buffer then draws it to a <see cref="RenderTarget"/>.
        /// </summary>
        /// <param name="target">The <see cref="RenderTarget"/> to draw to.</param>
        /// <param name="camera">The <see cref="ICamera2D"/> to use when drawing.</param>
        /// <returns>True if the buffer was successfully drawn to the <paramref name="target"/>; otherwise false.</returns>
        protected bool DrawBufferToTarget(RenderTarget target, ICamera2D camera)
        {
            // Get the buffer
            var bufferImage = GetBuffer(camera);
            if (bufferImage == null)
                return false;

            // Set up the sprite
            _drawToTargetSprite.Texture = bufferImage;
            _drawToTargetSprite.Position = target.MapPixelToCoords(Vector2.Zero).Round();

            var bufferImageSize = bufferImage.Size;
            _drawToTargetSprite.TextureRect = new IntRect(0, 0, (int)bufferImageSize.X, (int)bufferImageSize.Y);

            // Reset RenderStates
            _renderStates.Shader = DrawToTargetShader;
            _renderStates.BlendMode = BlendMode.Alpha;
            _renderStates.Transform = Transform.Identity;
            _renderStates.Texture = null;

            // Draw to the target
            HandleDrawBufferToTarget(bufferImage, _drawToTargetSprite, target, camera, _renderStates);

            return true;
        }
开发者ID:mateuscezar,项目名称:netgore,代码行数:31,代码来源:OffscreenRenderBufferManagerBase.cs


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