Click here to Skip to main content
15,868,016 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hey, i'm trying to to make my mouse do a 360 movement within a game using mouse input only, is this possible?

What I have tried:

I am currently using these functions to control the mouse:
C++
void cMouseInput::MouseSetup(INPUT* InputBuffer)
{
	InputBuffer->type = INPUT_MOUSE;
	InputBuffer->mi.dx = (0 * (0xFFFF / SCREEN_WIDTH));
	InputBuffer->mi.dy = (0 * (0xFFFF / SCREEN_HEIGHT));
	InputBuffer->mi.mouseData = 0;
	InputBuffer->mi.dwFlags = MOUSEEVENTF_ABSOLUTE;
	InputBuffer->mi.time = 0;
	InputBuffer->mi.dwExtraInfo = 0;
}

void cMouseInput::MoveMouse(INPUT* InputBuffer, int X, int Y)
{
	InputBuffer->mi.dx = (X * (0xFFFF / SCREEN_WIDTH));
	InputBuffer->mi.dy = (Y * (0xFFFF / SCREEN_HEIGHT));
	InputBuffer->mi.dwFlags = (MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE);

	SendInput(1, InputBuffer, sizeof(INPUT));
}

And I am using them like this:
C++
cMouseInput M;
M.MouseSetup(&M.InputBuffer);
M.MoveMouse(&M.InputBuffer, POS_X, POS_Y);

This is not working because,
1. Too fast, I would have to find a way to smooth this down a notch.
2. I can't get it to perform a full spin.
3. It only moves the cursor to a specific x-y coordinate on screen. Is there no way to just make the mouse do a simulated right movement..? Like MoveRight(200px); -> move mouse cursor 200 pixels to the right. (As an example)
Posted
Updated 16-May-18 15:01pm
v3
Comments
Rick York 16-May-18 21:07pm    
It seems to me, and I could be wrong, that this falls under the category of gesture interpretation so have a look at code for that. There is bound to be a lot because that stuff is used in a lot of places. There is likely some at this site too. I would add links but you can search as well as I can.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900