Merge pull request #603 from joesycalik/win32-updates

Added to core:sys win32 package
This commit is contained in:
Mikkel Hjortshøj
2020-04-04 15:51:34 +02:00
committed by GitHub
3 changed files with 43 additions and 1 deletions

View File

@@ -3,6 +3,8 @@ package win32
foreign import "system:gdi32.lib"
WHITENESS :: 0x00FF0062;
BLACKNESS :: 0x00000042;
@(default_calling_convention = "std")
foreign gdi32 {
@@ -20,4 +22,5 @@ foreign gdi32 {
@(link_name="ChoosePixelFormat") choose_pixel_format :: proc(hdc: Hdc, pfd: ^Pixel_Format_Descriptor) -> i32 ---;
@(link_name="SwapBuffers") swap_buffers :: proc(hdc: Hdc) -> Bool ---;
@(link_name="PatBlt") pat_blt :: proc(hdc: Hdc, x, y, w, h: i32, rop: u32) -> Bool ---;
}

View File

@@ -35,6 +35,28 @@ Point :: struct {
x, y: i32,
}
Wnd_Class_A :: struct {
style: u32,
wnd_proc: Wnd_Proc,
cls_extra, wnd_extra: i32,
instance: Hinstance,
icon: Hicon,
cursor: Hcursor,
background: Hbrush,
menu_name, class_name: cstring
}
Wnd_Class_W :: struct {
style: u32,
wnd_proc: Wnd_Proc,
cls_extra, wnd_extra: i32,
instance: Hinstance,
icon: Hicon,
cursor: Hcursor,
background: Hbrush,
menu_name, class_name: Wstring
}
Wnd_Class_Ex_A :: struct {
size, style: u32,
wnd_proc: Wnd_Proc,
@@ -532,7 +554,7 @@ WM_CHAR :: 0x0102;
WM_CLOSE :: 0x0010;
WM_CREATE :: 0x0001;
WM_DESTROY :: 0x0002;
WM_INPUT :: 0x00ff;
WM_INPUT :: 0x00FF;
WM_KEYDOWN :: 0x0100;
WM_KEYUP :: 0x0101;
WM_KILLFOCUS :: 0x0008;
@@ -546,6 +568,7 @@ WM_SYSKEYUP :: 0x0105;
WM_USER :: 0x0400;
WM_WINDOWPOSCHANGED :: 0x0047;
WM_COMMAND :: 0x0111;
WM_PAINT :: 0x000F;
WM_MOUSEWHEEL :: 0x020A;
WM_MOUSEMOVE :: 0x0200;
@@ -904,6 +927,15 @@ Bitmap_Info :: struct {
colors: [1]Rgb_Quad,
}
Paint_Struct :: struct {
hdc: Hdc,
erase: Bool,
rc_paint: Rect,
restore: Bool,
inc_update: Bool,
rgb_reserved: [32]byte
}
Rgb_Quad :: struct {blue, green, red, reserved: byte}

View File

@@ -103,6 +103,8 @@ foreign user32 {
@(link_name="PostQuitMessage") post_quit_message :: proc(exit_code: i32) ---;
@(link_name="SetWindowTextA") set_window_text_a :: proc(hwnd: Hwnd, c_string: cstring) -> Bool ---;
@(link_name="SetWindowTextW") set_window_text_w :: proc(hwnd: Hwnd, c_string: Wstring) -> Bool ---;
@(link_name="RegisterClassA") register_class_a :: proc(wc: ^Wnd_Class_A) -> i16 ---;
@(link_name="RegisterClassW") register_class_w :: proc(wc: ^Wnd_Class_W) -> i16 ---;
@(link_name="RegisterClassExA") register_class_ex_a :: proc(wc: ^Wnd_Class_Ex_A) -> i16 ---;
@(link_name="RegisterClassExW") register_class_ex_w :: proc(wc: ^Wnd_Class_Ex_W) -> i16 ---;
@@ -230,9 +232,14 @@ foreign user32 {
@(link_name="GetPropA") get_prop_a :: proc(wnd: Hwnd, s: cstring) -> Handle ---
@(link_name="GetPropW") get_prop_w :: proc(wnd: Hwnd, s: Wstring) -> Handle ---
@(link_name="MessageBoxA") message_box_a :: proc(wnd: Hwnd, text, caption: cstring, type: u32) -> i32 ---
@(link_name="MessageBoxW") message_box_w :: proc(wnd: Hwnd, text, caption: Wstring, type: u32) -> i32 ---
@(link_name="MessageBoxExA") message_box_ex_a :: proc(wnd: Hwnd, text, caption: cstring, type: u32, language_id: u16) -> i32 ---
@(link_name="MessageBoxExW") message_box_ex_w :: proc(wnd: Hwnd, text, caption: Wstring, type: u32, language_id: u16) -> i32 ---
@(link_name="BeginPaint") begin_paint :: proc(wnd: Hwnd, paint: ^Paint_Struct) -> Hdc ---
@(link_name="EndPaint") end_paint :: proc(wnd: Hwnd, paint: ^Paint_Struct) -> Bool ---
}