mirror of
				https://github.com/aap/librw.git
				synced 2025-10-31 06:58:42 +00:00 
			
		
		
		
	skeleton: use SDL_GetPerformanceCounter insted of SDL_GetTicks
This commit is contained in:
		
							parent
							
								
									57559969f7
								
							
						
					
					
						commit
						711298e274
					
				| @ -224,7 +224,8 @@ main(int argc, char *argv[]) | ||||
| 	if(EventHandler(RWINITIALIZE, nil) == EVENTERROR) | ||||
| 		return 0; | ||||
| 
 | ||||
| 	float lastTime = SDL_GetTicks(); | ||||
| 	Uint64 lastTicks = SDL_GetPerformanceCounter(); | ||||
| 	const float tickPeriod = 1.f / SDL_GetPerformanceFrequency(); | ||||
| 	SDL_Event event; | ||||
| 	int mouseButtons = 0; | ||||
| 
 | ||||
| @ -297,12 +298,12 @@ main(int argc, char *argv[]) | ||||
| 			} | ||||
| 			} | ||||
| 		} | ||||
| 		float currTime  = SDL_GetTicks(); | ||||
| 		float timeDelta = (currTime - lastTime) * 0.001f; | ||||
| 		Uint64 currTicks = SDL_GetPerformanceCounter(); | ||||
| 		float timeDelta = (currTicks - lastTicks) * tickPeriod; | ||||
| 
 | ||||
| 		EventHandler(IDLE, &timeDelta); | ||||
| 
 | ||||
| 		lastTime = currTime; | ||||
| 		lastTicks = currTicks; | ||||
| 	} | ||||
| 
 | ||||
| 	SDL_StopTextInput(); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user