Files
OpenVulkano/openVulkanoCpp/Scene/UI/ImGuiExtensions/ImGuiTextFmt.hpp

35 lines
1009 B
C++

/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
#pragma once
#include "Extensions/FmtFormatter.hpp"
#include <imgui.h>
#include <string>
namespace ImGui
{
template <typename... Args>
void TextFmt(const std::string_view& fmt, const Args&... args)
{
std::string str = fmt::format(fmt::runtime(fmt), (args)...);
ImGui::TextUnformatted(str.data(), str.data() + str.size());
}
template <typename... Args>
void TextFmt(const std::string_view& fmt, Args&&... args)
{
std::string str = fmt::format(fmt::runtime(fmt), std::forward<Args>(args)...);
ImGui::TextUnformatted(str.data(), str.data() + str.size());
}
template <const char* FMT, typename... Args>
IMGUI_API void TextFmt(Args &&... args)
{
std::string str = fmt::format(FMT, std::forward<Args>(args)...);
ImGui::TextUnformatted(str.data(), str.data() + str.size());
}
}