This repository was archived by the owner on Sep 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Small enhancements #1
Copy link
Copy link
Open
Description
Hey there.
I am now using this library within my application, but wanted to report a small problem that there is.
The enum that contains the colors, should be move dinto the heaer file instead, as it can't be accessed otherwise.
I also have made a minimal piece of code that allows me to reset the console. I kinda picked the code up from stackoverflow and MSDN, but maybe it turns out to be useful.
#ifndef AP_HELPER
#define AP_HELPER
#ifdef WIN32
#include <windows.h>
// Console attributes.
HANDLE hConsole;
WORD saved_attributes;
CONSOLE_SCREEN_BUFFER_INFO consoleInfo;
void initConsole() {
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_SCREEN_BUFFER_INFO consoleInfo;
WORD saved_attributes;
/* Save current attributes */
GetConsoleScreenBufferInfo(hConsole, &consoleInfo);
saved_attributes = consoleInfo.wAttributes;
}
void deinitConsole() {
/* Restore original attributes */
SetConsoleTextAttribute(hConsole, saved_attributes);
}
#else
#include <stdio.h>
// Nothing to do here
void initConsole() {}
void deinitConsole() {
printf("\e[0m");
}
#endif
#endifKind regards, Ingwie.
Metadata
Metadata
Assignees
Labels
No labels