Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / [DGDK2.0] dbMouseMoveX/Y() not working correctly

Author
Message
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 14th Jul 2012 22:47
dbMouseMoveX() and dbMouseMoveY() stop working at the edges of the screen. It didn't do this in 1.0. Is there a solution/workaround? Can we get it corrected in RC5?

The fastest code is the code never written.
Dar13
15
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 14th Jul 2012 23:11 Edited at: 14th Jul 2012 23:11
I think that was one of the changes made from 1.0. I suppose you could do a pseudo dbMouseMove by doing something like this:


Of course, that's assuming that dbMouseX/Y work outside the window and that you require the mouse to be clicked.

Mistrel
Retired Moderator
18
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 15th Jul 2012 00:28
This is a feature added in 2.0. If you want the old behavior just check whether the mouse has moved beyond the window's client area. See GetClientRect() in Win32.

Mister Fuzzy
13
Years of Service
User Offline
Joined: 27th Feb 2011
Location: XNA
Posted: 15th Jul 2012 01:20
I don't know much about DGDK2.0, but you should be able to reposition the mouse to the center of the screen. If you do this each cycle, the default dbMouseMoveX/Y() should work fine, assuming that you don't also need exact mouse X/Y positions. This is what I usually do in other languages where the MouseMoveX/Y command is not present.

ALIEN(S)!!!!!!!!1!! (and sausages)
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 15th Jul 2012 01:59
Yes, Mister Fuzzy, that's the solution I came up with. It works just fine except it looks a little jumpy when I do it-- not something that will bother me.

@Mistrel: If I have full screen, getting the rect will still give me the same results. Why was this *feature* added in the first place? I mean, if your playing a FPS, you need to rotate the camera 360 so much it will make you dizzy. dbMouseMoveX/Y was perfect for checking the movement of the mouse-- even when it was at the edge of the screen.

The fastest code is the code never written.
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 15th Jul 2012 02:22
Probably because it is very annoying if you play a game in windowed mode and move your cursor out of the window to do something non-game related and the camera merrily spins away.

In a fps you probably wouldn't have a mouse cursor visible anyway, hence you can reposition the (hidden) cursor at the centre of the screen as was mentioned earlier.
If you DO have a cursor in a game chances are you just position a sprite at the mouse position and hide the windows cursor. If you do have a cursor you usually don't want the camera to spin / anything else to change while moving it; oftentimes you hold the right mouse button or something to rotate the camera then in which case you'd store away the last mouse position, position the "actual" mouse in the middle of the screen and go ahead as usual until the mouse button is released and then re-position the cursor at the previously stored position.


"Why do programmers get Halloween and Christmas mixed up?"
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 15th Jul 2012 02:35
Correct. It would have been easy to put in a condition to stop the mouse functions if off rect. I liked it the way it was.

The fastest code is the code never written.
Mistrel
Retired Moderator
18
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 15th Jul 2012 04:29 Edited at: 15th Jul 2012 04:30
I think I misread this:

Quote: "dbMouseMoveX/Y() stop working at the edges of the screen"


In DarkGDK 2.0 these commands SHOULD work beyond the edges of the screen; even across multiple monitors. It was dbMouseX/Y() which did not work in this scenario in 1.0 and do work beyond the screen edge in 2.0.

To clarify, I misinterpreted your original post. Is dbMouseMoveX/Y() not working beyond the screen edge? It seems to work just fine here. Please post example source to reproduce this problem.

Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 15th Jul 2012 04:34
I didn't try to use it in a windowed form. I'm sure it's working fine for those apps. When I get to the edge of my actual screen, it stops giving me data.

The fastest code is the code never written.
Mistrel
Retired Moderator
18
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 15th Jul 2012 04:40
Example code, please.

Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 15th Jul 2012 05:58

This should illustrate what I am talking about. Of course, you will have to set up the headers, but I know that will be a problem for you.

I have a work-around for this issue, but it would have been nice not to have to work around the problem. Apparently this "feature" was done for people using windowed apps. I just wish it was a switch like setting a bool instead of completely changing it.

The fastest code is the code never written.

Login to post a reply

Server time is: 2024-03-29 00:00:06
Your offset time is: 2024-03-29 00:00:06