From 55ea1e740f9760e990d1ffa8a0d07252b8e1ac50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Madar=C3=A1sz?= Date: Tue, 4 May 2021 22:44:55 +0200 Subject: [PATCH] display conn status --- code/apps/client/source/platform_raylib.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/code/apps/client/source/platform_raylib.c b/code/apps/client/source/platform_raylib.c index 1b0d4c7..a111a20 100644 --- a/code/apps/client/source/platform_raylib.c +++ b/code/apps/client/source/platform_raylib.c @@ -1,5 +1,6 @@ #include "platform.h" #include "raylib.h" +#include "game.h" const uint16_t screenWidth = 800; const uint16_t screenHeight = 450; @@ -17,9 +18,24 @@ uint8_t platform_is_running() { return !WindowShouldClose(); } +void display_conn_status(); + void platform_render() { BeginDrawing(); - ClearBackground(RAYWHITE); + ClearBackground(BLACK); DrawText("NOBODY EXPECTS SPANISH INQUISITION!", 190, 200, 20, RED); + display_conn_status(); EndDrawing(); } + +void display_conn_status() { + if (game_is_networked()) { + if (network_client_is_connected()) { + DrawText("Connection: online", 5, 5, 12, GREEN); + } else { + DrawText("Connection: offline", 5, 5, 12, RED); + } + } else { + DrawText("Connection: single-player", 5, 5, 12, BLUE); + } +} \ No newline at end of file