From 95c24b38b934f48f7f5cde37182c51857e77eac0 Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Sun, 11 Dec 2022 23:01:16 +0100 Subject: networking --- build/zombies.exe | Bin 1691324 -> 1697824 bytes main.c | 10 ++++++++-- pathfinding.c | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/build/zombies.exe b/build/zombies.exe index 0c77b32..dc8678b 100644 Binary files a/build/zombies.exe and b/build/zombies.exe differ diff --git a/main.c b/main.c index 8985596..265ab7e 100644 --- a/main.c +++ b/main.c @@ -56,11 +56,14 @@ int main(int argc, char **argv) pathfinding_init(); - //networking_create_server(); - + network_server *server = networking_create_server(); + thread t = thread_start(pathfinding_thread, 0); thread_detach(&t); + network_client *client = network_connect_to_server("127.0.0.1", "27015"); + network_client_send(client, "Bing Bong"); + while(platform_keep_running(window)) { platform_handle_events(); } @@ -69,6 +72,9 @@ int main(int argc, char **argv) platform_destroy(); pathfinding_destroy(); + network_client_close(client); + networking_destroy_server(server); + memory_print_leaks(); return 0; diff --git a/pathfinding.c b/pathfinding.c index 7196b2c..bb209b0 100644 --- a/pathfinding.c +++ b/pathfinding.c @@ -88,7 +88,7 @@ bool find_path_to(vec2f start_pos, vec2f end_pos, array *to_fill, pathfinding_re if (to_fill) { array_remove_at(to_fill, to_fill->length-1); - printf("PATHFINDING TOOK: %fms\n", (platform_get_time(TIME_PROCESS, TIME_MS)-timestamp)/1000.0f); + //printf("PATHFINDING TOOK: %fms\n", (platform_get_time(TIME_PROCESS, TIME_MS)-timestamp)/1000.0f); } mutex_unlock(&request->mutex); -- cgit v1.2.3-70-g09d2