public void Render()
        {
            foreach (var activeText in _activeTexts)
            {
                var(areaCompensated, compensatedFontScale) = CompensateForRender(activeText);

                var size = new Vector2(areaCompensated.Width, areaCompensated.Height);
                ImGui.SetNextWindowSize(size);
                ImGui.SetNextWindowPos(new Vector2(areaCompensated.X, areaCompensated.Y));
                ImGui.PushStyleVar(ImGuiStyleVar.Alpha, 0.8f);
                var name = activeText.GetHashCode().ToString();
                const ImGuiWindowFlags imGuiWindowFlags = ImGuiWindowFlags.NoDecoration |
                                                          ImGuiWindowFlags.NoMove |
                                                          ImGuiWindowFlags.NoNav |
                                                          ImGuiWindowFlags.NoScrollbar |
                                                          ImGuiWindowFlags.NoTitleBar |
                                                          ImGuiWindowFlags.NoResize |
                                                          ImGuiWindowFlags.NoInputs;
                ImGui.Begin(name, imGuiWindowFlags);
                ImGui.PopStyleVar();

                ImGui.PushStyleVar(ImGuiStyleVar.Alpha, 1.0f);
                ImGui.SetWindowFontScale(compensatedFontScale);
                ImGui.BeginChild(name + "text", new Vector2(), false, imGuiWindowFlags);
                ImGui.TextWrapped(activeText.Text);
                ImGui.EndChild();
                ImGui.PopStyleVar(0);

                ImGui.End();
            }

            //base.Render();
        }
Exemplo n.º 2
0
        private void DrawWindow()
        {
            ImGuiWindowFlags window_flags = 0;

            window_flags |= ImGuiWindowFlags.NoTitleBar;
            window_flags |= ImGuiWindowFlags.NoScrollbar;
            window_flags |= ImGuiWindowFlags.NoScrollbar;
            if (no_move)
            {
                window_flags |= ImGuiWindowFlags.NoMove;
                window_flags |= ImGuiWindowFlags.NoMouseInputs;
                window_flags |= ImGuiWindowFlags.NoNav;
            }
            window_flags |= ImGuiWindowFlags.AlwaysAutoResize;
            window_flags |= ImGuiWindowFlags.NoBackground;


            if (config)
            {
                ImGui.SetNextWindowSize(new Num.Vector2(200, 160), ImGuiCond.FirstUseEver);
                ImGui.Begin("Where's WOLdo Config", ref config, ImGuiWindowFlags.AlwaysAutoResize);
                ImGui.Checkbox("Enabled", ref enabled);
                ImGui.ColorEdit4("Colour", ref col.Value, ImGuiColorEditFlags.NoInputs);
                ImGui.InputFloat("Size", ref scale);
                ImGui.Checkbox("Locked", ref no_move);

                if (ImGui.Button("Save and Close Config"))
                {
                    SaveConfig();
                    config = false;
                }
                ImGui.End();
            }

            location = "";
            if (pi.ClientState.LocalPlayer != null)
            {
                location = "Uhoh";
                try
                {
                    location = terr.GetRow(pi.ClientState.TerritoryType).PlaceName.Value.Name;
                }

                catch (Exception e)
                {
                    location = "Change zone to load";
                }
            }


            if (enabled)
            {
                ImGui.PushStyleColor(ImGuiCol.Text, col.Value);
                ImGui.Begin("WOLdo", ref enabled, window_flags);
                ImGui.SetWindowFontScale(scale);
                ImGui.Text(location);
                ImGui.End();
                ImGui.PopStyleColor();
            }
        }
