From 6276001a7c1a04575028885d20d13d45df3d1981 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 8 Apr 2020 18:53:47 +0200 Subject: [PATCH] - cleanup --- source/CMakeLists.txt | 4 ++-- .../{core/utility => common/engine}/stats.cpp | 3 ++- .../{core/utility => common/engine}/stats.h | 19 +++++++++++++++++-- source/core/2d/drawparms.h | 2 ++ source/core/2d/v_2ddrawer.h | 6 ++++++ source/core/2d/v_draw.h | 6 ------ 6 files changed, 29 insertions(+), 11 deletions(-) rename source/{core/utility => common/engine}/stats.cpp (98%) rename source/{core/utility => common/engine}/stats.h (95%) diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index d7a9396c3..4a246e52b 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -808,6 +808,7 @@ set (PCH_SOURCES common/filesystem/file_whres.cpp common/filesystem/file_directory.cpp common/filesystem/resourcefile.cpp + common/engine/stats.cpp common/engine/sc_man.cpp common/engine/palettecontainer.cpp common/engine/stringtable.cpp @@ -836,8 +837,7 @@ set (PCH_SOURCES common/scripting/backend/vmbuilder.cpp common/scripting/backend/codegen.cpp - core/utility/stats.cpp - + core/textures/buildtiles.cpp core/textures/texture.cpp core/textures/imagetexture.cpp diff --git a/source/core/utility/stats.cpp b/source/common/engine/stats.cpp similarity index 98% rename from source/core/utility/stats.cpp rename to source/common/engine/stats.cpp index 71f926269..9870be767 100644 --- a/source/core/utility/stats.cpp +++ b/source/common/engine/stats.cpp @@ -33,7 +33,8 @@ */ #include "stats.h" -#include "v_draw.h" +#include "v_2ddrawer.h" +#include "drawparms.h" #include "v_text.h" #include "v_font.h" #include "c_console.h" diff --git a/source/core/utility/stats.h b/source/common/engine/stats.h similarity index 95% rename from source/core/utility/stats.h rename to source/common/engine/stats.h index 32a12251a..1a01b674c 100644 --- a/source/core/utility/stats.h +++ b/source/common/engine/stats.h @@ -97,6 +97,7 @@ private: #else // Windows and macOS +#include "x86.h" extern double PerfToSec, PerfToMillisec; @@ -184,13 +185,27 @@ private: #endif +class glcycle_t : public cycle_t +{ +public: + static bool active; + void Clock() + { + if (active) cycle_t::Clock(); + } + + void Unclock() + { + if (active) cycle_t::Unclock(); + } +}; // Helper for code that uses a timer and has multiple exit points. class Clocker { public: - Clocker(cycle_t& clck) + explicit Clocker(glcycle_t& clck) : clock(clck) { clock.Clock(); @@ -204,7 +219,7 @@ public: Clocker(const Clocker&) = delete; Clocker& operator=(const Clocker&) = delete; private: - cycle_t & clock; + glcycle_t & clock; }; diff --git a/source/core/2d/drawparms.h b/source/core/2d/drawparms.h index c7b97a62f..2f3c59ca6 100644 --- a/source/core/2d/drawparms.h +++ b/source/core/2d/drawparms.h @@ -109,6 +109,8 @@ enum DTA_Burn, // activates the burn shader for this element DTA_Spacing, // Strings only: Additional spacing between characters DTA_Monospace, // Fonts only: Use a fixed distance between characters. + + DTA_FullscreenEx, }; enum EMonospacing : int diff --git a/source/core/2d/v_2ddrawer.h b/source/core/2d/v_2ddrawer.h index e67d1366b..032cecde6 100644 --- a/source/core/2d/v_2ddrawer.h +++ b/source/core/2d/v_2ddrawer.h @@ -178,4 +178,10 @@ public: } }; +void DrawTexture(F2DDrawer* drawer, FTexture* img, double x, double y, int tags_first, ...); +void DrawChar(F2DDrawer* drawer, FFont* font, int normalcolor, double x, double y, int character, int tag_first, ...); +void DrawText(F2DDrawer* drawer, FFont* font, int normalcolor, double x, double y, const char* string, int tag_first, ...); +void DrawText(F2DDrawer* drawer, FFont* font, int normalcolor, double x, double y, const char32_t* string, int tag_first, ...); +void DrawFrame(F2DDrawer* twod, PalEntry color, int left, int top, int width, int height, int thickness); + #endif diff --git a/source/core/2d/v_draw.h b/source/core/2d/v_draw.h index 58cfddb64..f7868bd80 100644 --- a/source/core/2d/v_draw.h +++ b/source/core/2d/v_draw.h @@ -39,12 +39,6 @@ bool AspectTallerThanWide(float aspect); void ScaleWithAspect(int& w, int& h, int Width, int Height); void V_UpdateModeSize(int width, int height); -void DrawTexture(F2DDrawer *drawer, FTexture* img, double x, double y, int tags_first, ...); -void DrawChar (F2DDrawer* drawer, FFont *font, int normalcolor, double x, double y, int character, int tag_first, ...); -void DrawText(F2DDrawer* drawer, FFont *font, int normalcolor, double x, double y, const char *string, int tag_first, ...); -void DrawText(F2DDrawer* drawer, FFont *font, int normalcolor, double x, double y, const char32_t *string, int tag_first, ...); -void DrawFrame(F2DDrawer* twod, PalEntry color, int left, int top, int width, int height, int thickness); - EXTERN_CVAR(Int, con_scaletext) // Scale notify text at high resolutions? EXTERN_CVAR(Int, con_scale)