protected unsafe override void UpdateRenderState() { ImGuiNative.igGetStyle()->WindowRounding = 0; ImGuiNative.igGetStyle()->ColumnsMinSpacing = 1; var leftFrameSize = new Vector2(NativeWindow.Width - 10, NativeWindow.Height); ImGui.SetNextWindowSize(leftFrameSize, SetCondition.Always); ImGui.SetNextWindowPosCenter(SetCondition.Always); ImGui.BeginWindow("Assembly Browser Main Window", WindowFlags.NoResize | WindowFlags.NoTitleBar | WindowFlags.NoMove | WindowFlags.ShowBorders | WindowFlags.MenuBar | WindowFlags.NoScrollbar); DrawTopMenuBar(); ImGuiNative.igColumns(2, "MainLayoutColumns", true); // Left panel ImGui.BeginChildFrame (_leftFrameId, new Vector2(ImGuiNative.igGetColumnWidth(0), ImGui.GetWindowHeight() - 40), WindowFlags.ShowBorders | WindowFlags.HorizontalScrollbar); DrawAssemblyListView(); ImGui.EndChildFrame(); // Right panel ImGuiNative.igNextColumn(); Vector2 rightFrameSize = new Vector2(ImGuiNative.igGetColumnWidth(1), ImGui.GetWindowHeight() - 40); ImGui.BeginChildFrame(_rightFrameID, rightFrameSize, WindowFlags.ShowBorders | WindowFlags.HorizontalScrollbar); DrawRightFrame(rightFrameSize); ImGui.EndChildFrame(); ImGui.EndWindow(); }
public bool DrawInfoWindow(string windowLabel, ref bool isOpened, float x, float y, float width, float height, WindowFlags flags, Condition conditions) { ImGui.SetNextWindowPos(new ImGuiVector2(width + x, height + y), conditions, new ImGuiVector2(1, 1)); ImGui.SetNextWindowSize(new ImGuiVector2(width, height), conditions); ImGuiNative.igSetNextWindowCollapsed(Settings.IsCollapsed, Condition.Appearing); return(ImGui.BeginWindow(windowLabel, ref isOpened, flags)); }
public void render() { if (ImGui.BeginWindow("Scene")) { for (int i = 0; i < _scene.entities.count; i++) { var e = _scene.entities[i]; var flags = (TreeNodeFlags)0; flags |= TreeNodeFlags.Leaf; if (_selectedEntity != null && _selectedEntity == e) { flags |= TreeNodeFlags.Selected; } if (ImGui.TreeNodeEx(e.name, flags)) { if (ImGui.IsItemHovered(HoveredFlags.Default) && ImGui.IsMouseClicked(0)) { if (_selectedEntity != null || _selectedEntity != e) { _selectedEntity = e; onEntitySelect?.Invoke(_selectedEntity); } } ImGui.TreePop(); } } //ImGui.TreeNode() ImGui.EndWindow(); } }
public unsafe override void Update(float deltaSeconds) { bool opened = true; var io = ImGui.GetIO(); ImGui.SetNextWindowSize(io.DisplaySize * new Vector2(0.5f, 0.75f), SetCondition.Always); ImGui.SetNextWindowPosCenter(SetCondition.Always); ImGui.BeginWindow("", ref opened, 0.0f, WindowFlags.NoTitleBar | WindowFlags.NoResize | WindowFlags.NoCollapse | WindowFlags.NoMove); ImGui.SetWindowFontScale(1.0f); if (_font != null) { ImGui.PushFont(_font); } _menuFunc(); if (_menuFunc != DrawMainPage) { if (ImGui.Button("Back")) { _menuFunc = DrawMainPage; } } if (_font != null) { ImGui.PopFont(); } ImGui.SetWindowFontScale(1.0f); ImGui.EndWindow(); }
private void TestWindow_ComboTracker(ComboTracker comboTracker, IList <string> comboHistory) { ImGui.BeginWindow("ComboTracker"); { ImGui.Text("# Combos:"); foreach (var item in comboTracker.SequenceCombos) { ImGui.Text($"{ item.Name } = [{ string.Join(", ", item.Keys) }]"); } ImGui.Separator(); ImGui.Text($"Current: { comboTracker.GetHistoryString() }"); ImGui.Separator(); ImGui.Text("# History:"); ImGui.BeginChild("ComboTrackerChild1", true); { foreach (var item in comboHistory) { ImGui.Text(item); } } ImGui.EndChild(); } ImGui.EndWindow(); }
public void Render() { ImGui.BeginWindow("BadgerEdit 1.1", ref isOpened, new Vector2(800, 600), 0.5f, WindowFlags.MenuBar); if (ImGui.BeginMenuBar()) { if (ImGui.BeginMenu("File")) { if (ImGui.MenuItem("Open")) { fp.Show(FilePickerMode.Open, LoadFile); } ImGui.Separator(); if (ImGui.MenuItem("Save")) { fp.Show(FilePickerMode.Save, SaveFile); } ImGui.EndMenu(); } ImGui.EndMenuBar(); } fp.Draw(); RenderWindowContents(); ImGui.EndWindow(); }
private void ShowStyleEditor() { ImGui.BeginWindow("Style Editor"); //If guiStyle has changed, show button to revert changes if (!guiStyle.Equals(StyleRef)) { ImGui.SameLine(); if (ImGui.Button("Revert Style")) { guiStyle = StyleRef; //Style imguiStyle = ImGui.GetStyle(); //guiStyle.ApplyStyle(ref imguiStyle); } } if (ImGui.CollapsingHeader("Rendering", "renderingOptions", true, true)) { ImGui.Checkbox("AntiAliased Lines", ref guiStyle.AntiAliasedLines); ImGui.Checkbox("AntiAliased Shapes", ref guiStyle.AntiAliasedShapes); //ImGui.SliderFloat("Curve Tessellation Tolerence", ref guiStyle.CurveTessellationTolerance, 0, 10, guiStyle.CurveTessellationTolerance.ToString(), 1); ImGui.SliderFloat("Global Alpha", ref guiStyle.Alpha, 0.2f, 1, Math.Round(guiStyle.Alpha, 2).ToString(), 1); } if (ImGui.CollapsingHeader("Settings", "settings", true, true)) { Int2 winPadding = new Int2(); ImGui.SliderInt2("Window Padding", ref winPadding, 0, 20, "Test"); } Style imguiStyle = ImGui.GetStyle(); guiStyle.ApplyStyle(ref imguiStyle); ImGui.EndWindow(); }
public static bool BeginWindowCenter(string title, int width, int height, bool autoResize = false) { Vector4 vector4 = CenterWindow(width, height); ImGui.SetNextWindowPos(new System.Numerics.Vector2(vector4.X, vector4.Y), Condition.Appearing, new System.Numerics.Vector2(1f, 1f)); ImGui.SetNextWindowSize(new System.Numerics.Vector2(vector4.Z, vector4.W), Condition.Appearing); return(ImGui.BeginWindow(title, autoResize ? WindowFlags.AlwaysAutoResize : WindowFlags.Default)); }
public static bool BeginWindowCenter(string title, int width, int height, WindowFlags flags = WindowFlags.Default) { var size = CenterWindow(width, height); ImGui.SetNextWindowPos(new ImGuiVector2(size.X, size.Y), Condition.Appearing, new ImGuiVector2(1, 1)); ImGui.SetNextWindowSize(new ImGuiVector2(size.Z, size.W), Condition.Appearing); return(ImGui.BeginWindow(title, flags)); }
public static bool BeginWindowCenter(string title, ref bool isOpened, int width, int height, bool autoResize = false) { var size = CenterWindow(width, height); ImGui.SetNextWindowPos(new ImGuiVector2(size.X, size.Y), Condition.Appearing, new ImGuiVector2(1, 1)); ImGui.SetNextWindowSize(new ImGuiVector2(size.Z, size.W), Condition.Appearing); return(ImGui.BeginWindow(title, ref isOpened, autoResize ? WindowFlags.AlwaysAutoResize : WindowFlags.Default)); }
public unsafe override void ImGuiLayout() { // 1. Show a simple window // Tip: if we don't call ImGui.Begin()/ImGui.End() the widgets appears in a window automatically called "Debug" { var io = ImGui.GetIO(); ImGui.BeginWindow("Debug"); ImGui.Text("Hello, world!"); ImGui.SliderFloat("float", ref f, 0.0f, 1.0f, null, 1f); ImGui.ColorEdit3("clear color", ref clear_color, ColorEditFlags.Default); if (ImGui.Button("Test Window")) { show_test_window = !show_test_window; } if (ImGui.Button("Another Window")) { show_another_window = !show_another_window; } ImGui.Text(string.Format("Application average {0:F3} ms/frame ({1:F1} FPS)", ImGui.GetIO().DeltaTime, 1f / ImGui.GetIO().DeltaTime)); //ImGui.InputText("Text Input 1", _TextInputBuffers[0], _TextInputBuffers[0].Length,InputTextFlags.Default,new TextEditCallback(); //ImGui.InputText("Text Input 2", _TextInputBuffers[1].Buffer, _TextInputBuffers[1].Length); if (ImGui.Button("Open File")) { show_file_dialog = !show_file_dialog; } ImGui.EndWindow(); } // 2. Show another simple window, this time using an explicit Begin/End pair if (show_another_window) { ImGui.SetNextWindowSize(new System.Numerics.Vector2(200, 100), Condition.FirstUseEver); ImGui.BeginChild("Another Window", show_another_window); ImGui.Text("Hello"); ImGui.EndChild(); } // 3. Show the ImGui test window. Most of the sample code is in ImGui.ShowTestWindow() if (show_test_window) { ImGui.SetNextWindowPos(new System.Numerics.Vector2(650, 20), Condition.FirstUseEver, new System.Numerics.Vector2(0, 0)); ImGuiNative.igShowDemoWindow(ref show_test_window); } // 4. Show the memory editor and file dialog, just as an example. _MemoryEditor.Draw("Memory editor", _MemoryEditorData, _MemoryEditorData.Length); if (show_file_dialog) { string start = _Dialog.LastDirectory; _Dialog.ChooseFileDialog(true, _Dialog.LastDirectory, null, "Choose File", new System.Numerics.Vector2(500, 500), new System.Numerics.Vector2(50, 50), 1f); /* if (!string.IsNullOrEmpty(_Dialog.ChosenPath)) * _TextInputBuffers[0].StringValue = _Dialog.ChosenPath;*/ } }
public void Render(RenderContext rc) { if (_windowOpened) { Vector2 size = ImGui.GetIO().DisplaySize / ImGui.GetIO().DisplayFramebufferScale; ImGui.SetNextWindowSize(size - new Vector2(20, 35), SetCondition.Always); ImGui.SetNextWindowPos(new Vector2(10, 25), SetCondition.Always); ImGui.PushStyleVar(StyleVar.WindowRounding, 0f); if (ImGui.BeginWindow("Editor Window", ref _windowOpened, WindowFlags.ShowBorders | WindowFlags.NoCollapse | WindowFlags.NoMove | WindowFlags.NoResize)) { ImGui.Columns(2, "EditorColumns", true); if (!_columnWidthSet) { _columnWidthSet = true; float initialOffset = Math.Min(200, ImGui.GetWindowWidth() * 0.3f); ImGui.SetColumnOffset(1, initialOffset); } DirectoryNode node = _assetDb.GetRootDirectoryGraph(); DrawRecursiveNode(node, false); ImGui.NextColumn(); if (_selectedAsset != null) { Drawer d = DrawerCache.GetDrawer(_selectedAsset.GetType()); d.Draw(_selectedAsset.GetType().Name, ref _selectedAsset, rc); ImGui.Text("Asset Name:"); ImGui.PushItemWidth(220); ImGui.SameLine(); if (ImGui.InputText(" ", _filenameBuffer.Data, _filenameBuffer.CapacityInBytes, InputTextFlags.Default, null)) { _loadedAssetPath = _filenameBuffer.StringValue; } ImGui.PopItemWidth(); ImGui.SameLine(); if (ImGui.Button("Save")) { string path = _assetDb.GetAssetPath(_loadedAssetPath); using (var fs = File.CreateText(path)) { var serializer = JsonSerializer.CreateDefault(); serializer.TypeNameHandling = TypeNameHandling.All; serializer.Serialize(fs, _selectedAsset); } } } } ImGui.EndWindow(); ImGui.PopStyleVar(); } }
public void render() { // manually start a fresh batch and call the UICanvas Component lifecycle methods since it isnt attached to the Scene if (ImGui.BeginWindow("inspector")) { foreach (var it in _inspectors) { it.render(); } ImGui.EndWindow(); } }
protected unsafe void UpdateRenderState() { ImGuiNative.igGetStyle()->WindowRounding = 0; ImGuiNative.igGetStyle()->ColumnsMinSpacing = 1; var windowSize = new System.Numerics.Vector2(400, 400); ImGui.SetNextWindowSize(windowSize, SetCondition.Always); ImGui.SetNextWindowPosCenter(SetCondition.Always); ImGui.BeginWindow("Demo Window", WindowFlags.AlwaysAutoResize); //WindowFlags.NoResize | WindowFlags.NoTitleBar | WindowFlags.NoMove | WindowFlags.ShowBorders | WindowFlags.MenuBar | WindowFlags.NoScrollbar ImGui.EndWindow(); }
private bool DrawMenu() { var displaySize = ImGui.GetIO().DisplaySize; if (MenuGlobals.MenuFont != null) { ImGui.PushFont(MenuGlobals.MenuFont); } ImGui.SetNextWindowSize(displaySize * new Vector2(0.7f, 1f) - new Vector2(0, 160), SetCondition.Always); ImGui.SetNextWindowPosCenter(SetCondition.Always); if (ImGui.BeginWindow(string.Empty, WindowFlags.NoTitleBar | WindowFlags.NoResize | WindowFlags.NoCollapse | WindowFlags.NoMove)) { if (IsFinalLevel) { ImGui.Text("Congratulations, you've beaten the final level! Thanks for playing!"); } else { if (ImGui.Button("Next Level (Space)")) { LoadNextLevel(); } } if (ImGui.Button("Retry (R)")) { RetryCurrentLevel(); } if (ImGui.Button("Exit To Main Menu")) { AssetID sceneID = "Scenes/MainMenu.scene"; SceneAsset scene = _assetSystem.Database.LoadAsset <SceneAsset>(sceneID, cache: false); _sls.LoadScene(scene); } } ImGui.EndWindow(); if (MenuGlobals.MenuFont != null) { ImGui.PopFont(); } if (_input.GetKeyDown(Veldrid.Platform.Key.Space)) { LoadNextLevel(); } else if (_input.GetKeyDown(Veldrid.Platform.Key.R)) { RetryCurrentLevel(); } return(false); }
public override void Render() { ImGui.SetNextWindowPos(new Vector2(0, TITLEBAR_HEIGHT), Condition.Always, Vector2.Zero); ImGui.SetNextWindowSize(new Vector2(_io.DisplaySize.X, _io.DisplaySize.Y - TITLEBAR_HEIGHT), Condition.Always); ImGui.PushStyleVar(StyleVar.WindowRounding, 0); if (ImGui.BeginWindow("", WindowFlags.NoMove | WindowFlags.NoResize | WindowFlags.NoCollapse | WindowFlags.NoSavedSettings | WindowFlags.NoTitleBar | WindowFlags.NoBringToFrontOnFocus)) { JsonTree.Render(); ImGui.EndWindow(); } ImGui.PopStyleVar(); }
public override void Render() { if (Open) { ImGui.GetStyle().WindowRounding = 10; ImGui.BeginWindow(Title, ref open, WindowFlags.AlwaysAutoResize); ImGuiNative.igSetWindowFontScale(2.0f); foreach (var widget in widgets) { widget.Render(); } ImGui.EndWindow(); } }
private void SubmitImGuiStuff() { ImGui.GetStyle().WindowRounding = 0; ImGui.SetNextWindowSize(new System.Numerics.Vector2(_nativeWindow.Width - 10, _nativeWindow.Height - 20), Condition.Always); ImGui.SetNextWindowPos(ImGui.GetIO().DisplaySize, Condition.Always, new System.Numerics.Vector2(1f)); ImGui.BeginWindow("ImGUI.NET Sample Program", ref _mainWindowOpened, WindowFlags.NoResize | WindowFlags.NoTitleBar | WindowFlags.NoMove); ce.Render("TGREdit", new System.Numerics.Vector2(_nativeWindow.Width, _nativeWindow.Height), false); ImGui.EndWindow(); if (ImGui.GetIO().AltPressed&& ImGui.GetIO().KeysDown[(int)Key.F4]) { _nativeWindow.Close(); } }
private void TestWindow_InputSystem(InputSystem inputSystem) { ImGui.BeginWindow("InputSystem"); { foreach (var item in inputSystem.Actions) { ImGui.Text($"{ item.Name } = { inputSystem.GetAction(item.Name) }"); } ImGui.Separator(); foreach (var item in inputSystem.Axis) { ImGui.Text($"{ item.Name } = { inputSystem.GetAxis(item.Name) }"); } } ImGui.EndWindow(); }
public override void Update(float deltaSeconds) { if (_input.GetKeyDown(Veldrid.Platform.Key.Escape) && (MenuGlobals.NumMenusOpen == 0 || _visible)) { SetVisible(!_visible); } if (_visible) { if (MenuGlobals.MenuFont != null) { ImGui.PushFont(MenuGlobals.MenuFont); } ImGui.SetNextWindowPosCenter(SetCondition.Always); var io = ImGui.GetIO(); ImGui.SetNextWindowSize(new Vector2(io.DisplaySize.X * .5f, io.DisplaySize.Y * .4f), SetCondition.Always); if (ImGui.BeginWindow("Pause Menu", WindowFlags.NoResize | WindowFlags.NoCollapse | WindowFlags.NoTitleBar | WindowFlags.NoMove)) { if (ImGui.Button("Restart (R)")) { Restart(); } if (ImGui.Button("Exit To Main Menu")) { GoToMainMenu(); } if (ImGui.Button("Quit")) { Quit(); } } ImGui.EndWindow(); if (_input.GetKeyDown(Veldrid.Platform.Key.R)) { Restart(); } if (MenuGlobals.MenuFont != null) { ImGui.PopFont(); } } }
public void Render() { if (IsVisible) { ImGui.SetNextWindowPos( new Vector2(ImGui.GetIO().DisplaySize.X * 0.5f, ImGui.GetIO().DisplaySize.Y * 0.5f), Condition.Appearing, new Vector2(0.5f, 0.5f)); bool iv = IsVisible; ImGui.BeginWindow("Character Selection", ref iv, new Vector2(600, 400), 0.8f, WindowFlags.NoCollapse); IsVisible = iv; _availableCharacters.Table("Address", ref _selectedCharacter); ImGui.EndWindow(); } }
public void draw() { if (adbPanelWindowShown) { ImGui.BeginWindow("ADB Devices", ref adbPanelWindowShown, WindowFlags.Default); ImGui.Columns(1, "Devices", true); ImGui.Separator(); foreach (DeviceData device in Singleton <AdbManager> .Instance.listOfDevices) { if (ImGui.Selectable(device.Model + "-" + device.Name + "-" + device.Serial)) { selecteDeviceData = device; } ImGui.NextColumn(); } ImGui.Separator(); ImGui.EndWindow(); } if (logCatWindowShown) { List <String> stringList = new List <string>(); try { stringList = selecteDeviceData == null ? new List <string>() : (AdbManager.Instance.serialStringBuilderDict.ContainsKey(selecteDeviceData.Serial) ? AdbManager.Instance.serialStringBuilderDict[ selecteDeviceData.Serial] : new List <string>()); } catch (Exception e) { Console.WriteLine(e); } ImGui.BeginWindow("ADB Logcat", ref logCatWindowShown, WindowFlags.Default); for (int i = 0; i < stringList.Count; i++) { ImGui.TextUnformatted(stringList[i]); ImGui.Separator(); } ImGui.SetScrollHere(1.0f); ImGui.EndWindow(); } }
//private UTF8Encoding _utf8 = new UTF8Encoding(); private void SubmitGui() { ImGui.NewFrame(); //Make a new GUI window with the same size as the OpenGL window //ImGui.SetNextWindowSize(new Vector2(Width, Height), SetCondition.FirstUseEver); //ImGui.SetNextWindowPosCenter(SetCondition.Always); ImGui.PushStyleColor(ColorTarget.WindowBg, new Vector4(0, 0, 0, 0)); ImGui.BeginWindow("Main Window", ref WindowOpen, WindowFlags.NoResize | WindowFlags.NoTitleBar | WindowFlags.NoMove); ImGui.PopStyleColor(); //Create main menu bar SubmitMenuBar(); //Create the menu bar below the main menu bar SubmitSecondaryMenuBar(); //Popup windows ImGui.PushStyleVar(StyleVar.WindowMinSize, new Vector2(80, 80)); if (ShowConsole) { ImGui.BeginWindow("Console", ref ShowConsole, WindowFlags.Default); //ImGui.Text(stringWriter.ToString()); ImGui.EndWindow(); } if (ShowOpenGLConsole) { ImGui.BeginWindow("OpenGL Console", ref ShowOpenGLConsole, WindowFlags.Default); //Create callback //GetGlDebugMessages(); ImGui.EndWindow(); } //ShowStyleEditor(); ImGui.PopStyleVar(); ImGui.EndWindow(); }
internal void Draw(string contentFolder) { if (!IsOpen) { return; } ImGui.BeginWindow("Texture Editor", ref IsOpen, new Vector2(500, 300), 1.0f, WindowFlags.Default); if (!_textureFilesCached) { _textureFiles.Clear(); IEnumerable <string> files = IOUtils.EnumerateFilesInDirectoryResursively(contentFolder); foreach (string file in files) { string ext = Path.GetExtension(file)?.ToLower(); if (ext == ".png" || ext == ".jpg" || ext == ".jpeg" || ext == ".bmp" || ext == ".gif") { _textureFiles.Add(file); } } _textureFilesCached = true; } ImGui.Combo("Texture", ref TextureIndex, _textureFiles.ToArray()); if (TextureIndex != _prevTextureIndex) { texture?.Dispose(); texture = new Texture(_textureFiles[TextureIndex], TextureCreateOptions.Sharp); } _prevTextureIndex = TextureIndex; if (texture != null) { ImGui.Image(new IntPtr(texture.Handle), new Vector2(texture.Size.X, texture.Size.Y), Vector2.Zero, Vector2.Unit, Color.White, Color.White); } ImGui.EndWindow(); }
public void Draw(ref bool isGameViewFocused) { ImGui.SetNextWindowPos(Vector2.Zero, Condition.Always, Vector2.Zero); ImGui.SetNextWindowSize(new Vector2(_gameWindow.ClientBounds.Width, _gameWindow.ClientBounds.Height), Condition.Always); ImGui.PushStyleVar(StyleVar.WindowRounding, 0); ImGui.BeginWindow("OpenSAGE Viewer", WindowFlags.MenuBar | WindowFlags.NoTitleBar); if (_gamePanel != null) { _gamePanel.IsGameViewActive = isGameViewFocused; DrawMainUi(ref isGameViewFocused); } else { DrawNoGamesUi(); } ImGui.EndWindow(); ImGui.PopStyleVar(); }
protected virtual void ImGuiLayout() { // 1. Show a simple window // Tip: if we don't call ImGui.Begin()/ImGui.End() the widgets appears in a window automatically called "Debug" { ImGui.Text("Hello, world!"); ImGui.SliderFloat("float", ref f, 0.0f, 1.0f, null, 1f); ImGui.ColorEdit3("clear color", ref clear_color); if (ImGui.Button("Test Window")) { show_test_window = !show_test_window; } if (ImGui.Button("Another Window")) { show_another_window = !show_another_window; } ImGui.Text(string.Format("Application average {0:F3} ms/frame ({1:F1} FPS)", 1000f / ImGui.GetIO().Framerate, ImGui.GetIO().Framerate)); ImGui.InputText("Text input", _textBuffer, 100, InputTextFlags.Default, null); ImGui.Text("Texture sample"); ImGui.Image(_imGuiTexture, new Num.Vector2(300, 150), Num.Vector2.Zero, Num.Vector2.One, Num.Vector4.One, Num.Vector4.One); // Here, the previously loaded texture is used } // 2. Show another simple window, this time using an explicit Begin/End pair if (show_another_window) { ImGui.SetNextWindowSize(new Num.Vector2(200, 100), Condition.FirstUseEver); ImGui.BeginWindow("Another Window", ref show_another_window, WindowFlags.Default); ImGui.Text("Hello"); ImGui.EndWindow(); } // 3. Show the ImGui test window. Most of the sample code is in ImGui.ShowTestWindow() if (show_test_window) { ImGui.SetNextWindowPos(new Num.Vector2(650, 20), Condition.FirstUseEver); ImGuiNative.igShowDemoWindow(ref show_test_window); } }
private void SubmitSecondaryMenuBar() { //Set position under main menu bar //ImGui.SetNextWindowPos(new Vector2(0, _secondaryMenuBarOffset), SetCondition.Always); //ImGui.SetNextWindowSize(new Vector2(Width, 40), SetCondition.Always); ImGui.PushStyleVar(StyleVar.WindowPadding, new Vector2(5f, 5f)); ImGui.PushStyleVar(StyleVar.WindowRounding, 0); Style style = ImGui.GetStyle(); ImGui.BeginWindow("inner window", WindowFlags.NoMove | WindowFlags.NoTitleBar | WindowFlags.NoResize | WindowFlags.NoScrollbar | WindowFlags.NoScrollWithMouse); //Calculate the height the button should be so that it is vertically centered on the bar var padding = style.FramePadding; float centeredHeight = ImGui.GetWindowHeight() - 2 * padding.Y; ImGui.SameLine(0, 5f); if (ImGui.Button("Btn1", new Vector2(centeredHeight, centeredHeight))) { } ImGui.SameLine(); if (ImGui.Button(("Button2"))) { } ImGui.SameLine(); if (ImGui.Button("test")) { } ImGui.PopStyleVar(2); ImGui.EndWindow(); }
public void DrawGui() { if (ImGui.BeginWindow(name, m_WindowFlags)) { PreTryResize(); if (!ImGui.IsAnyItemActive()) { if (ImGui.IsMouseReleased(0)) { m_ResizingDirections = Direction.None; } SetFlags(); SetCursor(); Resize(); } DrawWindowElements(); } ImGui.EndWindow(); }
private void DrawMaterialControl() { if (_materialControlVisible && ImGui.BeginWindow("Material Control", ref _materialControlVisible, WindowFlags.NoCollapse)) { CacheConsoleVariables(); DrawIntSlider(_fpsMax, "Maximum Frames Per Second", 0, 1000, "%d FPS"); DrawFloatSlider(_mainGamma, "Main Gamma", 0, 10, "%0.1f"); DrawFloatSlider(_textureGamma, "Texture Gamma", 0, 10, "%0.1f"); DrawFloatSlider(_lightingGamma, "Lighting Gamma", 0, 10, "%0.1f"); DrawFloatSlider(_brightness, "Brightness Override", 0, 10, "%0.1f"); DrawIntSlider(_maxSize, "Constrain texture scales to this maximum size", ImageConversionUtils.MinimumMaxImageSize, 1 << 14, "%d"); DrawIntSlider(_roundDown, "Round Down texture scales using this exponent", ImageConversionUtils.MinSizeExponent, ImageConversionUtils.MaxSizeExponent, "%d"); DrawIntSlider(_picMip, "Scale down texture scales this many times", ImageConversionUtils.MinSizeExponent, ImageConversionUtils.MaxSizeExponent, "%d"); DrawCheckbox(_overbright, "Enable overbright"); DrawCheckbox(_fullbright, "Enable fullbright"); DrawCheckbox(_powerOf2Textures, "Enable power of 2 texture rescaling"); ImGui.EndWindow(); } }
internal void Render(Sprite sprite) { Vector2 window_pos = new Vector2(); var window_size = new Vector2(320, 320); var draw_list = ImGui.GetOverlayDrawList(); if (Services.CompassSettings.OverlayCorner != -1) { window_pos = new Vector2( Services.CompassSettings.OverlayCorner == 1 ? ImGui.GetIO().DisplaySize.X - Services.CompassSettings.DISTANCE : Services.CompassSettings.DISTANCE, Services.CompassSettings.OverlayCorner == 2 ? ImGui.GetIO().DisplaySize.Y - Services.CompassSettings.DISTANCE : Services.CompassSettings.DISTANCE); ImGui.SetNextWindowPos(window_pos, Condition.Always); } ImGui.SetNextWindowSize(window_size, Condition.Always); if (ImGui.BeginWindow("Overlay", ref Services.CompassSettings.OverlayOpened, window_size, 0, (Services.CompassSettings.OverlayCorner != -1 ? WindowFlags.NoMove : 0) | WindowFlags.NoTitleBar | WindowFlags.NoResize | WindowFlags.NoFocusOnAppearing)) { window_pos = ImGui.GetWindowPosition(); if (ImGuiNative.igBeginPopupContextWindow("Options", 1, true)) { if (ImGui.MenuItem("Custom position", null, Services.CompassSettings.OverlayCorner == -1, true)) { Services.CompassSettings.OverlayCorner = -1; } if (ImGui.MenuItem("Top right", null, Services.CompassSettings.OverlayCorner == 0, true)) { Services.CompassSettings.OverlayCorner = 0; } if (ImGui.MenuItem("Settings", null, Services.CompassSettings.SettingsOpened, true)) { Services.CompassSettings.SettingsOpened = !Services.CompassSettings.SettingsOpened; } ImGuiNative.igEndPopup(); } draw_list.AddCircleFilled( new Vector2(window_pos.X + window_size.X * 0.5f, window_size.Y * 0.5f + window_pos.Y), 160, Color.FromArgb(76, 15, 15, 15).ToDx9ARGB(), 128 ); draw_list.AddLine(new Vector2(window_pos.X + window_size.X * 0.5f, window_pos.Y), new Vector2(window_pos.X + window_size.X * 0.5f, window_pos.Y + window_size.Y), Color.FromArgb(90, 70, 70, 255).ToDx9ARGB(), 1f); draw_list.AddLine(new Vector2(window_pos.X, window_pos.Y + window_size.Y * 0.5f), new Vector2(window_pos.X + window_size.X, window_pos.Y + window_size.Y * 0.5f), Color.FromArgb(89, 70, 70, 255).ToDx9ARGB(), 1f); var dot1 = new Vector2(window_pos.X + window_size.X * 0.5f, window_pos.Y + window_size.Y * 0.5f); var dot2 = new Vector2(window_pos.X + window_size.X - 30, window_pos.Y + window_size.Y * 0.5f); var final = CameraScanner.CameraAddress != 0 ? RotatePoint(dot2, dot1, new Angle(CameraScanner.Angle()).Gradus - 90) : RotatePoint(dot2, dot1, PacketProcessor.Instance.EntityTracker.CompassUser.Heading.Gradus - 90); draw_list.AddLine(dot1, final, Color.FromArgb(120, 255, 255, 255).ToDx9ARGB(), 1f); var values = PlayerModels.Values.ToArray(); for (var i = 0; i < values.Length; i++) { if (Services.CompassSettings.CaptureOnlyEnemy && Services.CompassSettings.FriendlyTypes.Contains(values[i].Relation)) { continue; } if (Services.CompassSettings.FilterByClasses && Services.CompassSettings.FilteredClasses.Contains(values[i].PlayerClass)) { continue; } uint color; if (values[i].Dead) { Services.CompassSettings.RelationColors.TryGetValue(RelationType.Dead, out color); } else { if (!Services.CompassSettings.RelationColors.TryGetValue(values[i].Relation, out color)) { Services.CompassSettings.RelationColors.TryGetValue(RelationType.Unknown, out color); } } var ScreenPosition = GetScreenPos(values[i]); color = color.ToDx9ARGB(); draw_list.AddCircleFilled( new Vector2(window_pos.X + ScreenPosition.X, window_pos.Y + ScreenPosition.Y), Services.CompassSettings.PlayerSize, color, Services.CompassSettings.PlayerSize * 2); if (Services.CompassSettings.ShowNicknames) { draw_list.AddText( new Vector2(window_pos.X + ScreenPosition.X - values[i].Name.Length * 4 / 2f, window_pos.Y + ScreenPosition.Y + Services.CompassSettings.PlayerSize), $"{values[i].Name}", color); } } } ImGui.EndWindow(); if (PacketProcessor.Instance.EntityTracker.CompassUser.Status == 1 && DXHookD3D9._imageCache.TryGetValue("incombat.png", out var texture)) { sprite.Draw(texture, new SharpDX.Mathematics.Interop.RawColorBGRA(255, 255, 255, 255), null, null, new SharpDX.Mathematics.Interop.RawVector3(window_pos.X + window_size.X - 32, window_pos.Y + window_size.Y - 64, 0)); } if (PlayerModels.Count > 0) { if (Services.CompassSettings.StatisticsOpened) { var GuldList = PlayerModels.Values .ToArray() .GroupBy(x => x.GuildName.Length == 0 ? "Without Guild" : x.GuildName, (key, g) => new { GuildName = key, Players = g.ToList() }) .OrderByDescending(x => x.Players.Count).ToHashSet(); if (GuldList.Count > 0) { ImGui.SetNextWindowPos(new Vector2(window_pos.X, window_pos.Y + window_size.Y), Condition.Always); if (ImGui.BeginWindow("Guilds", ref Services.CompassSettings.OverlayOpened, new Vector2(350, 200), 0.3f, WindowFlags.NoTitleBar | WindowFlags.NoFocusOnAppearing)) { ImGui.BeginChild("left pane", new Vector2(150, 0), true); foreach (var i in GuldList) { if (ImGui.Selectable($"{i.GuildName} ({i.Players.Count})", Services.CompassSettings.SelectedGuildName == i.GuildName)) { Services.CompassSettings.SelectedGuildName = i.GuildName; } } ImGui.EndChild(); ImGui.SameLine(); ImGuiNative.igBeginGroup(); ImGui.BeginChild("item view", new Vector2(0, -ImGui.GetFrameHeightWithSpacing()), true); // Leave room for 1 line below us ImGui.TextUnformatted($"Guild name {Services.CompassSettings.SelectedGuildName}\n"); ImGui.Columns(3, null, true); var players = GuldList.SingleOrDefault(x => x.GuildName == Services.CompassSettings.SelectedGuildName) ?.Players?.GroupBy(x => x.PlayerClass, (key, g) => new { Class = key, Players = g.ToList() }); if (players != null) { foreach (var details in players) { if (ImGui.GetColumnIndex() == 0) { ImGui.Separator(); } ImGui.TextUnformatted($"{details.Class.ToString()} ({details.Players.Count})\n"); if (details.Players?.Count > 0) { foreach (var name in details.Players) { ImGui.TextUnformatted($"{name.Name}\n"); } } ImGui.NextColumn(); } } ImGui.Columns(1, null, true); ImGui.Separator(); ImGui.EndChild(); ImGuiNative.igEndGroup(); } ImGui.EndWindow(); } } } if (Services.CompassSettings.SettingsOpened) { if (ImGui.BeginWindow("Settings", ref Services.CompassSettings.SettingsOpened, new Vector2(350, 400), 0.3f, WindowFlags.NoFocusOnAppearing | WindowFlags.AlwaysAutoResize)) { ImGui.Checkbox("Guild statistic", ref Services.CompassSettings.StatisticsOpened); ImGui.Checkbox("Show only enemy players", ref Services.CompassSettings.CaptureOnlyEnemy); ImGui.Checkbox("Filter by classes", ref Services.CompassSettings._filterByClasses); ImGui.Checkbox("Show nicknames", ref Services.CompassSettings._showNicknames); ImGui.Checkbox("Perfomance test", ref Services.CompassSettings._showFps); ImGui.SliderFloat("Zoom", ref Services.CompassSettings._zoom, 1, 20, $"Zoom={Services.CompassSettings.Zoom}", 2f); if (ImGui.IsLastItemActive() || ImGui.IsItemHovered(HoveredFlags.Default)) { ImGui.SetTooltip($"{Services.CompassSettings.Zoom:F2}"); } ImGui.SliderInt("PlayerSize", ref Services.CompassSettings._playerSize, 1, 10, $"PlayerSize = {Services.CompassSettings.PlayerSize}"); if (ImGui.IsLastItemActive() || ImGui.IsItemHovered(HoveredFlags.Default)) { ImGui.SetTooltip($"{Services.CompassSettings.PlayerSize}"); } if (ImGui.CollapsingHeader("Settings for filter by class ", TreeNodeFlags.CollapsingHeader | TreeNodeFlags.AllowItemOverlap)) { ImGui.TextUnformatted("Common ignored"); ImGui.Columns(3, null, false); foreach (PlayerClass i in Enum.GetValues(typeof(PlayerClass))) { var flag = Services.CompassSettings.FilteredClasses.Contains(i); ImGui.Checkbox(i.ToString(), ref flag); if (flag) { Services.CompassSettings.FilteredClasses.Add(i); } else if (Services.CompassSettings.FilteredClasses.Contains(i)) { Services.CompassSettings.FilteredClasses.Remove(i); } ImGui.NextColumn(); } ImGui.Columns(1, null, false); } if (ImGui.CollapsingHeader("Colors for player relation", TreeNodeFlags.CollapsingHeader)) { var keys = Services.CompassSettings.RelationColors.Keys.ToArray(); for (var i = 0; i < keys.Length; i++) { Services.CompassSettings.RelationColors.TryGetValue(keys[i], out var color); Services.CompassSettings.R[i] = ((color >> 16) & 255) / 255f; Services.CompassSettings.G[i] = ((color >> 8) & 255) / 255f; Services.CompassSettings.B[i] = ((color >> 0) & 255) / 255f; Services.CompassSettings.A[i] = ((color >> 24) & 255) / 255f; ImGui.TextUnformatted(keys[i].ToString()); ImGui.SameLine(); ImGui.ColorEdit4(keys[i].ToString(), ref Services.CompassSettings.R[i], ref Services.CompassSettings.G[i], ref Services.CompassSettings.B[i], ref Services.CompassSettings.A[i], ColorEditFlags.NoInputs | ColorEditFlags.RGB | ColorEditFlags.NoLabel); uint mr = Services.CompassSettings.R[i] >= 1.0 ? 255 : Services.CompassSettings.R[i] <= 0.0 ? 0 : (uint)Math.Round(Services.CompassSettings.R[i] * 255f), mg = Services.CompassSettings.G[i] >= 1.0 ? 255 : Services.CompassSettings.G[i] <= 0.0 ? 0 : (uint)Math.Round(Services.CompassSettings.G[i] * 255f), mb = Services.CompassSettings.B[i] >= 1.0 ? 255 : Services.CompassSettings.B[i] <= 0.0 ? 0 : (uint)Math.Round(Services.CompassSettings.B[i] * 255f), ma = Services.CompassSettings.A[i] >= 1.0 ? 255 : Services.CompassSettings.A[i] <= 0.0 ? 0 : (uint)Math.Round(Services.CompassSettings.A[i] * 255f); Services.CompassSettings.RelationColors[keys[i]] = (ma << 24) | (mr << 16) | (mg << 8) | (mb << 0); } } if (ImGui.Button("Save settings")) { Services.Tracker.RunAutoPersist(); } ImGui.SameLine(); if (ImGui.Button("Reset to default")) { Services.CompassSettings.ResetSettings(); Services.Tracker.RunAutoPersist(); } //if (ImGuiRender.Icons.TryGetValue("incombat.png", out var intPtr)) //{ // ImGui.TextUnformatted(ImGuiRender.Icons.Keys.First()); // ImGui.Image(intPtr, new Vector2(64, 64), new Vector2(0, 0), new Vector2(1, 1), // new Vector4(0, 0, 0, 0), new Vector4(1, 1, 1, 1)); //} } ImGui.EndWindow(); } }