From 7d421d0069dbc8bcf948a29d39c3f8e65de19b33 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 26 May 2023 11:51:38 +0200 Subject: draw, editor, main: add toggling vobj display --- editor/imgui-raii.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'editor/imgui-raii.cpp') diff --git a/editor/imgui-raii.cpp b/editor/imgui-raii.cpp index c348eea6..5396196c 100644 --- a/editor/imgui-raii.cpp +++ b/editor/imgui-raii.cpp @@ -13,14 +13,26 @@ font_saver::~font_saver() ctx.FontBaseSize = font_base_size; } -font_saver::font_saver(ImGuiContext& ctx, float size) : - font_size{ctx.FontSize}, font_base_size{ctx.FontBaseSize} +font_saver::font_saver(float size) : + font_size{ImGui::GetCurrentContext()->FontSize}, + font_base_size{ImGui::GetCurrentContext()->FontBaseSize} { + auto& ctx = *ImGui::GetCurrentContext(); ctx.FontSize = size; ctx.FontBaseSize = size; } -font_saver::font_saver(float size) : font_saver{*ImGui::GetCurrentContext(), size} {} +draw_list_font_saver::draw_list_font_saver(float size) : + font_size{ImGui::GetForegroundDrawList()->_Data->FontSize} +{ + ImGui::GetForegroundDrawList()->_Data->FontSize = size; +} + +draw_list_font_saver::~draw_list_font_saver() +{ + ImGui::GetForegroundDrawList()->_Data->FontSize = font_size; +} + style_saver::style_saver() : style{ImGui::GetStyle()} {} style_saver::~style_saver() { ImGui::GetStyle() = style; } -- cgit v1.2.3