Browse Source

automaticall enable colored console output on windows

master
Felix Brendel 5 years ago
parent
commit
f90183f57c
1 changed files with 9 additions and 0 deletions
  1. +9
    -0
      print.hpp

+ 9
- 0
print.hpp View File

@@ -7,6 +7,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>


#include "platform.hpp"
#include "hashmap.hpp" #include "hashmap.hpp"
#include "hooks.hpp" #include "hooks.hpp"


@@ -449,6 +450,14 @@ auto print_str_line(FILE* f, char* str) -> s32 {
} }


void init_printer() { 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(); color_stack.alloc();
printer_map.alloc(); printer_map.alloc();
type_map.alloc(); type_map.alloc();


Loading…
Cancel
Save