diff --git a/include/ege.h b/include/ege.h index 303671f..133adaf 100644 --- a/include/ege.h +++ b/include/ege.h @@ -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 +int EGEAPI getch_console(); // Replace the getch() function in +int EGEAPI kbhit_console(); // Replace the kbhit() function in void EGEAPI ege_sleep (long ms); void EGEAPI delay (long ms); @@ -1519,14 +1520,17 @@ int EGEAPI kbhitEx(int flag); int EGEAPI keystate(int key); void EGEAPI flushkey(); +int EGEAPI ege_getch(); +int EGEAPI ege_kbhit(); + #if !defined(_INC_CONIO) && !defined(_CONIO_H_) #define _INC_CONIO #define _CONIO_H_ -int EGEAPI getch(); -int EGEAPI kbhit(); +int EGEAPI getch(); // Same as ege_getch() +int EGEAPI kbhit(); // Same as ege_kbhit() #else -#define getch getchEx -#define kbhit kbhitEx +#define getch ege_getch +#define kbhit ege_kbhit #endif int EGEAPI mousemsg(); diff --git a/src/console.cpp b/src/console.cpp index ad2ac4e..0f3eacd 100644 --- a/src/console.cpp +++ b/src/console.cpp @@ -179,4 +179,13 @@ int getch_console() #endif } +int kbhit_console() +{ +#ifdef MSVC_VER + return ::_kbhit(); +#else + return ::kbhit(); +#endif } + +} // namespace ege diff --git a/src/keyboard.cpp b/src/keyboard.cpp index 2a4ccc8..c95ebc8 100644 --- a/src/keyboard.cpp +++ b/src/keyboard.cpp @@ -160,16 +160,26 @@ int getchEx(int flag) return 0; } -int kbhit() +int ege_kbhit() { return kbhitEx(0); } -int getch() +int ege_getch() { return getchEx(0); } +int kbhit() +{ + return ege_kbhit(); +} + +int getch() +{ + return ege_getch(); +} + key_msg getkey() { struct _graph_setting* pg = &graph_setting;