Exemplo n.º 3
0
        private void DisplayEditor()
        {
            ImGui.SetNextWindowPos(new System.Numerics.Vector2(0f, 200f), ImGuiCond.Always);
            ImGui.SetNextWindowSize(new System.Numerics.Vector2(230f, 200f), ImGuiCond.Always);
            ImGuiWindowFlags Flags = ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoCollapse;

            Vector4 TextColor  = Color.Lime.ToVector4();
            Vector4 TextColor2 = Color.Coral.ToVector4();

            ImGui.Begin("Groups", Flags);

            ImGui.Text("With a group of Units selected,");
            ImGui.Text("press"); ImGui.SameLine();
            ImGui.TextColored(new System.Numerics.Vector4(TextColor.X, TextColor.Y, TextColor.Z, TextColor.W), "F key");
            ImGui.SameLine(); ImGui.Text("to make them flock.");

            ImGui.Separator();

            ImGui.Text("With a group of Units selected,");
            ImGui.Text("press"); ImGui.SameLine();
            ImGui.TextColored(new System.Numerics.Vector4(TextColor.X, TextColor.Y, TextColor.Z, TextColor.W), "Q key");
            ImGui.SameLine(); ImGui.Text("to make a"); ImGui.SameLine();
            ImGui.TextColored(new System.Numerics.Vector4(TextColor2.X, TextColor2.Y, TextColor2.Z, TextColor2.W), "circle");
            ImGui.TextColored(new System.Numerics.Vector4(TextColor2.X, TextColor2.Y, TextColor2.Z, TextColor2.W), "pattern.");

            ImGui.End();
        }
Exemplo n.º 4
0
        public bool DrawUI()
        {
            if (rgatState.rgatIsExiting)
            {
                _UIStopped = true;
                return(false);
            }

            var timer = new System.Diagnostics.Stopwatch();

            timer.Start();

            ImGuiWindowFlags window_flags = ImGuiWindowFlags.None;

            window_flags |= ImGuiWindowFlags.NoDecoration;
            window_flags |= ImGuiWindowFlags.DockNodeHost;
            if (_rgatUI !.MenuBarVisible)
            {
                window_flags |= ImGuiWindowFlags.MenuBar;
            }

            window_flags |= ImGuiWindowFlags.NoBringToFrontOnFocus;

            ImGui.GetIO().ConfigWindowsMoveFromTitleBarOnly = true;
            //ImGui.GetIO().ConfigWindowsResizeFromEdges = true;

            ImGui.SetNextWindowPos(new Vector2(0, 0), ImGuiCond.Always);

            ImGui.SetNextWindowSize(new Vector2(_controller !.WindowWidth, _controller.WindowHeight), ImGuiCond.Always);
            //ImGui.SetNextWindowSize(new Vector2(1200, 800), ImGuiCond.Appearing);

            Themes.ApplyGeneralThemeColours();
            //Themes.ApplyThemeColours();


            if (ImGui.Begin("rgat Primary Window", window_flags))
            {
                _rgatUI.HandleUserInput();
                _rgatUI.DrawMain();
                _rgatUI.DrawDialogs();
                _rgatUI.CleanupFrame();
            }
            ImGui.End();

            Themes.ResetThemeColours();


            timer.Stop();
            _rgatUI.UpdateFrameStats(timer.ElapsedMilliseconds);

            if (_shortTimerFired)
            {
                _shortTimerFired = false;
                _rgatUI.ShortTimerFired();
            }



            return(true);
        }
    private static void ImGuiUn_Layout()
    {
        if (!doDebugViz)
        {
            return;
        }

        ImGuiWindowFlags flags = ImGuiWindowFlags.NoNavFocus | ImGuiWindowFlags.NoFocusOnAppearing
                                 | ImGuiWindowFlags.HorizontalScrollbar;

        ImGui.SetNextWindowBgAlpha(0.35f);
        ImGui.SetNextWindowSize(new Vector2(400, 300), ImGuiCond.FirstUseEver);
        if (ImGui.Begin("debug viz", ref p_open, flags))
        {
            ImGuiTabBarFlags f = ImGuiTabBarFlags.NoCloseWithMiddleMouseButton | ImGuiTabBarFlags.TabListPopupButton;
            if (ImGui.BeginTabBar("debug_viz_tab", f))
            {
                foreach (var v in vizs)
                {
                    if (ImGui.BeginTabItem(v.gameObject.name))
                    {
                        v.DrawDebugViz();
                        ImGui.EndTabItem();
                    }
                }
                ImGui.EndTabBar();
            }

            ImGui.End();
        }
    }
