I created a function handler for the mouse motion. It simply takes the x and y parameters and update the coordinates of a 3D object according to them.
It runs well, except when I move the mouse too far in the bottom of the screen. Doing this cause the mouse to stop responding unless I go up enough again.
This bug reminds me of problems when running a windowed program, but mine runs in fullscreen…
Well i am searhing something that you are searhing… :)) i think…
Like q3 when you move the mouse anywhere after a few moves the vision of player doesn’t stop but when we code this ourself :)) it is stopping. Are you want to move the mouse with unlimited positioning?
if it is and if you learn it please help me too thanks
tip : wm_mousewheel is the starting point i think hým?
static void GetMouseInput(void)
{
POINT Point;
long x;
long y;
GetCursorPos(&Point);
x = Point.x;
y = Point.y;
dx = ((float) (((float)nScreenWidth/2.0f) - Point.x)); // how far moved x
dy = ((float) (((float)nScreenHeight/2.0f) - Point.y)); // how fa moved y
SetCursorPos(nScreenWidth/2, nScreenHeight/2);
}
as you can see this sets the mouse pointer to center screen upon init
then in your loop is checks how far the mouse has moved records it in dx and dy
then resets the mouse to center screen again for the next pass.
this way your mouse can always move as it never reaches the end or bottom of screen.
It shouldnt be a problem to use the same routines on any platform. Just replace the function calls with the platform specific functions. I cant tell you what they are under linux but it shouldnt be hard for you to find out.
I have my app scan for keycodes, now this works fine only problem being when the key is hit inside my app i want only my app to accept those key presses. It also works the other way around. If i am running in a window (even if the window is not active) and i hit one of my keys in a text editor my app also picks up the key press and reacts to it. Any ideas on how i can keep my key presses exclusive to my app?
Ill start a new topic on this so dont bother replying here.
Originally posted by MikeC: This is fine for fullscreen, but I’d be very wary of locking the mouse to the centre if you’re ever going to be running in a window!
umm not if you do ShowCursor(FALSE);
btw, first I tried to set the mouse to the center of the screen that didn’t work…
ngill, I’d have thought hiding the mouse only makes matters worse. My point isn’t that having a mouse stuck in the middle of your screen is ugly, my point is that when I’m running an app in windowed mode I expect to be able to use the mouse as usual, to drag or close or resize the window, change focus etc etc.
dans, if you’re doing async keyboard scans directly then I don’t think there’s any way to filter keypresses by app. I’m doing my Win32 keyboard stuff a different way, keeping my own table of key states to answer queries and updating the table when I get key msgs in wndProc. Probably not very efficient but makes cohabitation with other apps a lot easier.
[This message has been edited by MikeC (edited 07-07-2000).]