mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-30 18:09:09 +00:00
Feature: Framerate display window (#6822)
Frame rate and various game loop/graphics timing measurements and graphs. Accessible via the Help menu, and can print some stats in the console via the fps command.
This commit is contained in:
committed by
Patric Stout
parent
a3d1950b65
commit
2a868b9f3b
@@ -12,6 +12,7 @@
|
||||
#include "stdafx.h"
|
||||
#include <math.h>
|
||||
#include "core/math_func.hpp"
|
||||
#include "framerate_type.h"
|
||||
|
||||
#include "safeguards.h"
|
||||
|
||||
@@ -138,6 +139,13 @@ static void MxCloseChannel(MixerChannel *mc)
|
||||
|
||||
void MxMixSamples(void *buffer, uint samples)
|
||||
{
|
||||
PerformanceMeasurer framerate(PFE_SOUND);
|
||||
static uint last_samples = 0;
|
||||
if (samples != last_samples) {
|
||||
framerate.SetExpectedRate((double)_play_rate / samples);
|
||||
last_samples = samples;
|
||||
}
|
||||
|
||||
MixerChannel *mc;
|
||||
|
||||
/* Clear the buffer */
|
||||
|
Reference in New Issue
Block a user