aboutsummaryrefslogtreecommitdiff
path: root/src/zencore/logging.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/zencore/logging.cpp')
-rw-r--r--src/zencore/logging.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/zencore/logging.cpp b/src/zencore/logging.cpp
index 33e81825c..07b379cba 100644
--- a/src/zencore/logging.cpp
+++ b/src/zencore/logging.cpp
@@ -85,6 +85,33 @@ ShutdownLogging()
spdlog::shutdown();
}
+bool
+EnableVTMode()
+{
+#if ZEN_PLATFORM_WINDOWS
+ // Set output mode to handle virtual terminal sequences
+ HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
+ if (hOut == INVALID_HANDLE_VALUE)
+ {
+ return false;
+ }
+
+ DWORD dwMode = 0;
+ if (!GetConsoleMode(hOut, &dwMode))
+ {
+ return false;
+ }
+
+ dwMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
+ if (!SetConsoleMode(hOut, dwMode))
+ {
+ return false;
+ }
+#endif
+
+ return true;
+}
+
} // namespace zen::logging
namespace zen {