From c6291bcd8a49055ce2158f88759a487de5b8d1bd Mon Sep 17 00:00:00 2001 From: Voylin <0voylin0@gmail.com> Date: Tue, 3 May 2022 08:29:38 +0900 Subject: Adding print_rich for printing with BBCode --- core/os/os.cpp | 15 +++++++++++++++ core/os/os.h | 1 + 2 files changed, 16 insertions(+) (limited to 'core/os') diff --git a/core/os/os.cpp b/core/os/os.cpp index 93477f4288..b9daf6fa53 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -100,6 +100,21 @@ void OS::print(const char *p_format, ...) { va_end(argp); } +void OS::print_rich(const char *p_format, ...) { + if (!_stdout_enabled) { + return; + } + + va_list argp; + va_start(argp, p_format); + + if (_logger) { + _logger->logv(p_format, argp, false); + } + + va_end(argp); +} + void OS::printerr(const char *p_format, ...) { if (!_stderr_enabled) { return; diff --git a/core/os/os.h b/core/os/os.h index c6ea9d869a..af6c38cbe0 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -120,6 +120,7 @@ public: void print_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, bool p_editor_notify = false, Logger::ErrorType p_type = Logger::ERR_ERROR); void print(const char *p_format, ...) _PRINTF_FORMAT_ATTRIBUTE_2_3; + void print_rich(const char *p_format, ...) _PRINTF_FORMAT_ATTRIBUTE_2_3; void printerr(const char *p_format, ...) _PRINTF_FORMAT_ATTRIBUTE_2_3; virtual String get_stdin_string(bool p_block = true) = 0; -- cgit v1.2.3