开发者

direct x mouse recapturing problem

i have a direct x c++ game. i use my own mouse icon and capture the mouse and keyboard when the game initialises but the problem is that if i minimise the game and select another window, for example to skip a song media player when i go back to my game screen the mouse no longer works.

as far as i understand it i need to re capture the mouse handler every time the application gets focus but how do i do this.

can i simply re use the same mouse code from t开发者_开发问答he initialisation and if so where do i put it to make it run when the application regains focus.

fyi my game runs in both windowed mode and full screen would this make a difference.

thank you


First of all, I would advise to use the Windows cursor API instead of drawing the mouse yourself. It will be much more responsive (not suffering from low fps etc.) and it is much easier to handle. You can use animated cursors this way too.

For capturing the mouse, you can only really capture it while a mouse button is pressed. If no button is pressed and the mouse is moved outside the application window, you lose the capture.

Why do you even need to capture the mouse? You get WM_MOUSEMOVE messages etc. when the mouse is not captured.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