OSDN Git Service

console: move from roast (main)
authorMyun2 <myun2@nwhite.info>
Sat, 26 May 2012 06:53:43 +0000 (15:53 +0900)
committerMyun2 <myun2@nwhite.info>
Sat, 26 May 2012 06:53:43 +0000 (15:53 +0900)
include/roast/console/console.hpp [new file with mode: 0644]

diff --git a/include/roast/console/console.hpp b/include/roast/console/console.hpp
new file mode 100644 (file)
index 0000000..e78bb8c
--- /dev/null
@@ -0,0 +1,54 @@
+//     Roast+ License
+
+/*
+       
+*/
+#ifndef __SFJP_ROAST__console__console_HPP__
+#define __SFJP_ROAST__console__console_HPP__
+
+#include <stdio.h>
+
+namespace roast
+{
+       int putchar_repeat(char c, int count)
+       {
+               for(int i=0; i<count; i++)
+               {
+                       int r = putchar(c);
+                       if ( r != c )
+                               return r;
+               }
+               return c;
+       }
+}
+
+#ifdef WIN32
+       #include "roast/console/windows_console.hpp"
+#endif
+
+namespace roast
+{
+       namespace console
+       {
+               static int screen_width = 0;
+               static int screen_height = 0;
+                       
+               void update_screen_size(){
+                       if ( screen_width == 0 )
+                               get_screen_size(screen_width, screen_height);
+               }       
+
+               void repeat_to_screen_max(char c, int margin=0)
+               {
+                       update_screen_size();
+
+                       //for(int i=0; i<get_screen_height(); i++)
+                       for(int i=0; i<screen_width-margin; i++)
+                       {
+                               ::putchar(c);
+                       }
+               }
+       }
+}
+
+#endif//__SFJP_ROAST__console__console_HPP__