fix coin key handling
This commit is contained in:
parent
7163f51d29
commit
9af7b8abd8
13
src/main.zig
13
src/main.zig
@ -164,15 +164,14 @@ export fn chuni_io_jvs_poll(opbtn: ?[*]u8, beams: ?[*]u8) void {
|
|||||||
beams.?.* |= usb_in[3] & 0b111111;
|
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 {
|
export fn chuni_io_jvs_read_coin_counter(total: ?*c_ushort) void {
|
||||||
if(total == null) return;
|
if(total == null) return;
|
||||||
if(GetAsyncKeyState(cfg.?.coin_key) == 0) {
|
const coin_depressed = GetAsyncKeyState(cfg.?.coin_key) != 0;
|
||||||
coin_depressed = false;
|
if(coin_depressed and !coin_prev_depressed) coin_conter += 1;
|
||||||
} else if(!coin_depressed) {
|
coin_prev_depressed = coin_depressed;
|
||||||
coin_depressed = true;
|
total.?.* = coin_conter;
|
||||||
total.?.* += 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export fn chuni_io_slider_init() HRESULT {
|
export fn chuni_io_slider_init() HRESULT {
|
||||||
|
Loading…
Reference in New Issue
Block a user