Exemplo n.º 6
0
        void DrawDock()
        {
            var viewport = ImGui.GetMainViewport();

            ImGui.SetNextWindowPos(viewport.Pos);
            ImGui.SetNextWindowSize(viewport.Size);
            ImGui.SetNextWindowViewport(viewport.ID);
            ImGui.PushStyleVar(ImGuiStyleVar.WindowRounding, 0.0f);
            ImGui.PushStyleVar(ImGuiStyleVar.WindowBorderSize, 0.0f);
            ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, Vector2.Zero);
            ImGuiWindowFlags window_flags = ImGuiWindowFlags.MenuBar | ImGuiWindowFlags.NoDocking;

            window_flags |= ImGuiWindowFlags.NoTitleBar | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoMove;
            window_flags |= ImGuiWindowFlags.NoBringToFrontOnFocus | ImGuiWindowFlags.NoNavFocus;

            if (ImGui.Begin("DockWindow", window_flags))
            {
                uint rootdockid = ImGui.GetID("rootdock");
                ImGui.DockSpace(rootdockid, Vector2.Zero, ImGuiDockNodeFlags.PassthruCentralNode);
                ImGui.PopStyleVar();
                ImGui.PopStyleVar();
                ImGui.PopStyleVar();

                ImGui.End();
            }
        }
Exemplo n.º 7
0
        public override void BuildUI(ImGuiRenderer renderer)
        {
            ImGuiViewportPtr viewport = ImGui.GetMainViewport();

            ImGui.SetNextWindowPos(viewport.Pos);
            ImGui.SetNextWindowSize(viewport.Size);
            ImGui.SetNextWindowViewport(viewport.ID);
            ImGui.SetNextWindowBgAlpha(0.0f);

            ImGuiWindowFlags window_flags = ImGuiWindowFlags.MenuBar | ImGuiWindowFlags.NoDocking;

            window_flags |= ImGuiWindowFlags.NoTitleBar | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoMove;
            window_flags |= ImGuiWindowFlags.NoBringToFrontOnFocus | ImGuiWindowFlags.NoNavFocus;

            ImGui.PushStyleVar(ImGuiStyleVar.WindowRounding, 0.0f);
            ImGui.PushStyleVar(ImGuiStyleVar.WindowBorderSize, 0.0f);
            ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, new Vector2(0.0f, 0.0f));
            ImGui.Begin("DockSpace Demo", ref p_open, window_flags);
            ImGui.PopStyleVar(3);

            var dockspace_id = ImGui.GetID("RootDockspace");
            ImGuiDockNodeFlags dockspace_flags = ImGuiDockNodeFlags.PassthruCentralNode;

            ImGui.DockSpace(dockspace_id, new Vector2(0.0f, 0.0f), dockspace_flags);
            ImGui.End();
        }
Exemplo n.º 8
0
        public ImGuiManager(ImGuiOptions options = null)
        {
            if (options == null)
            {
                options = new ImGuiOptions();
            }

            _gameWindowFirstPosition = options._gameWindowFirstPosition;
            _gameWindowTitle         = options._gameWindowTitle;
            _gameWindowFlags         = options._gameWindowFlags;

            LoadSettings();
            _renderer = new ImGuiRenderer(Core.Instance);

            _renderer.RebuildFontAtlas(options);
            Core.Emitter.AddObserver(CoreEvents.SceneChanged, OnSceneChanged);
            NezImGuiThemes.DarkTheme1();

            // find all Scenes
            _sceneSubclasses = ReflectionUtils.GetAllSubclasses(typeof(Scene), true);

            // tone down indent
            ImGui.GetStyle().IndentSpacing = 12;

            // find all themes
            _themes = typeof(NezImGuiThemes).GetMethods(System.Reflection.BindingFlags.Static |
                                                        System.Reflection.BindingFlags.Public);
        }
Exemplo n.º 9
0
        public void DrawMainWindow(PlayerCharacter player)
        {
            if (!Visible)
            {
                return;
            }

            ImGuiWindowFlags window_flags = 0;

            window_flags |= ImGuiWindowFlags.NoTitleBar;
            window_flags |= ImGuiWindowFlags.NoScrollbar;
            if (Configuration.Locked)
            {
                window_flags |= ImGuiWindowFlags.NoMove;
                window_flags |= ImGuiWindowFlags.NoMouseInputs;
                window_flags |= ImGuiWindowFlags.NoNav;
            }
            window_flags |= ImGuiWindowFlags.AlwaysAutoResize;
            window_flags |= ImGuiWindowFlags.NoBackground;

            var size = new Vector2(320, 180);

            ImGui.SetNextWindowSize(size, ImGuiCond.FirstUseEver);
            ImGui.SetNextWindowSizeConstraints(size, new Vector2(float.MaxValue, float.MaxValue));

            if (ImGui.Begin("KH Frame", ref this.visible, window_flags))
            {
                _healthFrame.Draw(player);
            }
            ImGui.End();
        }
