#include #define WIN32_LEAN_AND_MEAN #include #include LRESULT wndproc(HWND hwnd, u32 msg, WPARAM wparam, LPARAM lparam); wchar_t *sw_str_to_wstr(char *str) { i32 size; wchar_t *out; size = MultiByteToWideChar(CP_UTF8, 0, str, -1, 0, 0); out = malloc(size); MultiByteToWideChar(CP_UTF8, 0, str, -1, out, size); return out; } int main(int argc, char *argv[]) { WNDCLASSEXW wndclass = {0}; HWND hwnd; wndclass.cbSize = sizeof(wndclass); wndclass.style = 0; wndclass.lpfnWndProc = wndproc; wndclass.cbClsExtra = 0; wndclass.cbWndExtra = 0; wndclass.hInstance = 0; wndclass.hIcon = 0; wndclass.hCursor = 0; wndclass.hbrBackground = 0; wndclass.lpszMenuName = 0; wndclass.lpszClassName = L"Skunkworks"; wndclass.hIconSm = 0; RegisterClassExW(&wndclass); hwnd = CreateWindowExW( 0, L"Skunkworks", L"Skunkworks test", WS_POPUPWINDOW | WS_VISIBLE, (1920 - 1280) / 2, (1080 - 720) / 2, 1280, 720, 0, 0, 0, 0 ); ShowWindow(hwnd, SW_SHOW); while (true) { MSG msg; while (PeekMessageW(&msg, hwnd, 0, 0, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessageW(&msg); } } return 0; } LRESULT wndproc(HWND hwnd, u32 msg, WPARAM wparam, LPARAM lparam) { switch (msg) { case WM_CLOSE: case WM_KEYDOWN: exit(0); case WM_PAINT: { PAINTSTRUCT ps; HDC hdc = BeginPaint(hwnd, &ps); FillRect(hdc, &ps.rcPaint, (HBRUSH) (COLOR_WINDOW + 1)); EndPaint(hwnd, &ps); break; } } return DefWindowProcW(hwnd, msg, wparam, lparam); }