34 lines
622 B
C
34 lines
622 B
C
/*
|
|
* Released into the public domain
|
|
* by Aki Goto <tyatsumi@gmail.com>
|
|
*/
|
|
|
|
#include "pointer.h"
|
|
|
|
void Pointer_initialize(struct Pointer *this)
|
|
{
|
|
this->xNumber = 0;
|
|
this->yNumber = 1;
|
|
this->vx = 0;
|
|
this->vy = 0;
|
|
this->charge = 0;
|
|
this->leftNumber = 0;
|
|
this->centerNumber = 1;
|
|
this->rightNumber = 3;
|
|
this->wheelNumber = 2;
|
|
this->wheelMode = 0;
|
|
}
|
|
|
|
void Pointer_update(struct Pointer *this, struct js_event *event)
|
|
{
|
|
if (event->type != JS_EVENT_AXIS) {
|
|
return;
|
|
}
|
|
|
|
if (event->number == this->xNumber) {
|
|
this->vx = event->value;
|
|
} else if (event->number == this->yNumber) {
|
|
this->vy = event->value;
|
|
}
|
|
}
|