Exemplo n.º 10
0
        public static void BeginGlobalDocking()
        {
            ImGuiViewportPtr viewport = ImGui.GetMainViewport();

            ImGui.SetNextWindowPos(viewport.Pos);
            ImGui.SetNextWindowSize(viewport.Size);
            ImGui.SetNextWindowViewport(viewport.ID);
            ImGui.SetNextWindowBgAlpha(0.0f);

            ImGuiWindowFlags windowFlags = ImGuiWindowFlags.NoDocking | ImGuiWindowFlags.MenuBar;

            windowFlags |= ImGuiWindowFlags.NoTitleBar | ImGuiWindowFlags.NoCollapse;
            windowFlags |= ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoMove;
            windowFlags |= ImGuiWindowFlags.NoBringToFrontOnFocus | ImGuiWindowFlags.NoNavFocus;

            ImGui.PushStyleVar(ImGuiStyleVar.WindowRounding, 0.0f);
            ImGui.PushStyleVar(ImGuiStyleVar.WindowBorderSize, 0.0f);
            ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, System.Numerics.Vector2.Zero);
            ImGui.Begin("imgui-docking", windowFlags);
            ImGui.PopStyleVar(3);

            uint dockspaceID = ImGui.GetID("default-dockspace");
            ImGuiDockNodeFlags dockspaceFlags = ImGuiDockNodeFlags.PassthruCentralNode;

            ImGui.DockSpace(dockspaceID, System.Numerics.Vector2.Zero, dockspaceFlags);
        }
Exemplo n.º 11
0
        public void DebuggerView(RenderWindow window, Clock clock)
        {
            if (tracelog)
            {
                return;
            }

            bool             wopen  = true;
            ImGuiWindowFlags wflags = ImGuiWindowFlags.NoScrollWithMouse | ImGuiWindowFlags.NoScrollbar |
                                      ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoCollapse;

            if (ImGui.Begin("Debugger", ref wopen, wflags))
            {
                ImGui.SetWindowPos(new ImVec2(517, 25));
                ImGui.SetWindowSize(new ImVec2(450, window.Size.Y - 35));

                ShowButtons();
                ShowInfo();

                ImGui.Spacing();
                ImGui.Separator();

                if ((c.emustate == State.Running || c.emustate == State.Debug))
                {
                    ShowDisassembly();
                }

                ImGui.End();
            }
        }
Exemplo n.º 12
0
        //Begin Child Frames - Full Width
        public static bool BeginChild(string id, bool border, ImGuiWindowFlags flags)
        {
            var newcontentRegionArea = ImGuiNative.igGetContentRegionAvail();

            return(ImGui.BeginChild(id, new ImGuiVector2(newcontentRegionArea.X, newcontentRegionArea.Y), border,
                                    flags));
        }
Exemplo n.º 13
0
        private void ShowMiscInfoWindow(GameTime GameTime)
        {
            ImGui.SetNextWindowPos(new System.Numerics.Vector2(0f, Graphics.PreferredBackBufferHeight - 120f), ImGuiCond.Always);
            ImGui.SetNextWindowSize(new System.Numerics.Vector2(350f, 120f), ImGuiCond.Always);
            ImGuiWindowFlags Flags = ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoCollapse;

            if (!ImGui.Begin("Misc Info", ref MiscInfoWindow, Flags))
            {
                ImGui.End();
                return;
            }

            ImGui.Text("Time Since Start: " + GameTime.TotalGameTime.ToString("hh':'mm':'ss"));
            ImGui.Text("Application Average " + (1000f / ImGui.GetIO().Framerate).ToString("0.000") + " ms/frame (" + ImGui.GetIO().Framerate.ToString("0.0") + " FPS)");
            ImGui.Text("Window Resolution: " + Graphics.PreferredBackBufferWidth + "x" + Graphics.PreferredBackBufferHeight);
            Vector2 MousePosition = new Vector2(Mouse.GetState().X, Mouse.GetState().Y);

            ImGui.Text("Mouse Screen Position: " + MousePosition);
            if (!IsFixedTimeStep && !Graphics.SynchronizeWithVerticalRetrace)
            {
                ImGui.Text("VSync: OFF");
            }
            else
            {
                ImGui.Text("VSync: ON");
            }

            ImGui.End();
        }
