mirror of
https://github.com/dschmenk/apple2pi.git
synced 2024-06-13 12:29:51 +00:00
Better joystick mouse acceleration
This commit is contained in:
parent
6c813637fd
commit
75386bb3a2
|
@ -138,6 +138,7 @@ void main(int argc, char **argv)
|
||||||
if (gptoggle)
|
if (gptoggle)
|
||||||
{
|
{
|
||||||
a2quickcall(pifd, READGP0, &relx);
|
a2quickcall(pifd, READGP0, &relx);
|
||||||
|
#if 0
|
||||||
if (relx >= cntrx + 20)
|
if (relx >= cntrx + 20)
|
||||||
evrelx.value = (relx - cntrx) / 2;
|
evrelx.value = (relx - cntrx) / 2;
|
||||||
else if (relx >= cntrx)
|
else if (relx >= cntrx)
|
||||||
|
@ -146,6 +147,13 @@ void main(int argc, char **argv)
|
||||||
evrelx.value = (relx - cntrx) / 2;
|
evrelx.value = (relx - cntrx) / 2;
|
||||||
else
|
else
|
||||||
evrelx.value = -accel[cntrx - relx];
|
evrelx.value = -accel[cntrx - relx];
|
||||||
|
#else
|
||||||
|
evrelx.value = (relx - cntrx) / 12;
|
||||||
|
if (evrelx.value < 0)
|
||||||
|
evrelx.value *= -evrelx.value;
|
||||||
|
else
|
||||||
|
evrelx.value *= evrelx.value;
|
||||||
|
#endif
|
||||||
write(joyfd, &evrelx, sizeof(evrelx));
|
write(joyfd, &evrelx, sizeof(evrelx));
|
||||||
write(joyfd, &evrely, sizeof(evrely));
|
write(joyfd, &evrely, sizeof(evrely));
|
||||||
write(joyfd, &evsync, sizeof(evsync));
|
write(joyfd, &evsync, sizeof(evsync));
|
||||||
|
@ -154,6 +162,7 @@ void main(int argc, char **argv)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
a2quickcall(pifd, READGP1, &rely);
|
a2quickcall(pifd, READGP1, &rely);
|
||||||
|
#if 0
|
||||||
if (rely >= cntry + 20)
|
if (rely >= cntry + 20)
|
||||||
evrely.value = (rely - cntry) / 2;
|
evrely.value = (rely - cntry) / 2;
|
||||||
else if (rely >= cntry)
|
else if (rely >= cntry)
|
||||||
|
@ -162,7 +171,14 @@ void main(int argc, char **argv)
|
||||||
evrely.value = (rely - cntry) / 2;
|
evrely.value = (rely - cntry) / 2;
|
||||||
else
|
else
|
||||||
evrely.value = -accel[cntry - rely];
|
evrely.value = -accel[cntry - rely];
|
||||||
}
|
#else
|
||||||
|
evrely.value = (rely - cntry) / 12;
|
||||||
|
if (evrely.value < 0)
|
||||||
|
evrely.value *= -evrely.value;
|
||||||
|
else
|
||||||
|
evrely.value *= evrely.value;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
gptoggle ^= 1;
|
gptoggle ^= 1;
|
||||||
a2read(pifd, BTTN_IO, 2, bttns);
|
a2read(pifd, BTTN_IO, 2, bttns);
|
||||||
if ((bttns[0] & 0x80) != prevbttns[0])
|
if ((bttns[0] & 0x80) != prevbttns[0])
|
||||||
|
|
Loading…
Reference in New Issue
Block a user