2021-12-27 05:02:24 +00: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 18:45:34 +00:00
|
|
|
mouse_down(Device *d, Uint8 mask)
|
2021-12-27 05:02:24 +00:00
|
|
|
{
|
2021-12-28 18:45:34 +00:00
|
|
|
d->dat[6] |= mask;
|
2022-01-08 00:46:50 +00:00
|
|
|
uxn_eval(d->u, GETVECTOR(d));
|
2021-12-27 05:02:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2021-12-28 18:45:34 +00:00
|
|
|
mouse_up(Device *d, Uint8 mask)
|
2021-12-27 05:02:24 +00:00
|
|
|
{
|
2021-12-28 18:45:34 +00:00
|
|
|
d->dat[6] &= (~mask);
|
2022-01-08 00:46:50 +00:00
|
|
|
uxn_eval(d->u, GETVECTOR(d));
|
2021-12-27 05:02:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2021-12-28 18:45:34 +00:00
|
|
|
mouse_pos(Device *d, Uint16 x, Uint16 y)
|
2021-12-27 05:02:24 +00:00
|
|
|
{
|
2022-01-03 21:23:57 +00:00
|
|
|
DEVPOKE16(0x2, x);
|
|
|
|
DEVPOKE16(0x4, y);
|
2022-01-08 00:46:50 +00:00
|
|
|
uxn_eval(d->u, GETVECTOR(d));
|
2021-12-27 05:02:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2021-12-28 19:21:56 +00:00
|
|
|
mouse_scroll(Device *d, Uint16 x, Uint16 y)
|
2021-12-27 05:02:24 +00:00
|
|
|
{
|
2022-01-03 21:23:57 +00:00
|
|
|
DEVPOKE16(0xa, x);
|
|
|
|
DEVPOKE16(0xc, -y);
|
2022-01-08 00:46:50 +00:00
|
|
|
uxn_eval(d->u, GETVECTOR(d));
|
2022-01-03 21:23:57 +00:00
|
|
|
DEVPOKE16(0xa, 0);
|
|
|
|
DEVPOKE16(0xc, 0);
|
2021-12-29 17:58:31 +00:00
|
|
|
}
|