/// https://forums.stride3d.net/t/change-mouse-cursor-graphic/1281/5 using Stride.Games; using Stride.Graphics; using Stride.Core; using Stride.Input; using Stride.Rendering; using Stride.Rendering.Compositing; [Display("Demo: Sprite Cursor Renderer")] public class SpriteCursorRenderer : SceneRendererBase { private SpriteBatch spriteBatch; private InputManager inputManager; public Texture Cursor { get; set; } protected override void InitializeCore() { base.InitializeCore(); spriteBatch = new SpriteBatch(GraphicsDevice); inputManager = Services.GetService(); Services.GetService().IsMouseVisible = false; } protected override void DrawCore(RenderContext context, RenderDrawContext drawContext) { if (Cursor != null) { spriteBatch.Begin(drawContext.GraphicsContext, depthStencilState: DepthStencilStates.None); spriteBatch.Draw(Cursor, inputManager.MousePosition * context.ViewportState.Viewport0.Size); spriteBatch.End(); } } protected override void Destroy() { base.Destroy(); spriteBatch.Dispose(); } }