Skip to main content
gamedev.net
🔒 Locked

Multiple Cursor

Started by SCarvenger 4 replies 2.5k views
Original Post
SCarvenger
SCarvenger
How can i display two or more cursors in the screen? I tought of: 1) Drawing directly in the screen DC, but as i "move" the recently created cursor it makes a track because the area that the cursor was doesnt gets repainted...
Nyarlath
Nyarlath
It's not possible.
You can save a copy of the screen where your cursor enters and repaint it when you leave; but you can't obtain an updated image without asking directly the application(s) which paints on the DC.
Zahlman
Zahlman
The user only moves one mouse, so there is only one cursor. You can of course have more than one cursor image, but you only want to manually draw (i.e. directly to DC) the images that don't correspond to the one the user is moving. When you "make the second cursor", draw a cursor image where the cursor is currently, move the cursor to the new position, and change the cursor icon (if desired).
joe_bubamara
joe_bubamara
Quote:
The user only moves one mouse, so there is only one cursor.
well if you have two users with two mouses, then you will need two cursors as well. For example if one do a multiplayer game ... :)

So this question is something that I also have a problem with :).
Evil Steve
Evil Steve
Quote:
Original post by joe_bubamara
Quote:
The user only moves one mouse, so there is only one cursor.
well if you have two users with two mouses, then you will need two cursors as well. For example if one do a multiplayer game ... :)

So this question is something that I also have a problem with :).
Windows combines the input from all mice connected to the PC into one, so you'll still only get one cursor. If you need to read input from multiple devices, you should look into raw input (Which is a Win32 concept), or whatever is appropriate for the language you're using.
In any case, it'll mean drawing the cursor image yourself. Although, if the OP was rendering two cursor images in one application, there shouldn't be a problem. It sounds to me like he wants to be able to create a fake cursor image and move that around the desktop rather than an app window.
joe_bubamara
joe_bubamara
yest steve, it's all correct, but not even raw_input will give you two cursors, so it is right that one has to draw cursor himself as well;

I am not sure if you can draw two cursor images even on desktop, but with some keyboard hook it might be possible as well.

This is actually next thing to investigate on my todo list :), as soon as I sort out some issue with raw_input and it reporting multiple devices when there are not (& I am not talking about RDP devices).

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.