mirror of
https://github.com/p-ranav/indicators.git
synced 2025-12-16 04:18:51 +08:00
35 lines
674 B
C++
Executable File
35 lines
674 B
C++
Executable File
#pragma once
|
|
|
|
#if defined(_MSC_VER)
|
|
#if !defined(NOMINMAX)
|
|
#define NOMINMAX
|
|
#endif
|
|
#include <io.h>
|
|
#include <windows.h>
|
|
#else
|
|
#include <cstdio>
|
|
#endif
|
|
|
|
namespace indicators {
|
|
|
|
#if defined(_MSC_VER)
|
|
|
|
static inline void show_console_cursor(bool const show) {
|
|
HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE);
|
|
|
|
CONSOLE_CURSOR_INFO cursorInfo;
|
|
|
|
GetConsoleCursorInfo(out, &cursorInfo);
|
|
cursorInfo.bVisible = show; // set the cursor visibility
|
|
SetConsoleCursorInfo(out, &cursorInfo);
|
|
}
|
|
|
|
#else
|
|
|
|
static inline void show_console_cursor(bool const show) {
|
|
std::fputs(show ? "\e[?25h" : "\e[?25l", stdout);
|
|
}
|
|
|
|
#endif
|
|
|
|
} // namespace indicators
|