| 
				
				
					
						
					
				
				
				 | 
			
			 | 
			
			@ -49,49 +49,27 @@ | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			#if defined(_WIN32) | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			    #include <conio.h>          // Windows only, no stardard library | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			#else | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			     | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			// Provide kbhit() function in non-Windows platforms | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			#include <stdio.h> | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			#include <termios.h> | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			#include <unistd.h> | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			#include <fcntl.h> | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			
 | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			// Check if a key has been pressed | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			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; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			} | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			
 | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			// Get pressed character | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			static char getch() { return getchar(); } | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			
 | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			    // Required for kbhit() function in non-Windows platforms | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			    #include <stdio.h> | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			    #include <termios.h> | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			    #include <unistd.h> | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			    #include <fcntl.h> | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			#endif | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			
 | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			#define KEY_ESCAPE  27 | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			
 | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			int main() | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			//---------------------------------------------------------------------------------- | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			// Module Functions Declaration | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			//---------------------------------------------------------------------------------- | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			#if !defined(_WIN32) | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			static int kbhit(void);             // Check if a key has been pressed | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			static char getch();                // Get pressed character | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			#endif | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			
 | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			//------------------------------------------------------------------------------------ | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			// Program main entry point | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			//------------------------------------------------------------------------------------ | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			int main(int argc, char *argv[]) | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			{ | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			    // Initialization | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			    //-------------------------------------------------------------------------------------- | 
			
		
		
	
	
		
			
				| 
				
				
				
					
						
					
				
				 | 
			
			 | 
			
			@ -113,17 +91,10 @@ int main() | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			    { | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			        if (kbhit()) key = getch(); | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			
 | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			        if (key == 's') | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			        { | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			            PlaySound(fxWav); | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			            key = 0; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			        } | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			
 | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			        if (key == 'd') | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			        { | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			            PlaySound(fxOgg); | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			            key = 0; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			        } | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			        if ((key == 's') || (key == 'S')) PlaySound(fxWav); | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			        if ((key == 'd') || (key == 'D')) PlaySound(fxOgg); | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			         | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			        key = 0; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			
 | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			        UpdateMusicStream(music); | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			    } | 
			
		
		
	
	
		
			
				| 
				
				
				
					
						
					
				
				 | 
			
			 | 
			
			@ -140,3 +111,39 @@ int main() | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			
 | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			    return 0; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			} | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			
 | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			//---------------------------------------------------------------------------------- | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			// Module Functions Definition | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			//---------------------------------------------------------------------------------- | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			#if !defined(_WIN32) | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			// Check if a key has been pressed | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			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; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			} | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			
 | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			// Get pressed character | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			static char getch() { return getchar(); } | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			#endif |