From c4a7739d13d386743a53ebe3371e8061310ea2cb Mon Sep 17 00:00:00 2001 From: hikari Date: Thu, 7 Apr 2022 19:28:24 +0300 Subject: [PATCH] sys/windows: add a couple macros --- core/sys/windows/util.odin | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/sys/windows/util.odin b/core/sys/windows/util.odin index d464007d3..f448f6bc5 100644 --- a/core/sys/windows/util.odin +++ b/core/sys/windows/util.odin @@ -15,6 +15,14 @@ HIWORD :: #force_inline proc "contextless" (x: DWORD) -> WORD { return WORD(x >> 16) } +GET_X_LPARAM :: #force_inline proc "contextless" (lp: LPARAM) -> c_int { + return cast(c_int)cast(c_short)LOWORD(cast(DWORD)lp) +} + +GET_Y_LPARAM :: #force_inline proc "contextless" (lp: LPARAM) -> c_int { + return cast(c_int)cast(c_short)HIWORD(cast(DWORD)lp) +} + utf8_to_utf16 :: proc(s: string, allocator := context.temp_allocator) -> []u16 { if len(s) < 1 { return nil