Advertisement
F_THIAGO

Console.h

Jul 23rd, 2019
317
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.06 KB | None | 0 0
  1. #pragma once
  2.  
  3. #ifndef LIB_CONSOLE
  4.     #define LIB_CONSOLE
  5.  
  6.     #include <windows.h>
  7.    
  8.     // Define algumas constantes de cores
  9.     #define FOREGROUND_DEFAULT (FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_INTENSITY) // White
  10.     #define BACKGROUND_DEFAULT (BACKGROUND_GREEN & BACKGROUND_RED & BACKGROUND_BLUE | FOREGROUND_DEFAULT)   // Black
  11.     #define BACKGROUND_WHITE   (BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED)
  12.    
  13.     class Console
  14.     {
  15.         private:
  16.             HANDLE hConsole;
  17.             char  *message;
  18.        
  19.         public:
  20.             // Construtor e destrutor da classe
  21.             Console();
  22.             ~Console();
  23.            
  24.             // Funcoes p/ movimentar o cursor no console
  25.             bool gotoxy( int x, int y );
  26.             bool previousLine();
  27.            
  28.             COORD getCursorPosition();
  29.            
  30.             // Funcoes diversas para a manipulacao do console
  31.             bool setColor( WORD cor );
  32.             bool setTitle( LPCSTR titulo );
  33.             bool mode( int x, int y );
  34.             void delay( DWORD tempo );
  35.             bool cls( int x, int y );
  36.             bool cls();
  37.  
  38.             bool setConsole(DWORD consoleID);
  39.             LPSTR getMessageError();
  40.             void close();
  41.     };
  42.    
  43. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement