need help writing mouse x&y axis to FP/vjoy code

Official forum for open source FreePIE discussion and development.
Post Reply
silver237
One Eyed Hopeful
Posts: 3
Joined: Tue Aug 04, 2015 5:59 pm

need help writing mouse x&y axis to FP/vjoy code

Post by silver237 »

I needed someone to write a free PIE code to transpose the mouse X & Y axis movement to the vjoy X&Y analog axis.

I will need the following functions added:

-Separate adjustable mouse sensitivity for both axis

-adjustable deadzone

-autocentering once the mouse stops moving

(I'm running win7)
I do not need the mouse buttons...only mouse movement coded. If this work takes some time...I am willing to pay for services if need be.

Thanks in advance,
Chris

CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: need help writing mouse x&y axis to FP/vjoy code

Post by CyberVillain »

We only have delta mouse movement so you need to convert this to aboslute cordinates. Then you need to have some logic that detects that the mouse stoped movign for a ceratin period for example doing filters.stopWatch(mouse.deltaX == 0 and mouse.deltaX == 0, 500)

silver237
One Eyed Hopeful
Posts: 3
Joined: Tue Aug 04, 2015 5:59 pm

Re: need help writing mouse x&y axis to FP/vjoy code

Post by silver237 »

thanks for the response, but i have NO idea how to code.... also I dont know what Delta mouse movement means exactly. I'm assuming your response is refering to the autocentering part of what i needed, since all the other functions I've listed are seen working in other codes.

Is this something you would be able to code/write for me? ...or know who could?

...like I said, I CAN pay for services, I have NO problem w that. Im sure what your talking about would take time.

CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: need help writing mouse x&y axis to FP/vjoy code

Post by CyberVillain »

Heres a start

Code: Select all

if starting:
	x = 0
	y = 0
	ratioX = 100
	ratioY = 100
	recenterTimeout = 500
		
	
	
x = x + mouse.deltaX * ratioX
y = y + mouse.deltaY * ratioY

vJoy[0].x = x
vJoy[0].y = y

if filters.stopWatch(mouse.deltaX == 0 and mouse.deltaX == 0, recenterTimeout):
	x = 0
	y = 0

silver237
One Eyed Hopeful
Posts: 3
Joined: Tue Aug 04, 2015 5:59 pm

Re: need help writing mouse x&y axis to FP/vjoy code

Post by silver237 »

!! I dont have words for this... you made my weekend !! Thank you!!

Now I did try changing the values of the ratio & recenterTimeout...that works well....but, does changing the x = 0 or y = 0 do anything? I tried, but nothing seems to be diffrerent, no matter how slow/fast i move the mouse.

Would you also be able to add an adjustable deadzone line in this code?

Post Reply

Return to “FreePIE”