Exemplo n.º 14
0
        private void ShowSceneWindow()
        {
            ImGui.SetNextWindowPos(new System.Numerics.Vector2(0f, 100f), ImGuiCond.Always);
            ImGui.SetNextWindowSize(new System.Numerics.Vector2(220f, 95f), ImGuiCond.Always);
            ImGuiWindowFlags Flags = ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoCollapse;

            if (!ImGui.Begin("Scene Select", ref SceneWindow, Flags))
            {
                ImGui.End();
                return;
            }

            ImGui.PushItemWidth(150f);
            ImGui.Combo("Scene", ref SelectedScene, SceneNames, SceneNames.Length);
            ImGui.PopItemWidth();

            ImGui.Separator();

            if (ImGui.Button("Change"))
            {
                ChangeScene = true;
            }

            ImGui.End();
        }
Exemplo n.º 15
0
        void DrawHeader()
        {
            ImGuiIOPtr       io               = ImGui.GetIO();
            ImGuiViewportPtr viewport         = ImGui.GetMainViewport();
            Vector2          work_area_pos    = viewport.GetWorkPos();
            Vector2          work_area_size   = viewport.GetWorkSize();
            Vector2          window_pos       = work_area_pos;
            Vector2          window_pos_pivot = Vector2.Zero;

            ImGui.SetNextWindowPos(window_pos, ImGuiCond.Always, window_pos_pivot);
            work_area_size.Y = 40;
            ImGui.SetNextWindowSize(work_area_size);
            ImGui.SetNextWindowViewport(viewport.ID);

            ImGuiWindowFlags windowFlags = ImGuiWindowFlags.NoDecoration | ImGuiWindowFlags.NoDocking | ImGuiWindowFlags.NoSavedSettings | ImGuiWindowFlags.NoFocusOnAppearing | ImGuiWindowFlags.NoNav | ImGuiWindowFlags.NoMove;
            bool             open        = true;

            if (ImGui.Begin("HeaderBar", ref open, windowFlags))
            {
                ImGui.BeginChild("header");

                ImGui.Text("Left 1"); ImGui.SameLine();
                ImGui.Text("Left 2"); ImGui.SameLine();

                ImGui.EndChild();
                ImGui.End();
            }
        }
Exemplo n.º 16
0
 public ImGuiModalPopUp(string id, Func <bool> openCondition, Action drawAction, ImGuiWindowFlags flags = ImGuiWindowFlags.AlwaysAutoResize)
 {
     ID            = id;
     OpenCondition = openCondition;
     DrawAction    = drawAction;
     Flags         = flags;
 }
Exemplo n.º 17
0
 /// <summary>
 /// Create a new window.
 /// </summary>
 /// <param name="name">Window name.</param>
 /// <param name="flags">Window flags.</param>
 /// <param name="visible">The window is visible.</param>
 /// <param name="allowClosing">Allow closing.</param>
 /// <param name="modalMode">If it is a popup modal.</param>
 /// <param name="x">X position.</param>
 /// <param name="y">Y position.</param>
 /// <param name="width">Width.</param>
 /// <param name="height">Height.</param>
 public Window(string name, ImGuiWindowFlags flags = ImGuiWindowFlags.None, bool visible = true, bool allowClosing = true, bool modalMode = false, float x = -1, float y = -1, float width = -1, float height = -1)
 {
     Name         = name;
     Flags        = flags;
     Visible      = visible;
     AllowClosing = allowClosing;
     ModalMode    = modalMode;
     if (x != -1)
     {
         X = x;
     }
     if (x != -1)
     {
         Y = y;
     }
     if (width != -1)
     {
         Width = width;
     }
     if (height != -1)
     {
         Height = height;
     }
     WindowManager.AddWindow(this);
 }
