Advertisement
Guest User

C++ Adventure Game Skeleton Includes.h

a guest
Dec 9th, 2014
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.14 KB | None | 0 0
  1. #include <iostream>
  2. #include <Windows.h>
  3. #include <string>
  4. #include <cstdlib>
  5. #include <ctime>
  6. #include <vector>
  7. #include <string>
  8. #include <conio.h>
  9. #include <stdio.h>
  10.  
  11. using namespace std;
  12.  
  13. void ClearScreen()
  14.   {
  15.   HANDLE                     hStdOut;
  16.   CONSOLE_SCREEN_BUFFER_INFO csbi;
  17.   DWORD                      count;
  18.   DWORD                      cellCount;
  19.   COORD                      homeCoords = { 0, 0 };
  20.  
  21.   hStdOut = GetStdHandle( STD_OUTPUT_HANDLE );
  22.   if (hStdOut == INVALID_HANDLE_VALUE) return;
  23.  
  24.   /* Get the number of cells in the current buffer */
  25.   if (!GetConsoleScreenBufferInfo( hStdOut, &csbi )) return;
  26.   cellCount = csbi.dwSize.X *csbi.dwSize.Y;
  27.  
  28.   /* Fill the entire buffer with spaces */
  29.   if (!FillConsoleOutputCharacter(
  30.     hStdOut,
  31.     (TCHAR) ' ',
  32.     cellCount,
  33.     homeCoords,
  34.     &count
  35.     )) return;
  36.  
  37.   /* Fill the entire buffer with the current colors and attributes */
  38.   if (!FillConsoleOutputAttribute(
  39.     hStdOut,
  40.     csbi.wAttributes,
  41.     cellCount,
  42.     homeCoords,
  43.     &count
  44.     )) return;
  45.  
  46.   /* Move the cursor home */
  47.   SetConsoleCursorPosition( hStdOut, homeCoords );
  48.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement