automaticall enable colored console output on windows

This commit is contained in:
Felix Brendel
2020-11-21 00:27:51 +01:00
parent 1e7df8d578
commit f90183f57c
+9
View File
@@ -7,6 +7,7 @@
#include <stdlib.h>
#include <string.h>
#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();