Exemplo n.º 18
0
 void DrawWindows()
 {
     foreach (var win in WindowManager.GetAllWindowAttributes())
     {
         if (win.visible)
         {
             bool             open = true;
             ImGuiWindowFlags flag = ImGuiWindowFlags.NoCollapse;
             if (!win.canDock)
             {
                 flag |= ImGuiWindowFlags.NoDocking;
             }
             ImGui.SetNextWindowSizeConstraints(Vector2.One * 100, Vector2.One * 10240);
             if (ImGui.Begin(win.title, ref open, flag))
             {
                 if (open == false)
                 {
                     WindowManager.CloseWindow(win.UUID);
                     ImGui.End();
                     continue;
                 }
                 win.window.OnGUI();
             }
             ImGui.End();
         }
     }
 }
Exemplo n.º 19
0
        public void MemoryView(RenderWindow window)
        {
            bool wopen = true;

            string[] ramsel = { "RAM", "VRAM" };

            ImGuiWindowFlags wflags = ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoCollapse;

            if (ImGui.Begin(ramsel[index], ref wopen, wflags))
            {
                ImGui.Combo("Memory Selection", ref index, ramsel, ramsel.Length);
                ImGui.SetWindowPos(new ImVec2(972, 25));
                ImGui.SetWindowSize(new ImVec2(430, window.Size.Y - 35));

                if (index == 0)
                {
                    mem.Draw(ramsel[index], c.mapper.ram, c.mapper.ram.Length);
                }
                else
                {
                    mem.Draw(ramsel[index], c.mapper.vram, c.mapper.vram.Length);
                }
                ImGui.End();
            }
        }
Exemplo n.º 20
0
        public static bool Begin(string name, ImGuiWindowFlags flags)
        {
            int   utf8NameByteCount = Encoding.UTF8.GetByteCount(name);
            byte *utf8NameBytes;

            if (utf8NameByteCount > Util.StackAllocationSizeLimit)
            {
                utf8NameBytes = Util.Allocate(utf8NameByteCount + 1);
            }
            else
            {
                byte *stackPtr = stackalloc byte[utf8NameByteCount + 1];
                utf8NameBytes = stackPtr;
            }
            Util.GetUtf8(name, utf8NameBytes, utf8NameByteCount);

            byte *p_open = null;
            byte  ret    = ImGuiNative.igBegin(utf8NameBytes, p_open, flags);

            if (utf8NameByteCount > Util.StackAllocationSizeLimit)
            {
                Util.Free(utf8NameBytes);
            }

            return(ret != 0);
        }
Exemplo n.º 21
0
        protected override void CustomRender()
        {
            if (_openRequested)
            {
                ImGui.OpenPopup(PopupLabel);
                _openRequested = false;
                _isOpen = true;
            }

            var popupSize = ImGui.GetIO().DisplaySize;
            popupSize = new Vector2(popupSize.X - 50, popupSize.Y - 50);
            ImGui.SetNextWindowSize(popupSize);
            const ImGuiWindowFlags flags = ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoMove;
            if (ImGui.BeginPopupModal(PopupLabel, ref _isOpen, flags))
            {
                RenderSectionList(popupSize);

                ImGui.NewLine();
                RenderControlsSection();

                ImGui.NewLine();
                RenderImageSection(popupSize);

                ImGui.EndPopup();
            }
        }
    void DrawPlaybackControl()
    {
        ImGuiWindowFlags window_flags     = ImGuiWindowFlags.NoDecoration | ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoSavedSettings | ImGuiWindowFlags.NoFocusOnAppearing | ImGuiWindowFlags.NoNav | ImGuiWindowFlags.NoMove;
        Vector2          window_pos       = new Vector2(Screen.width / 2, Screen.height - 10.0f);
        Vector2          window_pos_pivot = new Vector2(0.5f, 1.0f);

        ImGui.SetNextWindowPos(window_pos, ImGuiCond.Always, window_pos_pivot);

        ImGui.SetNextWindowBgAlpha(0.35f);

        ImGui.SetNextWindowSize(new Vector2(Screen.width / 2, 0));
        ImGui.Begin("Playback Control", window_flags);
        {
            var len = 0.0f;

            if (ass.clip != null)
            {
                len = ass.clip.length;
            }

            ImGuiExt.TextCenter($"{currentTime:0.00}/{len:0.00}");
            if (ImGuiExt.ButtonCenter(ass.isPlaying ? "ll" : " > "))
            {
                TogglePlaystate();
            }

            ImGui.SetNextItemWidth(Screen.width / 2);
            if (ImGui.SliderFloat("", ref currentTime, 0, len))
            {
                ass.time = currentTime;
            }
        }
        ImGui.End();
    }
