Skip to content

Commit

Permalink
feat: 增加与 getch_console 配套的 kbhit_console
Browse files Browse the repository at this point in the history
  • Loading branch information
yixy-only committed Oct 8, 2024
1 parent 2527cf2 commit 6757c5a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
13 changes: 7 additions & 6 deletions include/ege.h
Original file line number Diff line number Diff line change
Expand Up @@ -1197,14 +1197,15 @@ ege_point EGEAPI ege_transform_calc(float x, float y, PIMAGE pimg = NULL); // C
// It is not supported in VC 6.0.
#ifndef EGE_COMPILERINFO_VC6
// Console
bool init_console(); // Initialize the console
bool clear_console(); // Clear the console
bool show_console(); // Show the Console
bool hide_console(); // Hide the console
bool close_console(); // Close the console and restore the old STD I/O
bool EGEAPI init_console(); // Initialize the console
bool EGEAPI clear_console(); // Clear the console
bool EGEAPI show_console(); // Show the Console
bool EGEAPI hide_console(); // Hide the console
bool EGEAPI close_console(); // Close the console and restore the old STD I/O
#endif

int getch_console(); // Used instead of the getch() function in <conio.h>
int EGEAPI getch_console(); // Replace the getch() function in <conio.h>
int EGEAPI kbhit_console(); // Replace the kbhit() function in <conio.h>

void EGEAPI ege_sleep (long ms);
void EGEAPI delay (long ms);
Expand Down
9 changes: 9 additions & 0 deletions src/console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,4 +179,13 @@ int getch_console()
#endif
}

int kbhit_console()
{
#ifdef MSVC_VER
return ::_kbhit();
#else
return ::kbhit();
#endif
}

} // namespace ege

0 comments on commit 6757c5a

Please sign in to comment.