win32: avoid taking 100% CPU time
This commit is contained in:
		
							parent
							
								
									467eeaf217
								
							
						
					
					
						commit
						eb65d1006a
					
				@ -1171,6 +1171,14 @@ int Get_input(int sleep_time)
 | 
			
		||||
	    }
 | 
			
		||||
      return 1;
 | 
			
		||||
    }
 | 
			
		||||
    if (sleep_time == 0)
 | 
			
		||||
      sleep_time = 20;  // default of 20 ms
 | 
			
		||||
    // TODO : we should check where Get_input(0) is called
 | 
			
		||||
    {
 | 
			
		||||
      UINT_PTR timerId = SetTimer(NULL, 0, sleep_time, NULL);
 | 
			
		||||
      WaitMessage();
 | 
			
		||||
      KillTimer(NULL, timerId);
 | 
			
		||||
    }
 | 
			
		||||
#endif
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -57,6 +57,10 @@
 | 
			
		||||
#define snprintf _snprintf
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
#if defined(WIN32)
 | 
			
		||||
#include <windows.h>
 | 
			
		||||
#include <malloc.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined(USE_SDL) || defined(USE_SDL2)
 | 
			
		||||
#include <SDL_image.h>
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user