sys/windows: add several procedures and macros

This commit is contained in:
hikari
2022-04-02 08:23:12 +03:00
parent 850d4a1e1b
commit 4c14e92952
2 changed files with 38 additions and 2 deletions
+21 -2
View File
@@ -131,6 +131,9 @@ foreign user32 {
GetKeyState :: proc(nVirtKey: c_int) -> SHORT ---
GetAsyncKeyState :: proc(vKey: c_int) -> SHORT ---
MapVirtualKeyA :: proc(uCode: UINT, uMapType: UINT) -> UINT ---
MapVirtualKeyW :: proc(uCode: UINT, uMapType: UINT) -> UINT ---
SetWindowsHookExA :: proc(idHook: c_int, lpfn: HOOKPROC, hmod: HINSTANCE, dwThreadId: DWORD) -> HHOOK ---
SetWindowsHookExW :: proc(idHook: c_int, lpfn: HOOKPROC, hmod: HINSTANCE, dwThreadId: DWORD) -> HHOOK ---
UnhookWindowsHookEx :: proc(hhk: HHOOK) -> BOOL ---
@@ -228,6 +231,22 @@ when ODIN_ARCH == .amd64 {
SetWindowLongPtrW :: GetWindowLongW
}
GET_SC_WPARAM :: #force_inline proc(wparam: WPARAM) -> i32 {
return i32(wparam) & 0xFFF0
GET_SC_WPARAM :: #force_inline proc "contextless" (wParam: WPARAM) -> c_int {
return c_int(wParam) & 0xFFF0
}
GET_WHEEL_DELTA_WPARAM :: #force_inline proc "contextless" (wParam: WPARAM) -> c_short {
return cast(c_short)HIWORD(cast(DWORD)wParam)
}
GET_KEYSTATE_WPARAM :: #force_inline proc "contextless" (wParam: WPARAM) -> WORD {
return LOWORD(cast(DWORD)wParam)
}
GET_NCHITTEST_WPARAM :: #force_inline proc "contextless" (wParam: WPARAM) -> c_short {
return cast(c_short)LOWORD(cast(DWORD)wParam)
}
GET_XBUTTON_WPARAM :: #force_inline proc "contextless" (wParam: WPARAM) -> WORD {
return HIWORD(cast(DWORD)wParam)
}