MCPcopy Create free account
hub / github.com/crosire/reshade / draw_gui

Method draw_gui

source/runtime_gui.cpp:755–1520  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

753}
754
755void reshade::runtime::draw_gui()
756{
757 assert(_is_initialized);
758
759 bool show_overlay = _show_overlay;
760 api::input_source show_overlay_source = _imgui_context->NavInputSource == ImGuiInputSource_Mouse ? api::input_source::mouse : api::input_source::keyboard;
761
762 if (_input != nullptr)
763 {
764 if (_show_overlay && !_ignore_shortcuts && _input->is_key_pressed(0x1B /* VK_ESCAPE */) &&
765 (_input_processing_mode == 2 || (_input_processing_mode == 1 && (_imgui_context->IO.WantCaptureMouse || _imgui_context->IO.WantCaptureKeyboard))) && !_imgui_context->IO.NavVisible)
766 show_overlay = false; // Close when pressing the escape button, input focus is on the overlay and not currently navigating with the keyboard
767 else if (!_ignore_shortcuts && _input->is_key_pressed(_overlay_key_data, _force_shortcut_modifiers) && _imgui_context->ActiveId == 0)
768 show_overlay = !_show_overlay;
769
770 if (!_ignore_shortcuts)
771 {
772 if (_input->is_key_pressed(_fps_key_data, _force_shortcut_modifiers))
773 _show_fps = _show_fps ? 0 : 1;
774 if (_input->is_key_pressed(_frametime_key_data, _force_shortcut_modifiers))
775 _show_frametime = _show_frametime ? 0 : 1;
776 }
777 }
778
779 if (_input_gamepad != nullptr)
780 {
781 if (_input_gamepad->is_button_down(input_gamepad::button_left_shoulder) &&
782 _input_gamepad->is_button_down(input_gamepad::button_right_shoulder) &&
783 _input_gamepad->is_button_pressed(input_gamepad::button_start))
784 {
785 show_overlay = !_show_overlay;
786 show_overlay_source = api::input_source::gamepad;
787 }
788 }
789
790 if (show_overlay != _show_overlay)
791 open_overlay(show_overlay, show_overlay_source);
792
793 const bool show_splash_window = _show_splash && (is_loading() || (_reload_count <= 1 && (_last_present_time - _last_reload_time) < std::chrono::seconds(5)) || (!_show_overlay && _tutorial_index == 0 && _input != nullptr));
794
795 // Do not show this message in the same frame the screenshot is taken (so that it won't show up on the GUI screenshot)
796 const bool show_screenshot_message = (_show_screenshot_message || !_last_screenshot_save_successful) && !_should_save_screenshot && (_last_present_time - _last_screenshot_time) < std::chrono::seconds(_last_screenshot_save_successful ? 3 : 5);
797 const bool show_preset_transition_message = _show_preset_transition_message && _is_in_preset_transition;
798 const bool show_message_window = show_screenshot_message || show_preset_transition_message || !_preset_save_successful;
799
800 const bool show_clock = _show_clock == 1 || (_show_overlay && _show_clock > 1);
801 const bool show_fps = _show_fps == 1 || (_show_overlay && _show_fps > 1);
802 const bool show_frametime = _show_frametime == 1 || (_show_overlay && _show_frametime > 1);
803 const bool show_preset_name = _show_preset_name == 1 || (_show_overlay && _show_preset_name > 1);
804 bool show_statistics_window = show_clock || show_fps || show_frametime || show_preset_name;
805#if RESHADE_ADDON
806 for (const addon_info &info : addon_loaded_info)
807 {
808 for (const addon_info::overlay_callback &widget : info.overlay_callbacks)
809 {
810 if (widget.title == "OSD")
811 {
812 show_statistics_window = true;

Callers

nothing calls this directly

Calls 15

is_loadingFunction · 0.85
SetNextWindowPosFunction · 0.85
SetNextWindowSizeFunction · 0.85
PushStyleVarFunction · 0.85
PushStyleColorFunction · 0.85
BeginFunction · 0.85
GetFontSizeFunction · 0.85
TextUnformattedFunction · 0.85
TextColoredFunction · 0.85
TextFunction · 0.85
SpacingFunction · 0.85
ProgressBarFunction · 0.85

Tested by

no test coverage detected