Draw menu ABOVE visuals. Don't draw anything with no_visuals 1

This commit is contained in:
nullifiedcat 2017-07-21 16:28:18 +03:00
parent 368603552e
commit 0139a6e86f
2 changed files with 9 additions and 9 deletions

View File

@ -12,6 +12,7 @@ class CatVar;
extern CatVar no_zoom; extern CatVar no_zoom;
extern CatVar clean_screenshots; extern CatVar clean_screenshots;
extern CatVar disable_visuals;
void PaintTraverse_hook(void*, unsigned int, bool, bool); void PaintTraverse_hook(void*, unsigned int, bool, bool);
#endif /* PAINTTRAVERSE_H_ */ #endif /* PAINTTRAVERSE_H_ */

View File

@ -38,7 +38,7 @@ void SDL_GL_SwapWindow_hook(SDL_Window* window) {
static SDL_GLContext ctx_tf2 = SDL_GL_GetCurrentContext(); static SDL_GLContext ctx_tf2 = SDL_GL_GetCurrentContext();
static SDL_GLContext ctx_imgui = nullptr; static SDL_GLContext ctx_imgui = nullptr;
static SDL_GLContext ctx_text = nullptr; static SDL_GLContext ctx_text = nullptr;
{ if (!disable_visuals) {
PROF_SECTION(DRAW_cheat); PROF_SECTION(DRAW_cheat);
if (!ctx_imgui) { if (!ctx_imgui) {
ctx_imgui = SDL_GL_CreateContext(window); ctx_imgui = SDL_GL_CreateContext(window);
@ -55,15 +55,7 @@ void SDL_GL_SwapWindow_hook(SDL_Window* window) {
return; 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); SDL_GL_MakeCurrent(window, ctx_text);
{ {
std::lock_guard<std::mutex> draw_lock(drawing_mutex); std::lock_guard<std::mutex> draw_lock(drawing_mutex);
drawgl::PreRender(); drawgl::PreRender();
@ -79,6 +71,13 @@ void SDL_GL_SwapWindow_hook(SDL_Window* window) {
drawgl::PostRender(); 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); PROF_SECTION(DRAW_valve);