mirror of
https://github.com/gwm17/implot.git
synced 2024-11-22 18:28:53 -05:00
Fix for allowing core imgui to use typed ImGuiCol / ImGuiStyleVar enums. (#405)
This commit is contained in:
parent
6978a3e177
commit
8879c99aef
14
implot.cpp
14
implot.cpp
|
@ -4235,7 +4235,7 @@ ImPlotStyle& GetStyle() {
|
|||
void PushStyleColor(ImPlotCol idx, ImU32 col) {
|
||||
ImPlotContext& gp = *GImPlot;
|
||||
ImGuiColorMod backup;
|
||||
backup.Col = idx;
|
||||
backup.Col = (ImGuiCol)idx;
|
||||
backup.BackupValue = gp.Style.Colors[idx];
|
||||
gp.ColorModifiers.push_back(backup);
|
||||
gp.Style.Colors[idx] = ImGui::ColorConvertU32ToFloat4(col);
|
||||
|
@ -4244,7 +4244,7 @@ void PushStyleColor(ImPlotCol idx, ImU32 col) {
|
|||
void PushStyleColor(ImPlotCol idx, const ImVec4& col) {
|
||||
ImPlotContext& gp = *GImPlot;
|
||||
ImGuiColorMod backup;
|
||||
backup.Col = idx;
|
||||
backup.Col = (ImGuiCol)idx;
|
||||
backup.BackupValue = gp.Style.Colors[idx];
|
||||
gp.ColorModifiers.push_back(backup);
|
||||
gp.Style.Colors[idx] = col;
|
||||
|
@ -4267,7 +4267,7 @@ void PushStyleVar(ImPlotStyleVar idx, float val) {
|
|||
const ImPlotStyleVarInfo* var_info = GetPlotStyleVarInfo(idx);
|
||||
if (var_info->Type == ImGuiDataType_Float && var_info->Count == 1) {
|
||||
float* pvar = (float*)var_info->GetVarPtr(&gp.Style);
|
||||
gp.StyleModifiers.push_back(ImGuiStyleMod(idx, *pvar));
|
||||
gp.StyleModifiers.push_back(ImGuiStyleMod((ImGuiStyleVar)idx, *pvar));
|
||||
*pvar = val;
|
||||
return;
|
||||
}
|
||||
|
@ -4279,27 +4279,27 @@ void PushStyleVar(ImPlotStyleVar idx, int val) {
|
|||
const ImPlotStyleVarInfo* var_info = GetPlotStyleVarInfo(idx);
|
||||
if (var_info->Type == ImGuiDataType_S32 && var_info->Count == 1) {
|
||||
int* pvar = (int*)var_info->GetVarPtr(&gp.Style);
|
||||
gp.StyleModifiers.push_back(ImGuiStyleMod(idx, *pvar));
|
||||
gp.StyleModifiers.push_back(ImGuiStyleMod((ImGuiStyleVar)idx, *pvar));
|
||||
*pvar = val;
|
||||
return;
|
||||
}
|
||||
else if (var_info->Type == ImGuiDataType_Float && var_info->Count == 1) {
|
||||
float* pvar = (float*)var_info->GetVarPtr(&gp.Style);
|
||||
gp.StyleModifiers.push_back(ImGuiStyleMod(idx, *pvar));
|
||||
gp.StyleModifiers.push_back(ImGuiStyleMod((ImGuiStyleVar)idx, *pvar));
|
||||
*pvar = (float)val;
|
||||
return;
|
||||
}
|
||||
IM_ASSERT(0 && "Called PushStyleVar() int variant but variable is not a int!");
|
||||
}
|
||||
|
||||
void PushStyleVar(ImGuiStyleVar idx, const ImVec2& val)
|
||||
void PushStyleVar(ImPlotStyleVar idx, const ImVec2& val)
|
||||
{
|
||||
ImPlotContext& gp = *GImPlot;
|
||||
const ImPlotStyleVarInfo* var_info = GetPlotStyleVarInfo(idx);
|
||||
if (var_info->Type == ImGuiDataType_Float && var_info->Count == 2)
|
||||
{
|
||||
ImVec2* pvar = (ImVec2*)var_info->GetVarPtr(&gp.Style);
|
||||
gp.StyleModifiers.push_back(ImGuiStyleMod(idx, *pvar));
|
||||
gp.StyleModifiers.push_back(ImGuiStyleMod((ImGuiStyleVar)idx, *pvar));
|
||||
*pvar = val;
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user