Beispiel #1
0
        void DrawSettings()
        {
            _frameRateArray[_frameRateArrayIndex] = ImGui.GetIO().Framerate;
            _frameRateArrayIndex = (_frameRateArrayIndex + 1) % _frameRateArray.Length;

            ImGui.PlotLines("##hidelabel", ref _frameRateArray[0], _frameRateArray.Length, _frameRateArrayIndex, $"FPS: {ImGui.GetIO().Framerate:0}", 0, 60, new Num.Vector2(ImGui.GetContentRegionAvail().X, 50));

            NezImGui.SmallVerticalSpace();

            if (ImGui.CollapsingHeader("Core Settings", ImGuiTreeNodeFlags.DefaultOpen))
            {
                ImGui.Checkbox("exitOnEscapeKeypress", ref Core.ExitOnEscapeKeypress);
                ImGui.Checkbox("pauseOnFocusLost", ref Core.PauseOnFocusLost);
                ImGui.Checkbox("debugRenderEnabled", ref Core.DebugRenderEnabled);
            }

            if (ImGui.CollapsingHeader("Core.defaultSamplerState", ImGuiTreeNodeFlags.DefaultOpen))
            {
                #if !FNA
                ImGui.PushStyleVar(ImGuiStyleVar.Alpha, ImGui.GetStyle().Alpha * 0.5f);
                NezImGui.DisableNextWidget();
                #endif

                var currentTextureFilter = (int)Core.DefaultSamplerState.Filter;
                if (ImGui.Combo("Filter", ref currentTextureFilter, _textureFilters, _textureFilters.Length))
                {
                    Core.DefaultSamplerState.Filter = (TextureFilter)Enum.Parse(typeof(TextureFilter), _textureFilters[currentTextureFilter]);
                }

                #if !FNA
                ImGui.PopStyleVar();
                #endif
            }
        }
Beispiel #2
0
        /// <summary>
        /// Draws a control disabled if a condition is met.
        /// Intended to draw a single ImGui control.
        /// </summary>
        public static void DrawDisabledIf(bool disabled, Action a)
        {
            if (a == null)
            {
                return;
            }

            if (disabled)
            {
                ImGui.PushStyleVar(ImGuiStyleVar.Alpha, ImGui.GetStyle().Alpha * 0.5f);
                NezImGui.DisableNextWidget();
            }
            a();
            if (disabled)
            {
                ImGui.PopStyleVar();
            }
        }