Exemplo n.º 23
0
        void DrawLoading()
        {
            var viewport = ImGui.GetMainViewport();

            ImGui.SetNextWindowPos(viewport.Pos);
            ImGui.SetNextWindowSize(viewport.Size);
            ImGui.SetNextWindowViewport(viewport.ID);
            ImGui.PushStyleVar(ImGuiStyleVar.WindowRounding, 0.0f);
            ImGui.PushStyleVar(ImGuiStyleVar.WindowBorderSize, 0.0f);
            ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, System.Numerics.Vector2.Zero);
            ImGuiWindowFlags window_flags = ImGuiWindowFlags.NoDocking;

            window_flags |= ImGuiWindowFlags.NoTitleBar | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoMove;
            window_flags |= ImGuiWindowFlags.NoBringToFrontOnFocus | ImGuiWindowFlags.NoNavFocus;

            if (ImGui.Begin("loading", window_flags))
            {
                ImGui.Text("loading...");

                ImGui.PopStyleVar();
                ImGui.PopStyleVar();
                ImGui.PopStyleVar();

                ImGui.End();
            }
        }
Exemplo n.º 24
0
        public static unsafe bool BeginModalNoClose(string name, ImGuiWindowFlags flags)
        {
            byte *native_name;
            int   name_byteCount = 0;

            if (name != null)
            {
                name_byteCount = Encoding.UTF8.GetByteCount(name);
                if (name_byteCount > Util.StackAllocationSizeLimit)
                {
                    native_name = Util.Allocate(name_byteCount + 1);
                }
                else
                {
                    byte *native_name_stackBytes = stackalloc byte[name_byteCount + 1];
                    native_name = native_name_stackBytes;
                }
                int native_name_offset = Util.GetUtf8(name, native_name, name_byteCount);
                native_name[native_name_offset] = 0;
            }
            else
            {
                native_name = null;
            }
            byte ret = ImGuiNative.igBeginPopupModal(native_name, (byte *)0, flags);

            if (name_byteCount > Util.StackAllocationSizeLimit)
            {
                Util.Free(native_name);
            }
            return(ret != 0);
        }
 public void AddPopup(string title, Action <PopupData> action, ImGuiWindowFlags flags = 0)
 {
     popups.Add(new PopupContext()
     {
         Title = title, DrawAction = action, Flags = flags, Data = new PopupData()
     });
 }
Exemplo n.º 26
0
        public static unsafe bool BeginPopupModal(string name, ref bool p_opened, ImGuiWindowFlags extra_flags)
        {
            byte value  = p_opened ? (byte)1 : (byte)0;
            bool result = ImGuiNative.igBeginPopupModal(name, &value, extra_flags);

            p_opened = value == 1 ? true : false;
            return(result);
        }
Exemplo n.º 27
0
 private void LoadWindow(string name, ImGuiWindowFlags windowFlags, Action action)
 {
     if (ImGui.Begin(name, windowFlags))
     {
         action.Invoke();
     }
     ImGui.End();
 }
