OSDN Git Service

console/windows_console.hpp Add.
authorMyun2 <myun2@nwhite.info>
Thu, 23 Dec 2010 16:23:33 +0000 (01:23 +0900)
committerMyun2 <myun2@nwhite.info>
Thu, 23 Dec 2010 16:24:16 +0000 (01:24 +0900)
roast/include/roast/console/windows_console.hpp [new file with mode: 0644]

diff --git a/roast/include/roast/console/windows_console.hpp b/roast/include/roast/console/windows_console.hpp
new file mode 100644 (file)
index 0000000..7b752f0
--- /dev/null
@@ -0,0 +1,55 @@
+//     Roast+ License
+/*
+       Windows Console
+*/
+#ifndef __SFJP_ROAST__console__windows_console_HPP__
+#define __SFJP_ROAST__console__windows_console_HPP__
+
+#include <windows.h>
+#include <wincon.h>
+#include <stdio.h>
+
+namespace roast
+{
+       namespace console
+       {
+               enum text_colors
+               {
+                       brack,
+
+                       dark_blue=1,
+                       dark_green,
+                       dark_cyan,
+                       dark_red,
+                       dark_magenta, dark_pink=5, purple=5,
+                       dark_yellow,
+                       dark_gray,
+
+                       gray,
+                       blue,
+                       green,
+                       cyan,
+                       red,
+                       magenta, pink=13,
+                       yellow,
+                       white
+               };
+
+               enum text_options
+               {
+                       option_null,
+                       under_line = COMMON_LVB_UNDERSCORE,
+                       over_line = COMMON_LVB_GRID_HORIZONTAL,
+                       left_line = COMMON_LVB_GRID_LVERTICAL,
+                       right_line = COMMON_LVB_REVERSE_VIDEO
+               };
+
+               void set_text_color(text_colors color, text_colors background=brack, text_options option=option_null)
+               {
+                       HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
+                       SetConsoleTextAttribute(hConsole, color | background<<4 | option);
+               }
+       }
+}
+
+#endif//__SFJP_ROAST__console__windows_console_HPP__