|
Last change
on this file since 511 was
400,
checked in by Maciej Komosinski, 10 years ago
|
|
Improved comments
|
-
Property svn:eol-style set to
native
|
|
File size:
581 bytes
|
| Line | |
|---|
| 1 | #include "console.h" |
|---|
| 2 | #ifdef _WIN32 |
|---|
| 3 | |
|---|
| 4 | #include <windows.h> |
|---|
| 5 | #include "Convert.h" |
|---|
| 6 | |
|---|
| 7 | #else |
|---|
| 8 | |
|---|
| 9 | #include <stdio.h> |
|---|
| 10 | #include <termios.h> |
|---|
| 11 | |
|---|
| 12 | bool guiStdoutIsConsole() |
|---|
| 13 | { |
|---|
| 14 | static int in=-1; |
|---|
| 15 | if (in<0) |
|---|
| 16 | { |
|---|
| 17 | struct termios t; |
|---|
| 18 | in=(tcgetattr(1,&t)==0); |
|---|
| 19 | } |
|---|
| 20 | return in; |
|---|
| 21 | } |
|---|
| 22 | #endif |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | void guiSetConsoleTitle(const char* utf8title) //platform-dependent implementations |
|---|
| 26 | { |
|---|
| 27 | #ifdef _WIN32 |
|---|
| 28 | SetConsoleTitleW(Convert::utf8ToUtf16(utf8title).c_str()); |
|---|
| 29 | #else |
|---|
| 30 | if (guiStdoutIsConsole()) |
|---|
| 31 | { |
|---|
| 32 | printf("\033]0;%s\007",utf8title); |
|---|
| 33 | fflush(stdout); |
|---|
| 34 | } |
|---|
| 35 | #endif |
|---|
| 36 | } |
|---|
| 37 | |
|---|
| 38 | ConsoleColorMode console_color_mode = ConsoleColorNone; |
|---|
Note: See
TracBrowser
for help on using the repository browser.