2021-12-27 12:24:43 -05:00
|
|
|
#include "../uxn.h"
|
|
|
|
#include "controller.h"
|
|
|
|
|
|
|
|
/*
|
2023-01-02 09:40:23 -05:00
|
|
|
Copyright (c) 2021-2023 Devine Lu Linvega, Andrew Alderwick
|
2021-12-27 12:24:43 -05:00
|
|
|
|
|
|
|
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
|
2023-01-01 14:37:34 -05:00
|
|
|
controller_down(Uxn *u, Uint8 *d, Uint8 mask)
|
2021-12-27 12:24:43 -05:00
|
|
|
{
|
2021-12-27 16:37:37 -05:00
|
|
|
if(mask) {
|
2023-01-01 14:37:34 -05:00
|
|
|
d[2] |= mask;
|
|
|
|
uxn_eval(u, GETVEC(d));
|
2021-12-27 16:37:37 -05:00
|
|
|
}
|
2021-12-27 12:24:43 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2023-01-01 14:37:34 -05:00
|
|
|
controller_up(Uxn *u, Uint8 *d, Uint8 mask)
|
2021-12-27 12:24:43 -05:00
|
|
|
{
|
2021-12-27 16:37:37 -05:00
|
|
|
if(mask) {
|
2023-01-01 14:37:34 -05:00
|
|
|
d[2] &= (~mask);
|
|
|
|
uxn_eval(u, GETVEC(d));
|
2021-12-27 16:37:37 -05:00
|
|
|
}
|
2021-12-27 12:24:43 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2023-01-01 14:37:34 -05:00
|
|
|
controller_key(Uxn *u, Uint8 *d, Uint8 key)
|
2021-12-27 12:24:43 -05:00
|
|
|
{
|
2021-12-27 16:37:37 -05:00
|
|
|
if(key) {
|
2023-01-01 14:37:34 -05:00
|
|
|
d[3] = key;
|
|
|
|
uxn_eval(u, GETVEC(d));
|
|
|
|
d[3] = 0x00;
|
2022-01-07 13:55:09 -05:00
|
|
|
}
|
2022-01-07 17:46:39 -05:00
|
|
|
}
|