summaryrefslogtreecommitdiff
path: root/src/graphics.h
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-03-25 08:29:53 +0100
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-03-26 07:30:39 +0000
commitda7a32c6ea92242c99412c2702ad59df36007de4 (patch)
tree79bea6d27c808d4fe5ac63941f8cbb52afb34552 /src/graphics.h
parent4091bd9568e5aff4a1f24416d26da567a2c076ad (diff)
downloadmana-da7a32c6ea92242c99412c2702ad59df36007de4.tar.gz
mana-da7a32c6ea92242c99412c2702ad59df36007de4.tar.bz2
mana-da7a32c6ea92242c99412c2702ad59df36007de4.tar.xz
mana-da7a32c6ea92242c99412c2702ad59df36007de4.zip
Added support for HiDPI fonts
* TrueTypeFont class now takes into account the graphics scale, in order to render an appropriate higher-resolution texture. * Removed TrueTypeFont::fontCounter, since TTF_Init/TTF_Quit already keep a counter. * Avoid copying the rendered string needlessly, when it already exists in the cache. Avoid another copy, when inserting a new chunk into the cache.
Diffstat (limited to 'src/graphics.h')
-rw-r--r--src/graphics.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/graphics.h b/src/graphics.h
index 79513e2c..55f67568 100644
--- a/src/graphics.h
+++ b/src/graphics.h
@@ -203,6 +203,11 @@ class Graphics : public gcn::Graphics
int getHeight() const { return mHeight; }
/**
+ * Returns the graphics scale.
+ */
+ float getScale() const { return mScale; }
+
+ /**
* Converts a window coordinate to a logical coordinate. Used for
* converting mouse coordinates.
*/
@@ -237,6 +242,7 @@ class Graphics : public gcn::Graphics
protected:
int mWidth = 0;
int mHeight = 0;
+ float mScale = 1.0f;
gcn::Color mColor;
};