Skip to content

Commit

Permalink
Create accel.zig
Browse files Browse the repository at this point in the history
  • Loading branch information
user726687 authored Sep 20, 2024
1 parent 9daf9e4 commit b3f17a8
Showing 1 changed file with 84 additions and 0 deletions.
84 changes: 84 additions & 0 deletions src/accel.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
const std = @import("std");
const win = std.os.windows;
const WINAPI = win.WINAPI;
const main = @import("main.zig");
const MSG = main.MSG;

const HACCEL = *opaque {};
const ACCEL = extern struct {
fVirt: u8,
// bPadding: u8 = 0,
key: u16,
cmd: u16,
};

pub extern "user32" fn CreateAcceleratorTableA([*]ACCEL, i32) callconv(WINAPI) ?HACCEL;
pub extern "user32" fn TranslateAcceleratorA(?*const anyopaque, HACCEL, *MSG) callconv(WINAPI) i32;

pub const default = [_]ACCEL{
.{
.fVirt = 0x09,
.key = '0',
.cmd = '0',
},
.{
.fVirt = 0x09,
.key = 0xBB,
.cmd = '+',
},
.{
.fVirt = 0x09,
.key = 0xBD,
.cmd = '-',
},
.{
.fVirt = 0x0D,
.key = 'T',
.cmd = 't',
},
.{
.fVirt = 0x09,
.key = 'L',
.cmd = 'L',
},
.{
.fVirt = 0x09,
.key = 'N',
.cmd = 'N',
},
.{
.fVirt = 0x09,
.key = 'O',
.cmd = 'O',
},
.{
.fVirt = 0x09,
.key = 'R',
.cmd = 'R',
},
.{
.fVirt = 0x09,
.key = 'S',
.cmd = 'S',
},
.{
.fVirt = 0x09,
.key = 'T',
.cmd = 'T',
},
.{
.fVirt = 0x09,
.key = 'K',
.cmd = 'K',
},
.{
.fVirt = 0x09,
.key = 'W',
.cmd = 'W',
},
.{
.fVirt = 0x01,
.key = 0x7A,
.cmd = 0xF11,
},
};

0 comments on commit b3f17a8

Please sign in to comment.