From 0139a6e86f2785588a08602faddff2d3061f9e12 Mon Sep 17 00:00:00 2001 From: nullifiedcat Date: Fri, 21 Jul 2017 16:28:18 +0300 Subject: [PATCH] Draw menu ABOVE visuals. Don't draw anything with no_visuals 1 --- src/hooks/PaintTraverse.h | 1 + src/hooks/sdl.cpp | 17 ++++++++--------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/hooks/PaintTraverse.h b/src/hooks/PaintTraverse.h index 2c463d4a..ad70f2b0 100644 --- a/src/hooks/PaintTraverse.h +++ b/src/hooks/PaintTraverse.h @@ -12,6 +12,7 @@ class CatVar; extern CatVar no_zoom; extern CatVar clean_screenshots; +extern CatVar disable_visuals; void PaintTraverse_hook(void*, unsigned int, bool, bool); #endif /* PAINTTRAVERSE_H_ */ diff --git a/src/hooks/sdl.cpp b/src/hooks/sdl.cpp index 7c0595ee..5e3e7504 100644 --- a/src/hooks/sdl.cpp +++ b/src/hooks/sdl.cpp @@ -38,7 +38,7 @@ void SDL_GL_SwapWindow_hook(SDL_Window* window) { static SDL_GLContext ctx_tf2 = SDL_GL_GetCurrentContext(); static SDL_GLContext ctx_imgui = nullptr; static SDL_GLContext ctx_text = nullptr; - { + if (!disable_visuals) { PROF_SECTION(DRAW_cheat); if (!ctx_imgui) { ctx_imgui = SDL_GL_CreateContext(window); @@ -55,15 +55,7 @@ void SDL_GL_SwapWindow_hook(SDL_Window* window) { return; } - SDL_GL_MakeCurrent(window, ctx_imgui); - { - PROF_SECTION(DRAW_imgui); - ImGui_ImplSdl_NewFrame(window); - menu::im::Render(); - ImGui::Render(); - } SDL_GL_MakeCurrent(window, ctx_text); - { std::lock_guard draw_lock(drawing_mutex); drawgl::PreRender(); @@ -79,6 +71,13 @@ void SDL_GL_SwapWindow_hook(SDL_Window* window) { drawgl::PostRender(); } + SDL_GL_MakeCurrent(window, ctx_imgui); + { + PROF_SECTION(DRAW_imgui); + ImGui_ImplSdl_NewFrame(window); + menu::im::Render(); + ImGui::Render(); + } } { PROF_SECTION(DRAW_valve);