* Rewrote the timing routine to be more accurate and more stable.
* The Stopwatch is now used instead of SDL_GetTicks, as the former is
significantly more accurate.
* OS-specific delay routines are now used where possible.
- Currently, only POSIX platforms support this (using nanosleep).
Other platforms will fall back to SDL_Delay.
- Improved the SDL_Delay method to take fractional times into account
as much as possible.
* BREAKING CHANGES:
- Changed SdlWindow's Start() function to use hertz instead of
milliseconds, as that's likely going to be more intuitive for games.
- Changed SdlWindow's VideoUpdateTicks and GameUpdateTicks properties
to be VideoUpdateRate and GameUpdateRate, respectively. These also
reports the rate in hertz rather than milliseconds.
- The game loop now passes a float (delta) to OnUpdate to indicate the
expected amount of time that has passed between update calls.
* Updated the sample projects to accommodate the aforementioned breaking
changes. :)
/// Called every time the application logic update runs.
/// </summary>
protectedvirtualvoidOnUpdate(){}
protectedvirtualvoidOnUpdate(floatdelta){}
/// <summary>
/// Removes a layer from the layer stack.
@ -485,19 +536,19 @@ namespace DotSDL.Graphics {
/// <summary>
/// Displays the window and begins executing code that's associated with it.
/// </summary>
/// <param name="updateRate">The desired number of milliseconds between frames and game logic updates. 0 causes the display and game to be continuously updated.</param>
publicvoidStart(uintupdateRate){
/// <param name="updateRate">The desired number of video and game logic updates per second. 0 causes the display and game to be updated as quickly as possible.</param>
publicvoidStart(floatupdateRate){
Start(updateRate,updateRate);
}
/// <summary>
/// Displays the window and begins executing code that's associated with it.
/// </summary>
/// <param name="drawRate">The desired number of milliseconds between draw calls. 0 causes the display to be continuously updated.</param>
/// <param name="updateRate">The desired number of milliseconds between game logic updates. 0 causes the game to be continuously updated.</param>
publicvoidStart(uintdrawRate,uintupdateRate){
VideoUpdateTicks=drawRate;
GameUpdateTicks=updateRate;
/// <param name="drawRate">The desired number of draw calls per second. 0 causes the display to be updated as quickly as possible.</param>
/// <param name="updateRate">The desired number of game logic updates per second. 0 causes the game to be updated as quickly as possible.</param>