Created
August 16, 2025 20:27
-
-
Save w0wca7a/a9cfa1f356d7c09f7e3fe3d3751d0a5c to your computer and use it in GitHub Desktop.
Revisions
-
w0wca7a created this gist
Aug 16, 2025 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,47 @@ /// 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<InputManager>(); Services.GetService<IGame>().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(); } }