fix coin key handling

This commit is contained in:
akiroz 2022-01-27 04:08:27 +08:00
parent 7163f51d29
commit 9af7b8abd8
No known key found for this signature in database
GPG Key ID: 8A5957C4A2F68ACC

View File

@ -164,15 +164,14 @@ export fn chuni_io_jvs_poll(opbtn: ?[*]u8, beams: ?[*]u8) void {
beams.?.* |= usb_in[3] & 0b111111;
}
var coin_depressed = false;
var coin_conter: c_ushort = 0;
var coin_prev_depressed = false;
export fn chuni_io_jvs_read_coin_counter(total: ?*c_ushort) void {
if(total == null) return;
if(GetAsyncKeyState(cfg.?.coin_key) == 0) {
coin_depressed = false;
} else if(!coin_depressed) {
coin_depressed = true;
total.?.* += 1;
}
const coin_depressed = GetAsyncKeyState(cfg.?.coin_key) != 0;
if(coin_depressed and !coin_prev_depressed) coin_conter += 1;
coin_prev_depressed = coin_depressed;
total.?.* = coin_conter;
}
export fn chuni_io_slider_init() HRESULT {