-
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
1 parent
5c7b47b
commit b2acc7f
Showing
11 changed files
with
241 additions
and
57 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
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 |
---|---|---|
@@ -1,29 +1,22 @@ | ||
#pragma once | ||
#include "_kbhit.hpp" | ||
|
||
#ifdef WIN32 | ||
#ifndef WIN32 | ||
|
||
// _kbhit() is originally from this library but it is windows only | ||
#include <conio.h> | ||
|
||
#else | ||
// taken from https://www.flipcode.com/archives/_kbhit_for_Linux.shtml | ||
// very slightly modified (#include <strops.h> to #include <sys/ioctl.h>) | ||
// very slightly modified in the header file (#include <strops.h> to #include <sys/ioctl.h>) | ||
|
||
/** | ||
Linux (POSIX) implementation of _kbhit(). | ||
Morgan McGuire, [email protected] | ||
*/ | ||
|
||
#include <stdio.h> | ||
#include <sys/select.h> | ||
#include <termios.h> | ||
#include <sys/ioctl.h> | ||
|
||
int _kbhit() { | ||
int _kbhit() | ||
{ | ||
static const int STDIN = 0; | ||
static bool initialized = false; | ||
|
||
if (! initialized) { | ||
if (! initialized) | ||
{ | ||
// Use termios to turn off line buffering | ||
termios term; | ||
tcgetattr(STDIN, &term); | ||
|
@@ -37,4 +30,5 @@ int _kbhit() { | |
ioctl(STDIN, FIONREAD, &bytesWaiting); | ||
return bytesWaiting; | ||
} | ||
|
||
#endif |
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,17 @@ | ||
#pragma once | ||
|
||
#ifdef WIN32 | ||
|
||
// _kbhit() is originally from this library but it is windows only | ||
#include <conio.h> | ||
|
||
#else | ||
|
||
#include <stdio.h> | ||
#include <sys/select.h> | ||
#include <termios.h> | ||
#include <sys/ioctl.h> | ||
|
||
int _kbhit(); | ||
|
||
#endif |
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
Oops, something went wrong.