DirectX C++ Custom Mouse Pointer - DirectInput

Started by
5 comments, last by elnino 15 years, 9 months ago
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
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)
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.
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.
SLightly off topic, but you really don't want to use DirectInput for keyboard or mouse input...
Quote:Original post by Evil Steve
SLightly off topic, but you really don't want to use DirectInput for keyboard or mouse input...


lol Couldn't have have a DirectInput thread without that link there ;) Even I started pasting it into threads, just to save you a few seconds :D
Quote:Original post by Evil Steve
SLightly off topic, but you really don't want to use DirectInput for keyboard or mouse input...


Yeah i know i've read that everywhere, unfortunately DirectInput is deeply embedded in our engine and it's a bit late to change it, silly mistake.

Thanks anyways

This topic is closed to new replies.

Advertisement