Input: 90% of max analog value while analog sticks setup.

This commit is contained in:
sorgelig
2019-03-24 11:27:03 +08:00
parent 0d35f66a81
commit d02deb0e39
2 changed files with 21 additions and 19 deletions

View File

@@ -187,21 +187,21 @@ void LoadFont(char* name)
for (int pos = start; pos < sz; pos += 8)
{
int n = 0;
for (int i = 128; i != 0; i >>= 1)
{
unsigned char b = 0;
if (tempfont[pos + 0] & i) b |= 1;
if (tempfont[pos + 1] & i) b |= 2;
if (tempfont[pos + 2] & i) b |= 4;
if (tempfont[pos + 3] & i) b |= 8;
if (tempfont[pos + 4] & i) b |= 16;
if (tempfont[pos + 5] & i) b |= 32;
if (tempfont[pos + 6] & i) b |= 64;
if (tempfont[pos + 7] & i) b |= 128;
charfont[ch][n++] = b;
}
ch++;
for (int i = 128; i != 0; i >>= 1)
{
unsigned char b = 0;
if (tempfont[pos + 0] & i) b |= 1;
if (tempfont[pos + 1] & i) b |= 2;
if (tempfont[pos + 2] & i) b |= 4;
if (tempfont[pos + 3] & i) b |= 8;
if (tempfont[pos + 4] & i) b |= 16;
if (tempfont[pos + 5] & i) b |= 32;
if (tempfont[pos + 6] & i) b |= 64;
if (tempfont[pos + 7] & i) b |= 128;
charfont[ch][n++] = b;
}
ch++;
}
}

View File

@@ -1686,9 +1686,11 @@ static void input_cb(struct input_event *ev, struct input_absinfo *absinfo, int
if (ev->type == EV_ABS)
{
max = (ev->value == absinfo->maximum);
min = (ev->value == absinfo->minimum);
printf("min=%d,max=%d\n", min, max);
int threshold = (absinfo->maximum - absinfo->minimum) / 10;
max = (ev->value >= (absinfo->maximum - threshold));
min = (ev->value <= (absinfo->minimum + threshold));
printf("threshold=%d, min=%d, max=%d\n", threshold, min, max);
}
//check DPAD horz