Exemplo n.º 28
0
        // fixes broken feature
        // issue is how the wrapper is generated
        public static unsafe bool BeginNullableOpen(string name, ref bool?p_open, ImGuiWindowFlags flags)
        {
            byte *native_name;
            int   name_byteCount = 0;

            if (name != null)
            {
                name_byteCount = Encoding.UTF8.GetByteCount(name);
                if (name_byteCount > Util.StackAllocationSizeLimit)
                {
                    native_name = Util.Allocate(name_byteCount + 1);
                }
                else
                {
                    byte *native_name_stackBytes = stackalloc byte[name_byteCount + 1];
                    native_name = native_name_stackBytes;
                }
                int native_name_offset = Util.GetUtf8(name, native_name, name_byteCount);
                native_name[native_name_offset] = 0;
            }
            else
            {
                native_name = null;
            }

            byte  native_p_open_val;
            byte *native_p_open;

            if (p_open != null)
            {
                native_p_open_val = (bool)p_open ? (byte)1 : (byte)0;
                native_p_open     = &native_p_open_val;
            }
            else
            {
                native_p_open_val = 0;
                native_p_open     = null;
            }

            byte ret = ImGuiNative.igBegin(native_name, native_p_open, flags);

            if (name_byteCount > Util.StackAllocationSizeLimit)
            {
                Util.Free(native_name);
            }

            if (p_open != null)
            {
                p_open = native_p_open_val != 0;
            }

            return(ret != 0);
        }
Exemplo n.º 29
0
        // This should have been done by mellinoe/ImGui.NET#135 long ago D:
        public static unsafe bool BeginPopupModal(string name, ImGuiWindowFlags flags)
        {
            byte[] nameBytes = Encoding.UTF8.GetBytes(name);
            byte   ret;

            fixed(byte *nameBytePtr = nameBytes)
            {
                ret = ImGuiNative.igBeginPopupModal(nameBytePtr, null, flags);
            }

            return(ret != 0);
        }
Exemplo n.º 30
0
        private void DisplayEditor()
        {
            ImGui.SetNextWindowPos(new System.Numerics.Vector2(0f, 200f), ImGuiCond.Once);
            ImGui.SetNextWindowSize(new System.Numerics.Vector2(210f, 200f), ImGuiCond.Always);
            ImGuiWindowFlags Flags = ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoCollapse;

            Vector4 NameColor = Color.Lime.ToVector4();
            Vector4 Blue      = Color.CadetBlue.ToVector4();
            Vector4 Red       = Color.IndianRed.ToVector4();

            ImGui.Begin("Selected Unit", Flags);

            if (SelectedUnit != null)
            {
                ImGui.TextColored(new System.Numerics.Vector4(NameColor.X, NameColor.Y, NameColor.Z, NameColor.W), SelectedUnit.Name);
                ImGui.SameLine();

                if (SelectedUnit.Team == Team.Red)
                {
                    ImGui.TextColored(new System.Numerics.Vector4(Red.X, Red.Y, Red.Z, Red.W), "(Red Team)");
                }
                else if (SelectedUnit.Team == Team.Blue)
                {
                    ImGui.TextColored(new System.Numerics.Vector4(Blue.X, Blue.Y, Blue.Z, Blue.W), "(Blue Team)");
                }

                ImGui.Separator();
                if (ImGui.CollapsingHeader("Stats"))
                {
                    ImGui.Text("Health - " + SelectedUnit.Stats.Health);
                    ImGui.Text("Attack - " + SelectedUnit.Stats.Attack);
                    ImGui.Text("Defense - " + SelectedUnit.Stats.Defense);
                    ImGui.Text("Attack Range - " + SelectedUnit.Stats.AttackRange);
                    ImGui.Text("Attack Speed - " + SelectedUnit.Stats.AttackSpeed + "s");
                    ImGui.Text("Critical Chance - " + SelectedUnit.Stats.CriticalChance + "%%");
                    ImGui.Text("Field Of View - " + SelectedUnit.Stats.FieldOfView);
                }

                ImGui.Separator();
                if (ImGui.CollapsingHeader("Body"))
                {
                    ImGui.Text("Velocity - [" + SelectedUnit.Body.Velocity.X.ToString("0.00") + " " + SelectedUnit.Body.Velocity.Y.ToString("0.00") + "]");
                    ImGui.Text("Max Velocity - " + SelectedUnit.Body.MaxVelocity);
                    ImGui.Text("Interior Radius - " + SelectedUnit.Body.InteriorRadius);
                    ImGui.Text("Exterior Radius - " + SelectedUnit.Body.ExteriorRadius);
                }
            }

            ImGui.End();
        }