Quantcast
Channel: Community | MonoGame - Latest topics
Viewing all articles
Browse latest Browse all 6821

[SOLVED] Crash when setting a hardware mouse cursor from a sprite... any ideas?

$
0
0

@Roxfall wrote:

{"Failed to set surface for mouse cursor: CreateIconIndirect(): The parameter is incorrect.\r\n"} System.InvalidOperationException

Stack Trace:
StackTrace " at Microsoft.Xna.Framework.Input.MouseCursor.PlatformFromTexture2D(Texture2D texture, Int32 originx, Int32 originy)\r\n" string

So I was messing around with Mouse.SetCursor(MouseCursor.FromTexture2D(sprite, 0, 0));

And by messing around I mean setting it several times per second (i.e. every frame). Windows 10, VS 2017.

This crash pops out after maybe half a minute of incessant clicking, but is 100% reproducible under those conditions.

Has anyone seen this before? Google has failed me.

I'd appreciate any pointers on how to prevent this crash.

It seems that I can avoid it by setting mouse cursor sprite less frequently, but that means I can't have an animated mouse cursor. Even then, that's not a guarantee if there's a bug somewhere in the pipeline.

Should I just put this inside a giant try{} block and forget about it?

Thanks for reading!

Posts: 7

Participants: 4

Read full topic


Viewing all articles
Browse latest Browse all 6821

Trending Articles