mirror of
https://github.com/dschmenk/apple2pi.git
synced 2024-11-24 12:31:30 +00:00
Only update position when it changes
This commit is contained in:
parent
95354ab2ee
commit
e9627710c7
17
src/a2joy.c
17
src/a2joy.c
@ -141,17 +141,24 @@ void main(int argc, char **argv)
|
|||||||
while (!stop)
|
while (!stop)
|
||||||
{
|
{
|
||||||
if (gptoggle)
|
if (gptoggle)
|
||||||
|
{
|
||||||
a2quickcall(pifd, READGP0, &absx);
|
a2quickcall(pifd, READGP0, &absx);
|
||||||
else
|
if (evabsx.value != absx || evabsy.value != absy)
|
||||||
a2quickcall(pifd, READGP1, &absy);
|
{
|
||||||
a2read(pifd, BTTN_IO, 2, bttns);
|
|
||||||
gptoggle ^= 1;
|
|
||||||
if (isdebug) fprintf(stderr, "a2joy (%d, %d) [%d %d]\n", absx, absy, bttns[0] >> 7, bttns[1] >> 7);
|
|
||||||
evabsx.value = absx;
|
evabsx.value = absx;
|
||||||
evabsy.value = absy;
|
evabsy.value = absy;
|
||||||
write(joyfd, &evabsx, sizeof(evabsx));
|
write(joyfd, &evabsx, sizeof(evabsx));
|
||||||
write(joyfd, &evabsy, sizeof(evabsy));
|
write(joyfd, &evabsy, sizeof(evabsy));
|
||||||
write(joyfd, &evsync, sizeof(evsync));
|
write(joyfd, &evsync, sizeof(evsync));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
a2quickcall(pifd, READGP1, &absy);
|
||||||
|
}
|
||||||
|
gptoggle ^= 1;
|
||||||
|
a2read(pifd, BTTN_IO, 2, bttns);
|
||||||
|
if (isdebug) fprintf(stderr, "a2joy (%d, %d) [%d %d]\n", absx, absy, bttns[0] >> 7, bttns[1] >> 7);
|
||||||
if ((bttns[0] & 0x80) != prevbttns[0])
|
if ((bttns[0] & 0x80) != prevbttns[0])
|
||||||
{
|
{
|
||||||
prevbttns[0] = bttns[0] & 0x80;
|
prevbttns[0] = bttns[0] & 0x80;
|
||||||
|
Loading…
Reference in New Issue
Block a user