diff options
| -rw-r--r-- | game/client/main.cc | 9 | ||||
| -rw-r--r-- | game/server/pch.hh | 2 | ||||
| -rw-r--r-- | game/shared/pch.hh | 2 |
3 files changed, 11 insertions, 2 deletions
diff --git a/game/client/main.cc b/game/client/main.cc index 277b278..86e9783 100644 --- a/game/client/main.cc +++ b/game/client/main.cc @@ -127,6 +127,12 @@ static void GLAD_API_PTR on_opengl_message(GLenum source, GLenum type, GLuint id spdlog::info("opengl: {}", reinterpret_cast<const char *>(message)); } +static void on_termination_signal(int) +{ + spdlog::warn("client: received termination signal"); + glfwSetWindowShouldClose(globals::window, true); +} + int main(int argc, char **argv) { cmdline::create(argc, argv); @@ -178,6 +184,9 @@ int main(int argc, char **argv) std::terminate(); } + std::signal(SIGINT, &on_termination_signal); + std::signal(SIGTERM, &on_termination_signal); + glfwMakeContextCurrent(globals::window); glfwSwapInterval(1); diff --git a/game/server/pch.hh b/game/server/pch.hh index 5a4f5f2..89b396b 100644 --- a/game/server/pch.hh +++ b/game/server/pch.hh @@ -4,6 +4,4 @@ #include <shared/pch.hh> -#include <csignal> - #endif /* SERVER_PCH_HH */ diff --git a/game/shared/pch.hh b/game/shared/pch.hh index 3588709..1776f9b 100644 --- a/game/shared/pch.hh +++ b/game/shared/pch.hh @@ -4,6 +4,8 @@ #include <core/pch.hh> +#include <csignal> + #include <BS_thread_pool.hpp> #include <enet/enet.h> |
