mirror of
				https://github.com/raysan5/raylib.git
				synced 2025-10-26 12:27:01 +00:00 
			
		
		
		
	Fix building audio_standalone example on linux
Signed-off-by: Saggi Mizrahi <saggi@mizrahi.cc>
This commit is contained in:
		| @@ -24,10 +24,52 @@ | ||||
| ********************************************************************************************/ | ||||
|  | ||||
| #include <stdio.h> | ||||
| #if defined(_WIN32) | ||||
| #include <conio.h>      // Windows only, no stardard library | ||||
|  | ||||
| #endif | ||||
| #include "audio.h" | ||||
|  | ||||
| #if defined(__linux) | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <termios.h> | ||||
| #include <unistd.h> | ||||
| #include <fcntl.h> | ||||
|  | ||||
| static int kbhit(void) | ||||
| { | ||||
| 	struct termios oldt, newt; | ||||
| 	int ch; | ||||
| 	int oldf; | ||||
|  | ||||
| 	tcgetattr(STDIN_FILENO, &oldt); | ||||
| 	newt = oldt; | ||||
| 	newt.c_lflag &= ~(ICANON | ECHO); | ||||
| 	tcsetattr(STDIN_FILENO, TCSANOW, &newt); | ||||
| 	oldf = fcntl(STDIN_FILENO, F_GETFL, 0); | ||||
| 	fcntl(STDIN_FILENO, F_SETFL, oldf | O_NONBLOCK); | ||||
|  | ||||
| 	ch = getchar(); | ||||
|  | ||||
| 	tcsetattr(STDIN_FILENO, TCSANOW, &oldt); | ||||
| 	fcntl(STDIN_FILENO, F_SETFL, oldf); | ||||
|  | ||||
| 	if(ch != EOF) | ||||
| 	{ | ||||
| 		ungetc(ch, stdin); | ||||
| 		return 1; | ||||
| 	} | ||||
|  | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
| static char getch() | ||||
| { | ||||
| 	return getchar(); | ||||
| } | ||||
|  | ||||
| #endif | ||||
|  | ||||
| #define KEY_ESCAPE  27 | ||||
|  | ||||
| int main() | ||||
| @@ -78,4 +120,4 @@ int main() | ||||
|     //-------------------------------------------------------------------------------------- | ||||
|  | ||||
|     return 0; | ||||
| } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Saggi Mizrahi
					Saggi Mizrahi