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;
|
2022-01-07 19:46:50 -05:00
|
|
|
uxn_eval(d->u, GETVECTOR(d));
|
2021-12-27 00:02:24 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
2022-01-07 19:46:50 -05:00
|
|
|
uxn_eval(d->u, GETVECTOR(d));
|
2021-12-27 00:02:24 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
{
|
2022-01-03 16:23:57 -05:00
|
|
|
DEVPOKE16(0x2, x);
|
|
|
|
DEVPOKE16(0x4, y);
|
2022-01-07 19:46:50 -05:00
|
|
|
uxn_eval(d->u, GETVECTOR(d));
|
2021-12-27 00:02:24 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2021-12-28 14:21:56 -05:00
|
|
|
mouse_scroll(Device *d, Uint16 x, Uint16 y)
|
2021-12-27 00:02:24 -05:00
|
|
|
{
|
2022-01-03 16:23:57 -05:00
|
|
|
DEVPOKE16(0xa, x);
|
|
|
|
DEVPOKE16(0xc, -y);
|
2022-01-07 19:46:50 -05:00
|
|
|
uxn_eval(d->u, GETVECTOR(d));
|
2022-01-03 16:23:57 -05:00
|
|
|
DEVPOKE16(0xa, 0);
|
|
|
|
DEVPOKE16(0xc, 0);
|
2021-12-29 12:58:31 -05:00
|
|
|
}
|