Fixed Win32 test: invalid function for CreateThread parameter

This commit is contained in:
REghZy 2023-12-08 22:39:17 +00:00
parent 1cbfe6be70
commit bebe6eb12a
2 changed files with 34 additions and 38 deletions

5
.gitignore vendored
View File

@ -99,7 +99,4 @@ tests/timeout
tests/title tests/title
tests/triangle-vulkan tests/triangle-vulkan
tests/window tests/window
tests/windows tests/windows
/.idea
/cmake-build-debug
/.gitignore

View File

@ -32,7 +32,6 @@
#include <Windows.h> #include <Windows.h>
#endif // USE_WIN32_THREAD_EMPTY_EVENT_TEST #endif // USE_WIN32_THREAD_EMPTY_EVENT_TEST
#define GLAD_GL_IMPLEMENTATION #define GLAD_GL_IMPLEMENTATION
#include <glad/gl.h> #include <glad/gl.h>
#define GLFW_INCLUDE_NONE #define GLFW_INCLUDE_NONE
@ -60,7 +59,7 @@
#ifdef USE_WIN32_THREAD_EMPTY_EVENT_TEST #ifdef USE_WIN32_THREAD_EMPTY_EVENT_TEST
DWORD WINAPI win32ThreadEmptyEventTest(void) DWORD WINAPI win32ThreadEmptyEventTest(LPVOID lpThreadParameter)
{ {
// Sleep for 3 seconds, and then post an empty event. The onEmptyEventPosted // Sleep for 3 seconds, and then post an empty event. The onEmptyEventPosted
// method should then be fired shortly after, on the GLFW main thread. // method should then be fired shortly after, on the GLFW main thread.
@ -81,7 +80,7 @@ void onEmptyEventPosted(void)
// This is the only effective way to run code on the main thread during the // This is the only effective way to run code on the main thread during the
// window resize phase while the user isn't moving their mouse, apart from the // window resize phase while the user isn't moving their mouse, apart from the
// actual resize events obviously // actual resize events obviously
MessageBoxExW(NULL, L"Callback event received!", L"Empty Event Callback", NULL, NULL); MessageBoxW((HWND)NULL, L"Callback event received!", L"Empty Event Callback", (UINT)0);
// printf("Empty event received! Put a break point here, and this will be fired on the main thread"); // printf("Empty event received! Put a break point here, and this will be fired on the main thread");
} }
@ -158,7 +157,7 @@ int main(int argc, char** argv)
glfwGetWindowSize(window, &width, &height); glfwGetWindowSize(window, &width, &height);
struct nk_rect area = nk_rect(0.f, 0.f, (float) width, (float) height); struct nk_rect area = nk_rect(0.f, 0.f, (float)width, (float)height);
nk_window_set_bounds(nk, "main", area); nk_window_set_bounds(nk, "main", area);
nk_glfw3_new_frame(); nk_glfw3_new_frame();
@ -171,8 +170,8 @@ int main(int argc, char** argv)
if (glfwGetWindowMonitor(window)) if (glfwGetWindowMonitor(window))
{ {
glfwSetWindowMonitor(window, NULL, glfwSetWindowMonitor(window, NULL,
windowed_x, windowed_y, windowed_x, windowed_y,
windowed_width, windowed_height, 0); windowed_width, windowed_height, 0);
} }
else else
{ {
@ -181,8 +180,8 @@ int main(int argc, char** argv)
glfwGetWindowPos(window, &windowed_x, &windowed_y); glfwGetWindowPos(window, &windowed_x, &windowed_y);
glfwGetWindowSize(window, &windowed_width, &windowed_height); glfwGetWindowSize(window, &windowed_width, &windowed_height);
glfwSetWindowMonitor(window, monitor, glfwSetWindowMonitor(window, monitor,
0, 0, mode->width, mode->height, 0, 0, mode->width, mode->height,
mode->refreshRate); mode->refreshRate);
} }
} }
@ -223,8 +222,8 @@ int main(int argc, char** argv)
nk_flags events; nk_flags events;
const nk_flags flags = NK_EDIT_FIELD | const nk_flags flags = NK_EDIT_FIELD |
NK_EDIT_SIG_ENTER | NK_EDIT_SIG_ENTER |
NK_EDIT_GOTO_END_ON_ACTIVATE; NK_EDIT_GOTO_END_ON_ACTIVATE;
if (position_supported) if (position_supported)
{ {
@ -235,8 +234,8 @@ int main(int argc, char** argv)
nk_label(nk, "Position", NK_TEXT_LEFT); nk_label(nk, "Position", NK_TEXT_LEFT);
events = nk_edit_string_zero_terminated(nk, flags, xpos_buffer, events = nk_edit_string_zero_terminated(nk, flags, xpos_buffer,
sizeof(xpos_buffer), sizeof(xpos_buffer),
nk_filter_decimal); nk_filter_decimal);
if (events & NK_EDIT_COMMITED) if (events & NK_EDIT_COMMITED)
{ {
xpos = atoi(xpos_buffer); xpos = atoi(xpos_buffer);
@ -246,8 +245,8 @@ int main(int argc, char** argv)
sprintf(xpos_buffer, "%i", xpos); sprintf(xpos_buffer, "%i", xpos);
events = nk_edit_string_zero_terminated(nk, flags, ypos_buffer, events = nk_edit_string_zero_terminated(nk, flags, ypos_buffer,
sizeof(ypos_buffer), sizeof(ypos_buffer),
nk_filter_decimal); nk_filter_decimal);
if (events & NK_EDIT_COMMITED) if (events & NK_EDIT_COMMITED)
{ {
ypos = atoi(ypos_buffer); ypos = atoi(ypos_buffer);
@ -266,8 +265,8 @@ int main(int argc, char** argv)
nk_label(nk, "Size", NK_TEXT_LEFT); nk_label(nk, "Size", NK_TEXT_LEFT);
events = nk_edit_string_zero_terminated(nk, flags, width_buffer, events = nk_edit_string_zero_terminated(nk, flags, width_buffer,
sizeof(width_buffer), sizeof(width_buffer),
nk_filter_decimal); nk_filter_decimal);
if (events & NK_EDIT_COMMITED) if (events & NK_EDIT_COMMITED)
{ {
width = atoi(width_buffer); width = atoi(width_buffer);
@ -277,8 +276,8 @@ int main(int argc, char** argv)
sprintf(width_buffer, "%i", width); sprintf(width_buffer, "%i", width);
events = nk_edit_string_zero_terminated(nk, flags, height_buffer, events = nk_edit_string_zero_terminated(nk, flags, height_buffer,
sizeof(height_buffer), sizeof(height_buffer),
nk_filter_decimal); nk_filter_decimal);
if (events & NK_EDIT_COMMITED) if (events & NK_EDIT_COMMITED)
{ {
height = atoi(height_buffer); height = atoi(height_buffer);
@ -295,8 +294,8 @@ int main(int argc, char** argv)
update_ratio_limit = true; update_ratio_limit = true;
events = nk_edit_string_zero_terminated(nk, flags, numer_buffer, events = nk_edit_string_zero_terminated(nk, flags, numer_buffer,
sizeof(numer_buffer), sizeof(numer_buffer),
nk_filter_decimal); nk_filter_decimal);
if (events & NK_EDIT_COMMITED) if (events & NK_EDIT_COMMITED)
{ {
aspect_numer = abs(atoi(numer_buffer)); aspect_numer = abs(atoi(numer_buffer));
@ -306,8 +305,8 @@ int main(int argc, char** argv)
sprintf(numer_buffer, "%i", aspect_numer); sprintf(numer_buffer, "%i", aspect_numer);
events = nk_edit_string_zero_terminated(nk, flags, denom_buffer, events = nk_edit_string_zero_terminated(nk, flags, denom_buffer,
sizeof(denom_buffer), sizeof(denom_buffer),
nk_filter_decimal); nk_filter_decimal);
if (events & NK_EDIT_COMMITED) if (events & NK_EDIT_COMMITED)
{ {
aspect_denom = abs(atoi(denom_buffer)); aspect_denom = abs(atoi(denom_buffer));
@ -330,8 +329,8 @@ int main(int argc, char** argv)
update_size_limit = true; update_size_limit = true;
events = nk_edit_string_zero_terminated(nk, flags, min_width_buffer, events = nk_edit_string_zero_terminated(nk, flags, min_width_buffer,
sizeof(min_width_buffer), sizeof(min_width_buffer),
nk_filter_decimal); nk_filter_decimal);
if (events & NK_EDIT_COMMITED) if (events & NK_EDIT_COMMITED)
{ {
min_width = abs(atoi(min_width_buffer)); min_width = abs(atoi(min_width_buffer));
@ -341,8 +340,8 @@ int main(int argc, char** argv)
sprintf(min_width_buffer, "%i", min_width); sprintf(min_width_buffer, "%i", min_width);
events = nk_edit_string_zero_terminated(nk, flags, min_height_buffer, events = nk_edit_string_zero_terminated(nk, flags, min_height_buffer,
sizeof(min_height_buffer), sizeof(min_height_buffer),
nk_filter_decimal); nk_filter_decimal);
if (events & NK_EDIT_COMMITED) if (events & NK_EDIT_COMMITED)
{ {
min_height = abs(atoi(min_height_buffer)); min_height = abs(atoi(min_height_buffer));
@ -355,8 +354,8 @@ int main(int argc, char** argv)
update_size_limit = true; update_size_limit = true;
events = nk_edit_string_zero_terminated(nk, flags, max_width_buffer, events = nk_edit_string_zero_terminated(nk, flags, max_width_buffer,
sizeof(max_width_buffer), sizeof(max_width_buffer),
nk_filter_decimal); nk_filter_decimal);
if (events & NK_EDIT_COMMITED) if (events & NK_EDIT_COMMITED)
{ {
max_width = abs(atoi(max_width_buffer)); max_width = abs(atoi(max_width_buffer));
@ -366,8 +365,8 @@ int main(int argc, char** argv)
sprintf(max_width_buffer, "%i", max_width); sprintf(max_width_buffer, "%i", max_width);
events = nk_edit_string_zero_terminated(nk, flags, max_height_buffer, events = nk_edit_string_zero_terminated(nk, flags, max_height_buffer,
sizeof(max_height_buffer), sizeof(max_height_buffer),
nk_filter_decimal); nk_filter_decimal);
if (events & NK_EDIT_COMMITED) if (events & NK_EDIT_COMMITED)
{ {
max_height = abs(atoi(max_height_buffer)); max_height = abs(atoi(max_height_buffer));
@ -379,10 +378,10 @@ int main(int argc, char** argv)
if (update_size_limit) if (update_size_limit)
{ {
glfwSetWindowSizeLimits(window, glfwSetWindowSizeLimits(window,
limit_min_size ? min_width : GLFW_DONT_CARE, limit_min_size ? min_width : GLFW_DONT_CARE,
limit_min_size ? min_height : GLFW_DONT_CARE, limit_min_size ? min_height : GLFW_DONT_CARE,
limit_max_size ? max_width : GLFW_DONT_CARE, limit_max_size ? max_width : GLFW_DONT_CARE,
limit_max_size ? max_height : GLFW_DONT_CARE); limit_max_size ? max_height : GLFW_DONT_CARE);
} }
int fb_width, fb_height; int fb_width, fb_height;