From b6b7bcace1249a8bb9c7e22c03d207f5cd4a2809 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 14 Jun 2020 16:54:14 -0400 Subject: [PATCH] CFont: In-class initialize members where applicable Provides a consistent initial state. --- src/Core/Resource/CFont.cpp | 10 ++++------ src/Core/Resource/CFont.h | 13 +++++++------ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/Core/Resource/CFont.cpp b/src/Core/Resource/CFont.cpp index 1a4d4f5e..be4293ef 100644 --- a/src/Core/Resource/CFont.cpp +++ b/src/Core/Resource/CFont.cpp @@ -4,16 +4,14 @@ #include "Core/Render/CRenderer.h" std::optional CFont::smGlyphVertices; - CIndexBuffer CFont::smGlyphIndices; - bool CFont::smBuffersInitialized = false; +CIndexBuffer CFont::smGlyphIndices; +bool CFont::smBuffersInitialized = false; -CFont::CFont(CResourceEntry *pEntry /*= 0*/) : CResource(pEntry) +CFont::CFont(CResourceEntry *pEntry) : CResource(pEntry) { } -CFont::~CFont() -{ -} +CFont::~CFont() = default; inline float PtsToFloat(int32 Pt) { diff --git a/src/Core/Resource/CFont.h b/src/Core/Resource/CFont.h index 6b5223cd..045ebb60 100644 --- a/src/Core/Resource/CFont.h +++ b/src/Core/Resource/CFont.h @@ -12,6 +12,7 @@ #include #include #include +#include #define CFONT_DEFAULT_SIZE -1 @@ -25,14 +26,14 @@ class CFont : public CResource static CIndexBuffer smGlyphIndices; // This is the index buffer used to draw glyphs. It uses a triangle strip. static bool smBuffersInitialized; // This bool indicates whether the vertex/index buffer have been initialized. Checked at the start of RenderString(). - uint32 mUnknown; // Value at offset 0x8. Not sure what this is. Including for experimentation purposes. - uint32 mLineHeight; // Height of each line, in points - uint32 mLineMargin; // Gap between lines, in points - this is added to the line height - uint32 mVerticalOffset; // In points. This is used to reposition glyphs after the per-glyph vertical offset is applied - uint32 mDefaultSize; // In points. + uint32 mUnknown = 0; // Value at offset 0x8. Not sure what this is. Including for experimentation purposes. + uint32 mLineHeight = 0; // Height of each line, in points + uint32 mLineMargin = 0; // Gap between lines, in points - this is added to the line height + uint32 mVerticalOffset = 0; // In points. This is used to reposition glyphs after the per-glyph vertical offset is applied + uint32 mDefaultSize = 0; // In points. TString mFontName; // Self-explanatory TResPtr mpFontTexture; // The texture used by this font - uint32 mTextureFormat; // Indicates which layers on the texture are for what - multiple glyph layers or fill/stroke + uint32 mTextureFormat = 0; // Indicates which layers on the texture are for what - multiple glyph layers or fill/stroke struct SGlyph {