From f90183f57cb08a4476e766077c126807658ab3e1 Mon Sep 17 00:00:00 2001 From: Felix Brendel Date: Sat, 21 Nov 2020 00:27:51 +0100 Subject: [PATCH] automaticall enable colored console output on windows --- print.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/print.hpp b/print.hpp index 14247ab..569bec4 100644 --- a/print.hpp +++ b/print.hpp @@ -7,6 +7,7 @@ #include #include +#include "platform.hpp" #include "hashmap.hpp" #include "hooks.hpp" @@ -449,6 +450,14 @@ auto print_str_line(FILE* f, char* str) -> s32 { } void init_printer() { +#ifdef FTB_WINDOWS + // enable colored terminal output for windows + HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE); + DWORD dwMode = 0; + GetConsoleMode(hOut, &dwMode); + dwMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING; + SetConsoleMode(hOut, dwMode); +#endif color_stack.alloc(); printer_map.alloc(); type_map.alloc();