-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
207 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#if (defined __WIN32__) || (defined _WIN32) | ||
#include <windows.h> | ||
//#else | ||
#endif | ||
|
||
int colores = -1; | ||
|
||
#if (defined __WIN32__) || (defined _WIN32) | ||
void ObtenerColoresOriginales() { | ||
CONSOLE_SCREEN_BUFFER_INFO temp; | ||
|
||
if (!GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &temp)) { | ||
colores = 0 | 7; // Fondo blanco y texto negro. | ||
} else { | ||
colores = temp.wAttributes; | ||
} | ||
} | ||
//#else | ||
#endif | ||
|
||
void EstablecerColores(int color) { | ||
if (colores == -1) { | ||
ObtenerColoresOriginales(); | ||
} | ||
|
||
#if (defined __WIN32__) || (defined _WIN32) | ||
SetConsoleTextAttribute( | ||
GetStdHandle(STD_OUTPUT_HANDLE), | ||
color | ||
); | ||
//#else | ||
#endif | ||
} | ||
|
||
void RestablecerColores() { | ||
if (colores != -1) { | ||
EstablecerColores(colores); | ||
} | ||
} |
Oops, something went wrong.