GUI: new macro colors and fixes

bitfields now have proper macro color
macro position indicator is no longer hard-coded
This commit is contained in:
tildearrow 2024-07-04 18:08:07 -05:00
parent 32a665f2c3
commit 473defff35
6 changed files with 123 additions and 108 deletions

View file

@ -183,7 +183,7 @@ void PlotNoLerp(const char* label, const float* values, int values_count, int va
PlotNoLerpEx(ImGuiPlotType_Lines, label, &Plot_ArrayGetter, (void*)&data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size);
}
int PlotBitfieldEx(const char* label, int (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset, const char** overlay_text, int bits, ImVec2 frame_size, const bool* values_highlight, ImVec4 highlightColor)
int PlotBitfieldEx(const char* label, int (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset, const char** overlay_text, int bits, ImVec2 frame_size, const bool* values_highlight, ImVec4 highlightColor, ImVec4 color)
{
ImGuiContext& g = *GImGui;
ImGuiWindow* window = ImGui::GetCurrentWindow();
@ -232,8 +232,8 @@ int PlotBitfieldEx(const char* label, int (*values_getter)(void* data, int idx),
float t0 = 0.0f;
ImVec2 tp0 = ImVec2( t0, 0.0f ); // Point in the normalized space of our target rectangle
const ImU32 col_base = ImGui::GetColorU32(ImGuiCol_PlotHistogram);
const ImU32 col_hovered = ImGui::GetColorU32(ImGuiCol_PlotHistogramHovered);
const ImU32 col_base = ImGui::GetColorU32(color);
const ImU32 col_hovered = ImGui::GetColorU32(color);
for (int n = 0; n < res_w; n++)
{
@ -287,10 +287,10 @@ int PlotBitfieldEx(const char* label, int (*values_getter)(void* data, int idx),
return idx_hovered;
}
void PlotBitfield(const char* label, const int* values, int values_count, int values_offset, const char** overlay_text, int bits, ImVec2 graph_size, int stride, const bool* values_highlight, ImVec4 highlightColor)
void PlotBitfield(const char* label, const int* values, int values_count, int values_offset, const char** overlay_text, int bits, ImVec2 graph_size, int stride, const bool* values_highlight, ImVec4 highlightColor, ImVec4 color)
{
FurnacePlotIntArrayGetterData data(values, stride);
PlotBitfieldEx(label, &Plot_IntArrayGetter, (void*)&data, values_count, values_offset, overlay_text, bits, graph_size, values_highlight, highlightColor);
PlotBitfieldEx(label, &Plot_IntArrayGetter, (void*)&data, values_count, values_offset, overlay_text, bits, graph_size, values_highlight, highlightColor, color);
}
int PlotCustomEx(ImGuiPlotType plot_type, const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_display_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 frame_size, ImVec4 color, int highlight, std::string (*hoverFunc)(int,float,void*), void* hoverFuncUser, bool blockMode, std::string (*guideFunc)(float), const bool* values_highlight, ImVec4 highlightColor)