Jump to content
  • Advertisement
Sign in to follow this  
elnino

DirectX C++ Custom Mouse Pointer - DirectInput

This topic is 3784 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, i've got a feeling this might be a simple one, at least i'm hoping it will be. I basically want to use a custom texture as my mouse pointer during the start of the game. I'm not really sure how to set this during the creation of the directinput mouse device. Also if anyone is feeling generous with the information-giving i basically want to give the impression that the player is pointing a light at the screen, my basic idea is to have a texture that is partially transparent, to give the appearance of lighting up the surface. Please note i do not want to be creating a directx spotlight, if possible. To achieve this partial transparent will i have to use an alpha map. Thanks in advance for any help that can be provided

Share this post


Link to post
Share on other sites
Advertisement
You could disable the windows mouse pointer cursor and draw your own using DirectX at the current mouse coordinates. That way you could put whatever effects you want on it.

DirectInput does not have functionality to change the cursor image. (at least to my knowledge)

Share this post


Link to post
Share on other sites
I would suggest using an additive blended texture instead of alpha blended texture. It will be harder to get to look "perfect" because additive blend shows up weaker than an alpha blended image, but it will look closer to the effect you are seeking.

Anyway, I don't know what you are using to render textured quads, but change the destination blend mode (D3DRS_DESTBLEND) to D3DBLEND_ONE and enable alpha blending, then render the cursor quad, then change destination blend mode to whatever it was before (probably INVSRCALPHA) and continue normally. Remember, the black color in your cursor texture will be completely transparent, and the brighter the color the more it will light up whatever is behind it.

Share this post


Link to post
Share on other sites
Thanks for the answers guys.

Yeah after a bit of research you can change the cusor image by using SetCursorProperties, i got it to work partially.

I think i was confused about what i was trying to do. I was trying to use the SetCursorProperties and combine it with the alpha blending process. But i'm just making things hard for myself, i should just use quad and apply the necessary texture to it.

THANKS ValMan, sometimes one can overlook the obvious.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!