2021-12-27 00:02:24 -05:00
|
|
|
#include "../uxn.h"
|
|
|
|
#include "mouse.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
Copyright (c) 2021 Devine Lu Linvega
|
|
|
|
Copyright (c) 2021 Andrew Alderwick
|
|
|
|
|
|
|
|
Permission to use, copy, modify, and distribute this software for any
|
|
|
|
purpose with or without fee is hereby granted, provided that the above
|
|
|
|
copyright notice and this permission notice appear in all copies.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
WITH REGARD TO THIS SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void
|
2021-12-28 13:45:34 -05:00
|
|
|
mouse_down(Device *d, Uint8 mask)
|
2021-12-27 00:02:24 -05:00
|
|
|
{
|
2021-12-28 13:45:34 -05:00
|
|
|
d->dat[6] |= mask;
|
2021-12-27 00:02:24 -05:00
|
|
|
uxn_eval(d->u, d->vector);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2021-12-28 13:45:34 -05:00
|
|
|
mouse_up(Device *d, Uint8 mask)
|
2021-12-27 00:02:24 -05:00
|
|
|
{
|
2021-12-28 13:45:34 -05:00
|
|
|
d->dat[6] &= (~mask);
|
2021-12-27 00:02:24 -05:00
|
|
|
uxn_eval(d->u, d->vector);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2021-12-28 13:45:34 -05:00
|
|
|
mouse_pos(Device *d, Uint16 x, Uint16 y)
|
2021-12-27 00:02:24 -05:00
|
|
|
{
|
2021-12-28 13:45:34 -05:00
|
|
|
poke16(d->dat, 0x2, x);
|
|
|
|
poke16(d->dat, 0x4, y);
|
2021-12-27 00:02:24 -05:00
|
|
|
uxn_eval(d->u, d->vector);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2021-12-28 13:45:34 -05:00
|
|
|
mouse_mod(Device *d, Uint16 x, Uint16 y)
|
2021-12-27 00:02:24 -05:00
|
|
|
{
|
2021-12-28 13:45:34 -05:00
|
|
|
poke16(d->dat, 0xa, x);
|
|
|
|
poke16(d->dat, 0xc, y);
|
2021-12-27 00:02:24 -05:00
|
|
|
uxn_eval(d->u, d->vector);
|
2021-12-28 13:45:34 -05:00
|
|
|
poke16(d->dat, 0xa, 0);
|
|
|
|
poke16(d->dat, 0xc, 0);
|
2021-12-27 00:02:24 -05:00
|
|
|
}
|