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:
Niels Martin Hansen
2018-07-19 21:17:07 +02:00
committed by Patric Stout
parent a3d1950b65
commit 2a868b9f3b
33 changed files with 1194 additions and 11 deletions

View File

@@ -24,6 +24,7 @@
#include "../network/network.h"
#include "../core/random_func.hpp"
#include "../core/math_func.hpp"
#include "../framerate_type.h"
#include "allegro_v.h"
#include <allegro.h>
@@ -56,6 +57,8 @@ void VideoDriver_Allegro::MakeDirty(int left, int top, int width, int height)
static void DrawSurfaceToScreen()
{
PerformanceMeasurer framerate(PFE_VIDEO);
int n = _num_dirty_rects;
if (n == 0) return;

View File

@@ -33,6 +33,7 @@
#include "cocoa_v.h"
#include "../../core/math_func.hpp"
#include "../../gfx_func.h"
#include "../../framerate_type.h"
/* On some old versions of MAC OS this may not be defined.
* Those versions generally only produce code for PPC. So it should be safe to
@@ -431,6 +432,8 @@ WindowQuartzSubdriver::~WindowQuartzSubdriver()
void WindowQuartzSubdriver::Draw(bool force_update)
{
PerformanceMeasurer framerate(PFE_VIDEO);
/* Check if we need to do anything */
if (this->num_dirty_rects == 0 || [ this->window isMiniaturized ]) return;

View File

@@ -32,6 +32,7 @@
#include "cocoa_v.h"
#include "../../core/math_func.hpp"
#include "../../gfx_func.h"
#include "../../framerate_type.h"
/**
* Important notice regarding all modifications!!!!!!!
@@ -361,6 +362,8 @@ WindowQuickdrawSubdriver::~WindowQuickdrawSubdriver()
void WindowQuickdrawSubdriver::Draw(bool force_update)
{
PerformanceMeasurer framerate(PFE_VIDEO);
/* Check if we need to do anything */
if (this->num_dirty_rects == 0 || [ this->window isMiniaturized ]) return;

View File

@@ -23,6 +23,7 @@
#include "../core/random_func.hpp"
#include "../core/math_func.hpp"
#include "../fileio_func.h"
#include "../framerate_type.h"
#include "sdl_v.h"
#include <SDL.h>
@@ -148,6 +149,8 @@ static void CheckPaletteAnim()
static void DrawSurfaceToScreen()
{
PerformanceMeasurer framerate(PFE_VIDEO);
int n = _num_dirty_rects;
if (n == 0) return;

View File

@@ -23,6 +23,7 @@
#include "../progress.h"
#include "../window_gui.h"
#include "../window_func.h"
#include "../framerate_type.h"
#include "win32_v.h"
#include <windows.h>
#include <imm.h>
@@ -359,6 +360,8 @@ bool VideoDriver_Win32::MakeWindow(bool full_screen)
/** Do palette animation and blit to the window. */
static void PaintWindow(HDC dc)
{
PerformanceMeasurer framerate(PFE_VIDEO);
HDC dc2 = CreateCompatibleDC(dc);
HBITMAP old_bmp = (HBITMAP)SelectObject(dc2, _wnd.dib_sect);
HPALETTE old_palette = SelectPalette(dc, _wnd.gdi_palette, FALSE);