|
@@ -221,68 +221,64 @@ protected:
|
|
|
/**
|
|
|
* Handle input logic, is CTRL pressed, should we fast-forward, etc.
|
|
|
*/
|
|
|
virtual void InputLoop() {}
|
|
|
|
|
|
/**
|
|
|
* Make sure the video buffer is ready for drawing.
|
|
|
* @returns True if the video buffer has to be unlocked.
|
|
|
*/
|
|
|
virtual bool LockVideoBuffer() {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Unlock a previously locked video buffer.
|
|
|
*/
|
|
|
virtual void UnlockVideoBuffer() {}
|
|
|
|
|
|
/**
|
|
|
* Paint the window.
|
|
|
*/
|
|
|
virtual void Paint() {}
|
|
|
|
|
|
/**
|
|
|
* Thread function for threaded drawing.
|
|
|
*/
|
|
|
virtual void PaintThread() {}
|
|
|
|
|
|
/**
|
|
|
* Process any pending palette animation.
|
|
|
*/
|
|
|
virtual void CheckPaletteAnim() {}
|
|
|
|
|
|
/**
|
|
|
* Process a single system event.
|
|
|
* @returns False if there are no more events to process.
|
|
|
*/
|
|
|
virtual bool PollEvent() { return false; };
|
|
|
|
|
|
/**
|
|
|
* Run the game for a single tick, processing boththe game-tick and draw-tick.
|
|
|
* @returns True if the driver should redraw the screen.
|
|
|
* Give the video-driver a tick.
|
|
|
* It will process any potential game-tick and/or draw-tick, and/or any
|
|
|
* other video-driver related event.
|
|
|
*/
|
|
|
bool Tick();
|
|
|
void Tick();
|
|
|
|
|
|
/**
|
|
|
* Sleep till the next tick is about to happen.
|
|
|
*/
|
|
|
void SleepTillNextTick();
|
|
|
|
|
|
std::chrono::steady_clock::duration GetGameInterval()
|
|
|
{
|
|
|
/* If we are paused, run on normal speed. */
|
|
|
if (_pause_mode) return std::chrono::milliseconds(MILLISECONDS_PER_TICK);
|
|
|
/* Infinite speed, as quickly as you can. */
|
|
|
if (_game_speed == 0) return std::chrono::microseconds(0);
|
|
|
|
|
|
return std::chrono::microseconds(MILLISECONDS_PER_TICK * 1000 * 100 / _game_speed);
|
|
|
}
|
|
|
|
|
|
std::chrono::steady_clock::duration GetDrawInterval()
|
|
|
{
|
|
|
return std::chrono::microseconds(1000000 / _settings_client.gui.refresh_rate);
|
|
|
}
|
|
|
|
|
|
std::chrono::steady_clock::time_point next_game_tick;
|
|
|
std::chrono::steady_clock::time_point next_draw_tick;
|
|
|
|