Fix win32
This commit is contained in:
@@ -31,14 +31,14 @@ struct CI2_Window {
|
|||||||
// Forward declaration of WndProc
|
// Forward declaration of WndProc
|
||||||
static LRESULT CALLBACK window_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
static LRESULT CALLBACK window_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
ci2_bool platform_init(void) {
|
ci2_bool ci2_init(void) {
|
||||||
// Nothing to do for Win32
|
// Nothing to do for Win32
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
CI2_Window* platform_create_window(const ci2_sys_char* title, int width, int height) {
|
CI2_Window* ci2_create_window(const ci2_sys_char* title, int width, int height) {
|
||||||
static ci2_bool class_registered = false;
|
static ci2_bool class_registered = false;
|
||||||
static ci2_sys_char *ci2_window_class = L"Win32 CI2 Window Class"
|
static ci2_sys_char *ci2_window_class = L"Win32 CI2 Window Class";
|
||||||
|
|
||||||
if (!class_registered) {
|
if (!class_registered) {
|
||||||
WNDCLASS wc = {0};
|
WNDCLASS wc = {0};
|
||||||
@@ -73,13 +73,13 @@ CI2_Window* platform_create_window(const ci2_sys_char* title, int width, int hei
|
|||||||
window->should_close = false;
|
window->should_close = false;
|
||||||
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)window);
|
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)window);
|
||||||
|
|
||||||
ShowWindow(window->hwnd, nShowCmd);
|
ShowWindow(window->hwnd, SW_SHOWNORMAL);
|
||||||
UpdateWindow(window->hwnd);
|
UpdateWindow(window->hwnd);
|
||||||
|
|
||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
|
|
||||||
ci2_bool platform_poll_events(CI2_Window* window) {
|
ci2_bool ci2_poll_events(CI2_Window* window) {
|
||||||
MSG msg;
|
MSG msg;
|
||||||
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
|
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
|
||||||
TranslateMessage(&msg);
|
TranslateMessage(&msg);
|
||||||
@@ -88,13 +88,13 @@ ci2_bool platform_poll_events(CI2_Window* window) {
|
|||||||
return !window->should_close;
|
return !window->should_close;
|
||||||
}
|
}
|
||||||
|
|
||||||
void platform_destroy_window(CI2_Window* window) {
|
void ci2_destroy_window(CI2_Window* window) {
|
||||||
if (!window) return;
|
if (!window) return;
|
||||||
DestroyWindow(window->hwnd);
|
DestroyWindow(window->hwnd);
|
||||||
free(window);
|
free(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void platform_shutdown(void) {
|
void ci2_shutdown(void) {
|
||||||
// Nothing to do
|
// Nothing to do
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
BIN
tests/bin/01_ci2
BIN
tests/bin/01_ci2
Binary file not shown.
Reference in New Issue
Block a user