Both of these approaches use Panda to render a piece of geometry onscreen, in the same place as the hardware mouse pointer.
This does constrain the “mouse” to be drawn only once per frame, which means it is indeed one frame behind the actual mouse position. If your frame rate is high, this is not a problem; but if your frame rate is low to medium, this can create a real sense of sluggishness.
You can also configure the actual hardware mouse pointer to use a particular shape. This avoids the sluggishness, because it actually uses the hardware mouse cursor. It’s kind of limited in Panda: it only works on Windows, and you can only set it at startup time. To do this, specify the following in your Config.prc (or before you import DirectStart):
cursor-filename mycursor.ico
where mycursor.ico is a file in Windows ico format that you provide. There are a number of shareware and freeware tools that will help you paint a mouse cursor ico file.
That seems to do exactly what my code does. It doesn’t scale the mouse pointer when you scale the resolution, and if you parent it to aspect2d, the pointer position gets messed up when getting close to the borders of the window
@drwr: Yes that is good and GIMP can export to .ico format, but only Windows is a bit of problem here
If this is your only objection to this approach, then you can handle this yourself: listen for “window-event”, which is sent whenever the window changes properties (including its size), and when you receive this event, set the scale on your mouse pointer to the appropriate value based on the new size of the window.