From fd436de602773ce1a17dd3b0413fb2e4c08f96f2 Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Mon, 16 May 2022 04:05:18 -0400 Subject: [PATCH] Clean up font setting --- examples/text/text_font_filters.cpp | 5 ++--- include/Text.hpp | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/examples/text/text_font_filters.cpp b/examples/text/text_font_filters.cpp index 06f12df..f7586d9 100644 --- a/examples/text/text_font_filters.cpp +++ b/examples/text/text_font_filters.cpp @@ -48,7 +48,7 @@ int main(void) { // Update //---------------------------------------------------------------------------------- - msg.SetFontSize(msg.GetFontSize() + GetMouseWheelMove() * 4.0f); + msg.fontSize += GetMouseWheelMove() * 4.0f; // Choose font texture filter method if (IsKeyPressed(KEY_ONE)) @@ -76,8 +76,7 @@ int main(void) // Load a dropped TTF file dynamically (at current fontSize) for (const auto& file : raylib::GetDroppedFiles()) { if (raylib::IsFileExtension(file, ".ttf")) { - font = raylib::Font(file, font.GetBaseSize()); - msg.SetFont(font); + msg.font = font = raylib::Font(file, font.GetBaseSize()); } } //---------------------------------------------------------------------------------- diff --git a/include/Text.hpp b/include/Text.hpp index fc3b493..ab4b915 100644 --- a/include/Text.hpp +++ b/include/Text.hpp @@ -64,7 +64,7 @@ class Text { * * @see DrawTextPro() */ - inline void Draw(const ::Vector2& position, const Vector2& origin, float rotation = 0) { + inline void Draw(const ::Vector2& position, float rotation, const Vector2& origin = {0, 0}) { ::DrawTextPro(font, text.c_str(), position, origin, rotation, fontSize, spacing, color); }