コード例 #1
0
        public static void RenderVoidMenu()
        {
            if (ImGui.BeginPopupContextVoid("void_menu"))
            {
                RenderPaste();
                RenderAddNew();
            }

            if (Input.Keyboard.IsDown(Keys.LeftControl, true) || Input.Keyboard.IsDown(Keys.RightControl, true))
            {
                if (Input.Keyboard.WasPressed(Keys.C, true))
                {
                    Copy(false);
                }

                if (Input.Keyboard.WasPressed(Keys.V, true))
                {
                    Paste();
                }

                if (Input.Keyboard.WasPressed(Keys.D, true) && ImNode.Focused != null)
                {
                    ImNode.Focused.Remove();
                }
            }
        }
コード例 #2
0
        //WARNING!!! DO NOT USE FOR BULK DRAWING, USE DRAWALL FOR BULK DRAWING^^;
        public void Draw(IntPtr rendererPtr, Camera camera, bool createNewWindow)
        {
            if (camera.ZoomLevel < DrawAtZoom)
            {
                return;
            }


            int x = (int)(X + ViewOffset.X);
            int y = (int)(Y + ViewOffset.Y);

            System.Numerics.Vector2 pos = new System.Numerics.Vector2(x, y);

            if (createNewWindow)
            {
                ImGui.PushStyleColor(ImGuiCol.WindowBg, new System.Numerics.Vector4(0, 0, 0, 0)); //make the background transperent.

                ImGui.PushStyleVar(ImGuiStyleVar.WindowBorderSize, 0);
                //ImGui.PushStyleVar(ImGuiStyleVar.FramePadding, new Vector2(1, 1));// <- not used
                ImGui.PushStyleVar(ImGuiStyleVar.WindowRounding, 2);

                ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, new System.Numerics.Vector2(1, 2));
                ImGui.SetNextWindowPos(pos, ImGuiCond.Always);

                ImGui.Begin(NameString, ref IsActive, _flags);
            }

            ImGui.PushStyleColor(ImGuiCol.Button, new System.Numerics.Vector4(0, 0, 0, 0));
            if (ImGui.Button(NameString + "##" + _entityGuid.ToString())) //If the name gets clicked, we tell the state.
            {
                _state.EntityClicked(_entityGuid, _starSysGuid, MouseButtons.Primary);
            }



            if (ImGui.BeginPopupContextItem("NameContextMenu" + _entityGuid.ToString() + NameString, 1))
            {
                setUpContextMenu(_entityGuid);
                ImGui.EndPopup();
            }
            //checks the state if the icon of the entity with this nameicon was altClicked, if yes then display the normal context menu
            if (_state._lastContextMenuOpenedEntityGuid == _entityGuid)
            {
                if (ImGui.BeginPopupContextVoid())
                {
                    setUpContextMenu(_entityGuid);
                    ImGui.EndPopup();
                }
            }
            if (_state.StarSystemStates[_starSysGuid].EntityStatesWithNames[_entityGuid].Entity.HasDataBlob <JPSurveyableDB>() && _state.StarSystemStates.ContainsKey(_state.StarSystemStates[_starSysGuid].EntityStatesWithNames[_entityGuid].Entity.GetDataBlob <JPSurveyableDB>().SystemToGuid))
            {
                ImGui.Text("Jumps to: " + _state.StarSystemStates[_state.StarSystemStates[_starSysGuid].EntityStatesWithNames[_entityGuid].Entity.GetDataBlob <JPSurveyableDB>().SystemToGuid].StarSystem.NameDB.DefaultName);
            }


            //ImGui.BeginChild("subnames");
            foreach (var name in SubNames)
            {
                if (ImGui.Button(name.Value + "##" + _entityGuid.ToString() + name.Key.ToString() + name.Value))
                {
                    _state.EntityClicked(name.Key, _starSysGuid, MouseButtons.Primary);
                }
                if (ImGui.BeginPopupContextItem("subNameContextMenu" + name.Key + name.Value + _entityGuid.ToString() + NameString, 1))
                {
                    setUpContextMenu(name.Key);

                    ImGui.EndPopup();
                }
                //checks the state if the icon of the entity with this subNameicon was altClicked, if yes then display the normal context menu for the the subname
                if (_state._lastContextMenuOpenedEntityGuid == name.Key)
                {
                    if (ImGui.BeginPopupContextVoid())
                    {
                        setUpContextMenu(name.Key);
                        ImGui.EndPopup();
                    }
                }
            }

            //ImGui.EndChild();

            //var size = ImGui.GetItemRectSize();
            var size = ImGui.GetWindowSize();

            Width  = size.X;
            Height = size.Y;
            ViewDisplayRect.Width  = size.X;
            ViewDisplayRect.Height = size.Y;

            ImGui.PopStyleColor();
            if (createNewWindow)
            {
                ImGui.PopStyleColor(); //have to pop the color change after pushing it.
                ImGui.PopStyleVar(3);
                ImGui.End();
            }
        }
コード例 #3
0
 public static bool BeginPopupContextVoid(string str_id)
 {
     return(ImGui.BeginPopupContextVoid(str_id));
 }
コード例 #4
0
 public static bool BeginPopupContextVoid(string str_id, ImGuiPopupFlags popup_flags)
 {
     return(ImGui.BeginPopupContextVoid(str_id, popup_flags));
 }
コード例 #5
0
 public static bool BeginPopupContextVoid()
 {
     return(ImGui.BeginPopupContextVoid());
 }