From 0d765d9fd1421103ce752856c4a51e2c7e7425e7 Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 16 Jan 2024 06:18:32 -0800 Subject: [PATCH] srb2::Draw: TextElement enhancements - Add default constructor - Add text method with no arguments: returns TextElement that inherits font and flags from drawer --- src/v_draw.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/v_draw.hpp b/src/v_draw.hpp index 5e4c93ae9..a3c0bf682 100644 --- a/src/v_draw.hpp +++ b/src/v_draw.hpp @@ -75,6 +75,8 @@ public: class TextElement { public: + explicit TextElement() {} + explicit TextElement(std::string string) : string_(string) {} template @@ -157,6 +159,8 @@ public: template void text(fmt::format_string format, Args&&... args) const { text(fmt::format(format, args...)); } + TextElement text() const { return TextElement().font(font_).flags(flags_); } + void patch(patch_t* patch) const; void patch(const char* name) const; @@ -238,7 +242,7 @@ public: #define VOID_METHOD(Name) \ template \ - void Name (Args&&... args) const { return chain_.Name(std::forward(args)...); } + auto Name (Args&&... args) const { return chain_.Name(std::forward(args)...); } VOID_METHOD(text); VOID_METHOD(patch);