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

Function getvelocity

src/inputdevice.cpp:3410–3435  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3408static int pc_mouse_buttons[MAX_JPORTS];
3409
3410static int getvelocity (int num, int subnum, int pct)
3411{
3412 if (pct > 1000)
3413 pct = 1000;
3414 if (pct < 0) {
3415 pct = 0;
3416 }
3417 int val = mouse_delta[num][subnum];
3418 int v = val * pct / 1000;
3419 if (!v) {
3420 if (val < -maxvpos / 2)
3421 v = -2;
3422 else if (val < 0)
3423 v = -1;
3424 else if (val > maxvpos / 2)
3425 v = 2;
3426 else if (val > 0)
3427 v = 1;
3428 }
3429 if (!mouse_deltanoreset[num][subnum]) {
3430 mouse_delta[num][subnum] -= v;
3431 //gui_gameport_axis_change (num, subnum * 2 + 0, 0, -1);
3432 //gui_gameport_axis_change (num, subnum * 2 + 1, 0, -1);
3433 }
3434 return v;
3435}
3436
3437#define MOUSEXY_MAX 16384
3438

Callers 1

inputdevice.cppFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected