Browse Source

sys/windows: add a couple of procedures and types

hikari 3 years ago
parent
commit
0ad448f1c7
3 changed files with 8 additions and 1 deletions
  1. 1 1
      core/image/common.odin
  2. 5 0
      core/sys/windows/gdi32.odin
  3. 2 0
      core/sys/windows/types.odin

+ 1 - 1
core/image/common.odin

@@ -1131,4 +1131,4 @@ write_bytes :: proc(buf: ^bytes.Buffer, data: []u8) -> (err: compress.General_Er
 		return compress.General_Error.Resize_Failed
 	}
 	return nil
-}
+}

+ 5 - 0
core/sys/windows/gdi32.odin

@@ -62,5 +62,10 @@ foreign gdi32 {
 	ChoosePixelFormat :: proc(hdc: HDC, ppfd: ^PIXELFORMATDESCRIPTOR) -> c_int ---
 	SwapBuffers :: proc(HDC) -> BOOL ---
 
+	SetDCBrushColor :: proc(hdc: HDC, color: COLORREF) -> COLORREF ---
 	PatBlt :: proc(hdc: HDC, x, y, w, h: c_int, rop: DWORD) -> BOOL ---
 }
+
+RGB :: proc(r, g, b: u8) -> COLORREF {
+	return COLORREF(COLORREF(r) | COLORREF(g) << 8 | COLORREF(b) << 16)
+}

+ 2 - 0
core/sys/windows/types.odin

@@ -55,6 +55,8 @@ UINT_PTR :: uintptr
 ULONG :: c_ulong
 UCHAR :: BYTE
 NTSTATUS :: c.long
+COLORREF :: DWORD
+LPCOLORREF :: ^COLORREF
 LPARAM :: LONG_PTR
 WPARAM :: UINT_PTR
 LRESULT :: LONG_PTR