controller.c (770B)
1 #include "../uxn.h" 2 #include "controller.h" 3 4 /* 5 Copyright (c) 2021-2023 Devine Lu Linvega, Andrew Alderwick 6 7 Permission to use, copy, modify, and distribute this software for any 8 purpose with or without fee is hereby granted, provided that the above 9 copyright notice and this permission notice appear in all copies. 10 11 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 12 WITH REGARD TO THIS SOFTWARE. 13 */ 14 15 void 16 controller_down(Uxn *u, Uint8 *d, Uint8 mask) 17 { 18 if(mask) { 19 d[2] |= mask; 20 uxn_eval(u, PEEK2(d)); 21 } 22 } 23 24 void 25 controller_up(Uxn *u, Uint8 *d, Uint8 mask) 26 { 27 if(mask) { 28 d[2] &= (~mask); 29 uxn_eval(u, PEEK2(d)); 30 } 31 } 32 33 void 34 controller_key(Uxn *u, Uint8 *d, Uint8 key) 35 { 36 if(key) { 37 d[3] = key; 38 uxn_eval(u, PEEK2(d)); 39 d[3] = 0x00; 40 } 41 }