| ... | @@ -1,5 +1,104 @@ | ... | @@ -1,5 +1,104 @@ |
| 1 | usingnamespace @import("bits.zig"); | 1 | usingnamespace @import("bits.zig"); |
| 2 | | 2 | |
| | 3 | // PM |
| | 4 | pub const PM_REMOVE = 0x0001; |
| | 5 | pub const PM_NOREMOVE = 0x0000; |
| | 6 | pub const PM_NOYIELD = 0x0002; |
| | 7 | |
| | 8 | // WM |
| | 9 | pub const WM_NULL = 0x0000; |
| | 10 | pub const WM_CREATE = 0x0001; |
| | 11 | pub const WM_DESTROY = 0x0002; |
| | 12 | pub const WM_MOVE = 0x0003; |
| | 13 | pub const WM_SIZE = 0x0005; |
| | 14 | |
| | 15 | pub const WM_ACTIVATE = 0x0006; |
| | 16 | pub const WM_PAINT = 0x000F; |
| | 17 | pub const WM_CLOSE = 0x0010; |
| | 18 | pub const WM_QUIT = 0x0012; |
| | 19 | pub const WM_SETFOCUS = 0x0007; |
| | 20 | |
| | 21 | pub const WM_KILLFOCUS = 0x0008; |
| | 22 | pub const WM_ENABLE = 0x000A; |
| | 23 | pub const WM_SETREDRAW = 0x000B; |
| | 24 | |
| | 25 | pub const WM_SYSCOLORCHANGE = 0x0015; |
| | 26 | pub const WM_SHOWWINDOW = 0x0018; |
| | 27 | |
| | 28 | pub const WM_WINDOWPOSCHANGING = 0x0046; |
| | 29 | pub const WM_WINDOWPOSCHANGED = 0x0047; |
| | 30 | pub const WM_POWER = 0x0048; |
| | 31 | |
| | 32 | pub const WM_CONTEXTMENU = 0x007B; |
| | 33 | pub const WM_STYLECHANGING = 0x007C; |
| | 34 | pub const WM_STYLECHANGED = 0x007D; |
| | 35 | pub const WM_DISPLAYCHANGE = 0x007E; |
| | 36 | pub const WM_GETICON = 0x007F; |
| | 37 | pub const WM_SETICON = 0x0080; |
| | 38 | |
| | 39 | pub const WM_INPUT_DEVICE_CHANGE = 0x00fe; |
| | 40 | pub const WM_INPUT = 0x00FF; |
| | 41 | pub const WM_KEYFIRST = 0x0100; |
| | 42 | pub const WM_KEYDOWN = 0x0100; |
| | 43 | pub const WM_KEYUP = 0x0101; |
| | 44 | pub const WM_CHAR = 0x0102; |
| | 45 | pub const WM_DEADCHAR = 0x0103; |
| | 46 | pub const WM_SYSKEYDOWN = 0x0104; |
| | 47 | pub const WM_SYSKEYUP = 0x0105; |
| | 48 | pub const WM_SYSCHAR = 0x0106; |
| | 49 | pub const WM_SYSDEADCHAR = 0x0107; |
| | 50 | pub const WM_UNICHAR = 0x0109; |
| | 51 | pub const WM_KEYLAST = 0x0109; |
| | 52 | |
| | 53 | pub const WM_COMMAND = 0x0111; |
| | 54 | pub const WM_SYSCOMMAND = 0x0112; |
| | 55 | pub const WM_TIMER = 0x0113; |
| | 56 | |
| | 57 | pub const WM_MOUSEFIRST = 0x0200; |
| | 58 | pub const WM_MOUSEMOVE = 0x0200; |
| | 59 | pub const WM_LBUTTONDOWN = 0x0201; |
| | 60 | pub const WM_LBUTTONUP = 0x0202; |
| | 61 | pub const WM_LBUTTONDBLCLK = 0x0203; |
| | 62 | pub const WM_RBUTTONDOWN = 0x0204; |
| | 63 | pub const WM_RBUTTONUP = 0x0205; |
| | 64 | pub const WM_RBUTTONDBLCLK = 0x0206; |
| | 65 | pub const WM_MBUTTONDOWN = 0x0207; |
| | 66 | pub const WM_MBUTTONUP = 0x0208; |
| | 67 | pub const WM_MBUTTONDBLCLK = 0x0209; |
| | 68 | pub const WM_MOUSEWHEEL = 0x020A; |
| | 69 | pub const WM_XBUTTONDOWN = 0x020B; |
| | 70 | pub const WM_XBUTTONUP = 0x020C; |
| | 71 | pub const WM_XBUTTONDBLCLK = 0x020D; |
| | 72 | |
| | 73 | // WA |
| | 74 | pub const WA_INACTIVE = 0; |
| | 75 | pub const WA_ACTIVE = 0x0006; |
| | 76 | pub const WM_ACTIVATE = 0x0006; |
| | 77 | |
| | 78 | // WS |
| | 79 | pub const WS_OVERLAPPED = 0x00000000; |
| | 80 | pub const WS_CAPTION = 0x00C00000; |
| | 81 | pub const WS_SYSMENU = 0x00080000; |
| | 82 | pub const WS_THICKFRAME = 0x00040000; |
| | 83 | pub const WS_MINIMIZEBOX = 0x00020000; |
| | 84 | pub const WS_MAXIMIZEBOX = 0x00010000; |
| | 85 | |
| | 86 | // PFD |
| | 87 | pub const PFD_DRAW_TO_WINDOW = 0x00000004; |
| | 88 | pub const PFD_SUPPORT_OPENGL = 0x00000020; |
| | 89 | pub const PFD_DOUBLEBUFFER = 0x00000001; |
| | 90 | pub const PFD_MAIN_PLANE = 0; |
| | 91 | pub const PFD_TYPE_RGBA = 0; |
| | 92 | |
| | 93 | // CS |
| | 94 | pub const CS_HREDRAW = 0x0002; |
| | 95 | pub const CS_VREDRAW = 0x0001; |
| | 96 | pub const CS_OWNDC = 0x0020; |
| | 97 | |
| | 98 | // SW |
| | 99 | pub const SW_HIDE = 0; |
| | 100 | pub const SW_SHOW = 5; |
| | 101 | |
| 3 | pub const WNDPROC = fn (HWND, UINT, WPARAM, LPARAM) callconv(.Stdcall) LRESULT; | 102 | pub const WNDPROC = fn (HWND, UINT, WPARAM, LPARAM) callconv(.Stdcall) LRESULT; |
| 4 | | 103 | |
| 5 | pub const WNDCLASSEXA = extern struct { | 104 | pub const WNDCLASSEXA = extern struct { |
| ... | @@ -17,6 +116,20 @@ pub const WNDCLASSEXA = extern struct { | ... | @@ -17,6 +116,20 @@ pub const WNDCLASSEXA = extern struct { |
| 17 | hIconSm: ?HICON, | 116 | hIconSm: ?HICON, |
| 18 | }; | 117 | }; |
| 19 | | 118 | |
| | 119 | pub const POINT = extern struct { |
| | 120 | x: c_long, y: c_long |
| | 121 | }; |
| | 122 | |
| | 123 | pub const MSG = extern struct { |
| | 124 | hWnd: ?HWND, |
| | 125 | message: UINT, |
| | 126 | wParam: WPARAM, |
| | 127 | lParam: LPARAM, |
| | 128 | time: DWORD, |
| | 129 | pt: POINT, |
| | 130 | lPrivate: DWORD, |
| | 131 | }; |
| | 132 | |
| 20 | pub extern "user32" fn CreateWindowExA( | 133 | pub extern "user32" fn CreateWindowExA( |
| 21 | dwExStyle: DWORD, | 134 | dwExStyle: DWORD, |
| 22 | lpClassName: LPCSTR, | 135 | lpClassName: LPCSTR, |
| ... | @@ -32,6 +145,28 @@ pub extern "user32" fn CreateWindowExA( | ... | @@ -32,6 +145,28 @@ pub extern "user32" fn CreateWindowExA( |
| 32 | lpParam: ?LPVOID, | 145 | lpParam: ?LPVOID, |
| 33 | ) callconv(.Stdcall) ?HWND; | 146 | ) callconv(.Stdcall) ?HWND; |
| 34 | | 147 | |
| | 148 | pub extern "user32" fn RegisterClassExA(*const WNDCLASSEXA) callconv(.Stdcall) c_ushort; |
| 35 | pub extern "user32" fn DefWindowProcA(HWND, Msg: UINT, WPARAM, LPARAM) callconv(.Stdcall) LRESULT; | 149 | pub extern "user32" fn DefWindowProcA(HWND, Msg: UINT, WPARAM, LPARAM) callconv(.Stdcall) LRESULT; |
| | 150 | pub extern "user32" fn GetModuleHandleA(lpModuleName: ?LPCSTR) callconv(.Stdcall) HMODULE; |
| | 151 | pub extern "user32" fn ShowWindow(hWnd: ?HWND, nCmdShow: i32) callconv(.Stdcall) bool; |
| | 152 | pub extern "user32" fn UpdateWindow(hWnd: ?HWND) callconv(.Stdcall) bool; |
| | 153 | pub extern "user32" fn GetDC(hWnd: ?HWND) callconv(.Stdcall) ?HDC; |
| 36 | | 154 | |
| 37 | pub extern "user32" fn RegisterClassExA(*const WNDCLASSEXA) callconv(.Stdcall) c_ushort; | 155 | pub extern "user32" fn PeekMessageA( |
| | 156 | lpMsg: ?*MSG, |
| | 157 | hWnd: ?HWND, |
| | 158 | wMsgFilterMin: UINT, |
| | 159 | wMsgFilterMax: UINT, |
| | 160 | wRemoveMsg: UINT, |
| | 161 | ) callconv(.Stdcall) bool; |
| | 162 | |
| | 163 | pub extern "user32" fn GetMessageA( |
| | 164 | lpMsg: ?*MSG, |
| | 165 | hWnd: ?HWND, |
| | 166 | wMsgFilterMin: UINT, |
| | 167 | wMsgFilterMax: UINT, |
| | 168 | ) callconv(.Stdcall) bool; |
| | 169 | |
| | 170 | pub extern "user32" fn TranslateMessage(lpMsg: *const MSG) callconv(.Stdcall) bool; |
| | 171 | pub extern "user32" fn DispatchMessageA(lpMsg: *const MSG) callconv(.Stdcall) LRESULT; |
| | 172 | pub extern "user32" fn PostQuitMessage(nExitCode: i32) callconv(.Stdcall) void; |
| \ No newline at end of file |