MCPcopy Create free account
hub / github.com/BlitterStudio/amiberry / joymousecounter

Function joymousecounter

src/inputdevice.cpp:3623–3664  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3621}
3622
3623static void joymousecounter (int joy)
3624{
3625 int left = 1, right = 1, top = 1, bot = 1;
3626 int b9, b8, b1, b0;
3627 int cntx, cnty, ocntx, ocnty;
3628
3629 if (joydir[joy] & DIR_LEFT)
3630 left = 0;
3631 if (joydir[joy] & DIR_RIGHT)
3632 right = 0;
3633 if (joydir[joy] & DIR_UP)
3634 top = 0;
3635 if (joydir[joy] & DIR_DOWN)
3636 bot = 0;
3637
3638 b0 = (bot ^ right) ? 1 : 0;
3639 b1 = (right ^ 1) ? 2 : 0;
3640 b8 = (top ^ left) ? 1 : 0;
3641 b9 = (left ^ 1) ? 2 : 0;
3642
3643 cntx = b0 | b1;
3644 cnty = b8 | b9;
3645 ocntx = mouse_x[joy] & 3;
3646 ocnty = mouse_y[joy] & 3;
3647
3648 if (cntx == 3 && ocntx == 0)
3649 mouse_x[joy] -= 4;
3650 else if (cntx == 0 && ocntx == 3)
3651 mouse_x[joy] += 4;
3652 mouse_x[joy] = (mouse_x[joy] & 0xfc) | cntx;
3653
3654 if (cnty == 3 && ocnty == 0)
3655 mouse_y[joy] -= 4;
3656 else if (cnty == 0 && ocnty == 3)
3657 mouse_y[joy] += 4;
3658 mouse_y[joy] = (mouse_y[joy] & 0xfc) | cnty;
3659
3660 if (!left || !right || !top || !bot) {
3661 mouse_frame_x[joy] = mouse_x[joy];
3662 mouse_frame_y[joy] = mouse_y[joy];
3663 }
3664}
3665
3666static int inputread;
3667

Callers 1

handle_input_event2Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected