Refactor _drawIcon function to make accessible outside

This commit is contained in:
brunoherbelin
2025-11-01 23:36:22 +01:00
parent 0e11072070
commit 16e6437dc4
2 changed files with 6 additions and 1 deletions

View File

@@ -173,12 +173,15 @@ bool ImGuiToolkit::ButtonSwitch(const char* label, bool* toggle, const char* too
void _drawIcon(ImVec2 screenpos, int i, int j, bool enabled = true, ImGuiWindow* window = ImGui::GetCurrentWindow() )
void _drawIcon(ImVec2 screenpos, int i, int j, bool enabled, ImGuiWindow* window )
{
// icons.dds is a 20 x 20 grid of icons
if (textureicons == 0)
textureicons = Resource::getTextureDDS("images/icons.dds");
if (window == nullptr)
window = ImGui::GetCurrentWindow();
ImVec2 uv0( static_cast<float>(i) * 0.05, static_cast<float>(j) * 0.05 );
ImVec2 uv1( uv0.x + 0.05, uv0.y + 0.05 );

View File

@@ -12,6 +12,8 @@
#include "IconsFontAwesome5.h"
void _drawIcon(ImVec2 screenpos, int i, int j, bool enabled = true, struct ImGuiWindow* window = nullptr );
namespace ImGuiToolkit
{
// Icons from resource icon.dds