private void AnimationPreviewTab() { _animatedPreviewAnchorMode = false; ImGui.InputInt("Zoom", ref _zoomLevel); ImGui.Text($"Frame {_controller.CurrentFrameIndex}/{_controller.CurrentAnimationData.FrameIndices.Length}"); bool paused = !_playing; if (ImGui.Button("Play/Pause")) { _playing = !_playing; } if (paused) { ImGui.SameLine(); if (ImGui.ArrowButton("Prev Frame", ImGuiDir.Left)) { _controller.ForceNextFrame(); } ImGui.SameLine(); if (ImGui.ArrowButton("Next Frame", ImGuiDir.Right)) { _controller.ForcePrevFrame(); } } if (_animatedPreviewFb != null) { FrameBufferTexture texture = _animatedPreviewFb.ColorAttachment; (Vector2 uv1, Vector2 uv2) = texture.GetImGuiUV(); ImGui.Image((IntPtr)texture.Pointer, texture.Size * _zoomLevel, uv1, uv2); } }
public override void DrawPropertyValue(PropertyInfo property, object instance = null) { if (IsGeneralType(property.PropertyType) == false && property.PropertyType.IsEnum == false) { return; } if (property.CanRead && (instance != null || IsPropertyStatic(property))) { Caller.Try(() => { ImGui.TableSetColumnIndex(2); //Indexer need handle string value = property.GetValue(instance, null).ToString(); ImGui.Text(value); if (property.CanWrite) { ImGui.SameLine(); if (ImGui.ArrowButton(property.Name, ImGuiDir.Left)) { valueInputWindow.Show(property, instance); } } }); } }
public override void DrawFieldValue(FieldInfo field, object instance = null) { if (IsGeneralType(field.FieldType) == false && field.FieldType.IsEnum == false) { return; } if (instance == null && field.IsStatic == false) { return; } Caller.Try(() => { string value = field.GetValue(instance).ToString(); ImGui.Text(value); if (!field.IsLiteral) { ImGui.SameLine(); if (ImGui.ArrowButton(field.Name, ImGuiDir.Left)) { valueInputWindow.Show(field, instance); } } }); }
public static bool BeginComboFixed(string label, string previewValue) { string labelOnly = label.Contains("##") ? label.Split("##")[0] : label; ImGui.Text(labelOnly); ImGui.SameLine(); string popupId = label + "Popup"; var popupPos = ImGui.GetMousePosOnOpeningCurrentPopup(); ImGui.ArrowButton("##" + label + "ButtonArrow", ImGuiDir.Right); ImGui.OpenPopupOnItemClick(popupId, ImGuiPopupFlags.MouseButtonLeft); ImGui.SameLine(); var cursorPosAfterArrowButton = ImGui.GetCursorPos(); ImGui.SetCursorPos(new Vector2(cursorPosAfterArrowButton.X - 10, cursorPosAfterArrowButton.Y)); ButtonGradient(previewValue + "##" + label + "ButtonMain"); ImGui.OpenPopupOnItemClick(popupId, ImGuiPopupFlags.MouseButtonLeft); if (ImGui.IsPopupOpen(popupId)) { ImGui.SetNextWindowPos(popupPos, ImGuiCond.Appearing); ImGui.SetNextWindowSize(new Vector2(300, 400)); return(ImGui.BeginPopupContextItem(popupId)); } return(false); }
private static void AddSubtractAction(string id, float step, Action <float> action) { var save = false; ImGui.BeginGroup(); ImGui.PushButtonRepeat(true); if (ImGui.ArrowButton($"##Subtract{id}", ImGuiDir.Down)) { action(-step); save = true; } ImGui.SameLine(); if (ImGui.ArrowButton($"##Add{id}", ImGuiDir.Up)) { action(step); save = true; } ImGui.PopButtonRepeat(); ImGui.SameLine(); ImGui.TextUnformatted(id); ImGui.EndGroup(); if (!save) { return; } Cammy.Config.Save(); if (CurrentPreset == PresetManager.activePreset) { CurrentPreset.Apply(); } }
public override void DrawArrayValue(Array array, object element, int index) { Caller.Try(() => { ImGui.Text(element.ToString()); ImGui.SameLine(); if (ImGui.ArrowButton(index.ToString() + element.ToString(), ImGuiDir.Left)) { ArrayElementInputWindow.GetInstance().Show(array, element, index); } }); }
private void ShowImage(Texture2D texture, ILogger logger) { if (!string.IsNullOrWhiteSpace(texture.Name)) { ImGui.Text(texture.Name); } ImGui.Text($"{texture.Width}x{texture.Height}x{texture.LevelCount} @ {texture.Format}"); var windowSize = ImageUtilities.GetWindowSize(); var imageSize = ImageUtilities.FitToBounds(texture.Width, texture.Height, windowSize.X, windowSize.Y); ImGui.Image((IntPtr)texture.Tag, imageSize); if (ImGui.Button("Edit")) { var temp = Path.Join(Path.GetTempPath(), $"{DateTime.Now.Ticks}.png"); try { this.SaveTexture(temp, texture); Process.Start(this.ImageEditor, temp); } catch (Exception ex) { logger.Warning(ex, "Could not save or open file {@file}", temp); } } ImGui.SameLine(); if (ImGui.ArrowButton("InspectorLeft", ImGuiDir.Left)) { --this.selected; } ImGui.SameLine(); ImGui.Text($"{this.selected + 1}/{this.Textures.Count}"); ImGui.SameLine(); if (ImGui.ArrowButton("InspectorRight", ImGuiDir.Right)) { ++this.selected; } ImGui.SameLine(); if (ImGui.Button("Remove")) { this.Textures.RemoveAt(this.selected); } }
public override void DrawPropertyValue(PropertyInfo property, object classInstance = null) { if (property is null) { return; } if (IsGeneralType(property.PropertyType) == false && property.PropertyType.IsEnum == false) { return; } if (property.CanRead == false) { return; } if (Invokable(property, classInstance) == false) { return; } string value = ""; Caller.Try(() => { value = property.GetValue(classInstance, null).ToString(); }); if (property.CanWrite == false) { ImGui.Text(value); } else { ImGui.Text(value); ImGui.SameLine(); if (ImGui.ArrowButton("##" + property.Name, ImGuiDir.Down)) { RuntimeExplorerApp.Instance.PropertyValueInputWindow.Show(property, classInstance); } if (ImGui.IsItemHovered()) { ImGui.SetTooltip("Set " + property.Name + " value"); } } }
public void DrawLeft() { var color = new Vector4(0.6f, 0.6f, 0.6f, 0.65f); ImGui.BeginChild("InstanceTableChlid", new Vector2(ImGui.GetWindowContentRegionWidth() * 0.35f, ImGui.GetWindowHeight())); ImGui.Text("Instance List"); InstanceInfo removeInfo = new InstanceInfo(); ImGuiEx.TableView("InstanceTable", () => { foreach (InstanceInfo instance in instanceList) { ImGui.TableNextRow(); if (instance == curInstance) { ImGui.TableSetBgColor(ImGuiTableBgTarget.RowBg0 + 1, ImGui.GetColorU32(color)); } ImGuiEx.TableTextRow(0, instance.parent, instance.type.Name); ImGui.TableSetColumnIndex(2); if (ImGui.Button(instance.name.ToString())) { UpdateView(instance); break; //prevent error } ImGui.TableSetColumnIndex(3); if (ImGui.ArrowButton(instance.GetHashCode().ToString(), ImGuiDir.Down)) { removeInfo = instance; } } }, tableFlags, "Parent", "Type", "Name", "Close"); if (removeInfo != null) { instanceList.Remove(removeInfo); } ImGui.EndChild(); }
public override void DrawFieldValue(FieldInfo field, object instance = null) { if (field is null) { return; } if (IsGeneralType(field.FieldType) == false && field.FieldType.IsEnum == false) { return; } //Can't get value if (instance == null && field.IsStatic == false) { return; } Caller.Try(() => { string value = field.GetValue(instance).ToString(); if (field.IsLiteral) { ImGui.Text(value); } else { ImGui.Text(value); ImGui.SameLine(); if (ImGui.ArrowButton("##" + field.ToString(), ImGuiDir.Down)) { RuntimeExplorerApp.Instance.FieldValueInputWindow.Show(field, instance); } if (ImGui.IsItemHovered()) { ImGui.SetTooltip("Set " + field.Name + " value"); } } }); }
/// <summary> /// </summary> private void HandleTextboxes() { ImGui.Dummy(new Vector2(0, 10)); ImGui.Text("Time"); if (ImGui.InputText("", ref TextTime, 100, SelectedTimingPoints.Count == 0 ? ImGuiInputTextFlags.ReadOnly : ImGuiInputTextFlags.CharsDecimal)) { if (string.IsNullOrEmpty(TextTime) || string.IsNullOrWhiteSpace(TextTime)) { TextTime = "0"; } TextTime = OnlyDigits(TextTime); } // User stopped typing in the time field, so it needs to be updated if (!ImGui.IsItemActive() && TextTimeFocusedInLastFrame) { UpdateSelectedTimingPoints(); } TextTimeFocusedInLastFrame = ImGui.IsItemActive(); ImGui.SameLine(); if (SelectedTimingPoints.Count == 1) { var game = GameBase.Game as QuaverGame; var screen = game?.CurrentScreen as EditorScreen; if (ImGui.ArrowButton("1", ImGuiDir.Left)) { var tp = SelectedTimingPoints.First(); screen?.Ruleset.ActionManager.Perform(new EditorActionChangeTimingPoint(WorkingMap, new List <EditorTimingPointChangeInfo> { new EditorTimingPointChangeInfo(tp, tp.StartTime - 1, tp.Bpm) })); TextTime = $"{tp.StartTime:0.00}"; } ImGui.SameLine(); if (ImGui.ArrowButton("2", ImGuiDir.Right)) { var tp = SelectedTimingPoints.First(); screen?.Ruleset.ActionManager.Perform(new EditorActionChangeTimingPoint(WorkingMap, new List <EditorTimingPointChangeInfo> { new EditorTimingPointChangeInfo(tp, tp.StartTime + 1, tp.Bpm) })); TextTime = $"{tp.StartTime:0.00}"; } } ImGui.Dummy(new Vector2(0, 10)); ImGui.Text("BPM"); if (ImGui.InputText(" ", ref TextBpm, 100, SelectedTimingPoints.Count == 0 ? ImGuiInputTextFlags.ReadOnly : ImGuiInputTextFlags.CharsDecimal)) { if (string.IsNullOrEmpty(TextBpm) || string.IsNullOrWhiteSpace(TextBpm)) { TextBpm = "0"; } TextBpm = Decimal(TextBpm); } // User stopped typing in multiplier frame if (!ImGui.IsItemActive() && TextBpmFocusedInLastFrame) { UpdateSelectedTimingPoints(); } TextBpmFocusedInLastFrame = ImGui.IsItemActive(); }
private void DrawComponents(Entity context) { // TODO: fix bool entityEnabled = context.Enabled; if (ImGui.Checkbox("Enabled", ref entityEnabled)) { context.Enabled = entityEnabled; } var components = context.Components; for (int compi = 0; compi < components.Count; compi++) { Component component = components[compi]; Type componentType = component.GetType(); bool stay = true; ImGui.PushID(componentType.Name + compi); bool valcol = !component.Valid; if (valcol) { ImGui.PushStyleColor(ImGuiCol.Header, new Vector4(0.412f, 0.118f, 0.118f, 1.0f)); ImGui.PushStyleColor(ImGuiCol.HeaderHovered, new Vector4(0.729f, 0.208f, 0.208f, 1.0f)); } // item shifting drop unsafe { // smoll fix bool resetTarget = false; if (targetedComponent == component) { ImGui.Button("##target", new Vector2(ImGui.GetColumnWidth(), 2.5f)); if (ImGui.IsItemHovered()) { resetTarget = true; } } if (ImGui.BeginDragDropTarget()) { var payload = ImGui.AcceptDragDropPayload("_COMPONENT"); if (payload.NativePtr != null && selectedDragNDropComponent != null) { int tci = Context.ActiveEntity.GetComponentIndex(targetedComponent); if (tci > Context.ActiveEntity.GetComponentIndex(selectedDragNDropComponent)) { tci--; } Context.ActiveEntity.ShiftComponent(selectedDragNDropComponent, tci); selectedDragNDropComponent = null; targetedComponent = null; } ImGui.EndDragDropTarget(); } if (resetTarget) { targetedComponent = null; } } bool collapsingHeader = ImGui.CollapsingHeader(componentType.Name, ref stay); // item shifting drag { if (ImGui.BeginDragDropSource()) { ImGui.Text("Component: " + componentType.Name); selectedDragNDropComponent = component; ImGui.SetDragDropPayload("_COMPONENT", IntPtr.Zero, 0); ImGui.EndDragDropSource(); } if (ImGui.BeginDragDropTarget()) { targetedComponent = component; ImGui.EndDragDropTarget(); } } // contex menu { if (ImGui.BeginPopupContextItem()) { if (ImGui.MenuItem("Move Up")) { context.ShiftComponent(component, Math.Max(0, compi - 1)); } if (ImGui.MenuItem("Move Down")) { context.ShiftComponent(component, Math.Min(components.Count - 1, compi + 1)); } ImGui.Separator(); if (ImGui.MenuItem("Remove")) { Context.ActiveEntity.RemoveComponent(component); } ImGui.EndPopup(); } } var style = ImGui.GetStyle(); float collapsingHeaderButtonOffset = ((ImGui.GetTextLineHeight() + style.FramePadding.Y * 2) + 1); ImGui.SameLine(ImGui.GetContentRegionAvail().X - (collapsingHeaderButtonOffset * 1 + style.FramePadding.X + style.FramePadding.Y)); bool enabled = component.Enabled; if (ImGui.Checkbox("##enabled", ref enabled)) { component.Enabled = enabled; } ImGui.SameLine(ImGui.GetContentRegionAvail().X - (collapsingHeaderButtonOffset * 2 + style.FramePadding.X + style.FramePadding.Y)); if (ImGui.ArrowButton("up", ImGuiDir.Up)) { context.ShiftComponent(component, Math.Max(0, compi - 1)); } ImGui.SameLine(ImGui.GetContentRegionAvail().X - (collapsingHeaderButtonOffset * 3 + style.FramePadding.X + style.FramePadding.Y)); if (ImGui.ArrowButton("down", ImGuiDir.Down)) { context.ShiftComponent(component, Math.Min(components.Count - 1, compi + 1)); } if (collapsingHeader) { ImGuiUtils.BeginGroupFrame(); MemberInfo[] membs = componentType.GetMembers(); for (int mi = 0; mi < membs.Length; mi++) { var mem = membs[mi]; if (mem.MemberType == MemberTypes.Field || mem.MemberType == MemberTypes.Property) { PropertyDrawer.DrawEditorValue(mem, component); } } //ImGui.Separator(); ImGuiUtils.EndGroupFrame(); } if (valcol) { ImGui.PopStyleColor(2); } ImGui.PopID(); if (!stay) { Context.ActiveEntity.RemoveComponent(component); } } }
private void DrawAliasSettings() { var newAliasAdded = false; if (ImGui.Button("New Alias")) { Config.AliasList.Insert(0, TeleportAlias.Empty); newAliasAdded = true; } ImGui.SameLine(); ImGui.Spacing(); ImGui.SameLine(); if (ImGui.Button("Delete")) { if (Config.AliasList.Count > 0) { Config.AliasList.RemoveAt(0); } Config.Save(); } var deleteAliasHovered = ImGui.IsItemHovered(); ImGui.SameLine(); if (ImGui.Button("Delete Selected")) { Config.AliasList.RemoveAll(a => a.GuiSelected); Config.Save(); } ImGui.SameLine(); if (ImGui.Button("Delete All")) { ImGui.OpenPopupOnItemClick("deleteallpopup", 0); } if (ImGui.BeginPopup("deleteallpopup")) { ImGui.TextColored(ColorRed, "Are you sure you want to delete ALL aliases?"); if (ImGui.Button("No", new Vector2(80, ImGui.GetTextLineHeightWithSpacing()))) { ImGui.CloseCurrentPopup(); } ImGui.SameLine(ImGui.GetWindowWidth() - 90); if (ImGui.Button("Yes", new Vector2(80, ImGui.GetTextLineHeightWithSpacing()))) { Config.AliasList.Clear(); Config.Save(); ImGui.CloseCurrentPopup(); } ImGui.EndPopup(); } ImGui.Separator(); if (!ImGui.BeginChild("##scrollingregionAlias", Vector2.Zero)) { return; } if (newAliasAdded) { ImGui.SetScrollHereY(); } ImGui.Columns(2); ImGui.TextUnformatted("Alias"); ImGui.NextColumn(); ImGui.TextUnformatted("Target Aetheryte"); ImGui.NextColumn(); ImGui.Separator(); UpdateAetheryteList(); for (var i = 0; i < Config.AliasList.Count; i++) { var alias = Config.AliasList[i]; if (deleteAliasHovered && i == 0) { ImGui.ArrowButton("delete_indicator", ImGuiDir.Right); } else { ImGui.Checkbox($"##hidelabelAliasSelected{i}", ref alias.GuiSelected); } ImGui.SameLine(); ImGui.SetNextItemWidth(ImGui.GetColumnWidth() - 45); if (deleteAliasHovered && i == 0) { ImGui.TextColored(ColorRed, alias.Alias); } else if (ImGui.InputText($"##hidelabelAliasKey{i}", ref alias.Alias, 256)) { Config.Save(); } ImGui.NextColumn(); if (deleteAliasHovered && i == 0) { ImGui.TextColored(ColorRed, alias.Aetheryte); } else { ImGui.SetNextItemWidth(ImGui.GetColumnWidth() - 75); if (ImGui.InputText($"##hidelabelAliasValue{i}", ref alias.Aetheryte, 256)) { Config.Save(); } ImGui.SameLine(); if (ImGui.BeginCombo($"##hidelabelAliasSelect{i}", "", ImGuiComboFlags.NoPreview)) { for (var a = 0; a < _aetheryteList.Length; a++) { var selected = alias.Aetheryte.Equals(_aetheryteList[a], StringComparison.OrdinalIgnoreCase); if (ImGui.Selectable(_aetheryteList[a], selected)) { alias.Aetheryte = _aetheryteList[a]; Config.Save(); } if (selected) { ImGui.SetItemDefaultFocus(); } } ImGui.EndCombo(); } if (ImGui.IsItemHovered()) { ImGui.SetTooltip("Aetheryte Names"); } ImGui.SameLine(); if (ImGui.BeginCombo($"##hidelabelAliasSelectMap{i}", "", ImGuiComboFlags.NoPreview)) { for (var a = 0; a < _mapList.Length; a++) { var selected = alias.Aetheryte.Equals(_mapList[a], StringComparison.OrdinalIgnoreCase); if (ImGui.Selectable(_mapList[a], selected)) { alias.Aetheryte = _mapList[a]; Config.Save(); } if (selected) { ImGui.SetItemDefaultFocus(); } } ImGui.EndCombo(); } if (ImGui.IsItemHovered()) { ImGui.SetTooltip("Map Names"); } } ImGui.NextColumn(); } ImGui.EndChild(); ImGui.Columns(1); }
public static void Render() { // If the queue is empty, we have nothing to report if (ErrorReporting.Queue.Count == 0) { return; } // Clamp _currentErrorIndex _currentErrorIndex = Math.Clamp(_currentErrorIndex, 0, ErrorReporting.Queue.Count - 1); var screenSize = ImGui.GetIO().DisplaySize; var dialogSize = new Vector2(800, 600); ImGui.SetNextWindowSize(dialogSize, ImGuiCond.Appearing); ImGui.SetNextWindowPos((screenSize - dialogSize) * 0.5f, ImGuiCond.Appearing); ImGui.PushStyleColor(ImGuiCol.WindowBg, new Vector4(0.4f, 0.2f, 0.2f, 1.0f)); if (!ImGui.Begin("Unhandled Errors")) { ImGui.PopStyleColor(); return; } ImGui.PopStyleColor(); ImGui.SetWindowFontScale(1.5f); ImGui.Text("Unhandled Exception"); ImGui.SetWindowFontScale(1.25f); var currentErrorText = ErrorReporting.Queue[_currentErrorIndex].Error.ToString(); ImGui.TextWrapped(currentErrorText); ImGui.SetWindowFontScale(1.0f); ImGui.Text($"Error {_currentErrorIndex + 1} of {ErrorReporting.Queue.Count}"); if (ImGui.Button("Dismiss")) { ErrorReporting.Queue.RemoveAt(_currentErrorIndex); if (_currentErrorIndex >= ErrorReporting.Queue.Count) { _currentErrorIndex = ErrorReporting.Queue.Count - 1; } } ImGui.SameLine(); if (ImGui.Button("Dismiss All")) { ErrorReporting.Queue.Clear(); } ImGui.SameLine(); ImGui.Spacing(); ImGui.SameLine(); // Navigate to the previous error in the queue if (_currentErrorIndex > 0) { if (ImGui.ArrowButton("Prev", ImGuiDir.Left)) { _currentErrorIndex--; } } else { ImGui.PushStyleVar(ImGuiStyleVar.Alpha, 0.5f); ImGui.ArrowButton("Prev", ImGuiDir.Left); ImGui.PopStyleVar(); } ImGui.SameLine(); if (_currentErrorIndex + 1 < ErrorReporting.Queue.Count) { if (ImGui.ArrowButton("Next", ImGuiDir.Right)) { _currentErrorIndex++; } } else { ImGui.PushStyleVar(ImGuiStyleVar.Alpha, 0.5f); ImGui.ArrowButton("Next", ImGuiDir.Right); ImGui.PopStyleVar(); } ImGui.SameLine(); ImGui.Spacing(); ImGui.SameLine(); if (ImGui.Button("Copy to Clipboard")) { if (Tig.MainWindow is MainWindow nativeMainWindow) { NativePlatform.SetClipboardText(nativeMainWindow.NativeHandle, currentErrorText); } } ImGui.End(); // Window }
private void DrawMainMenuBar() { if (ImGui.BeginMainMenuBar()) { #region File Menu if (ImGui.BeginMenu("File")) { if (ImGui.MenuItem("New")) { PushModal(new ActionModal("All those beautiful changes will be lost.\nThis operation cannot be undone!\n", ActionModal.ButtonFlags.OKCancel, (flags) => { if (flags == ActionModal.ButtonFlags.OK) { FileNewScene(); } })); } if (ImGui.MenuItem("Open...")) { PushModal(new ActionModal("All those beautiful changes will be lost.\nThis operation cannot be undone!\n", ActionModal.ButtonFlags.OKCancel, (flags) => { if (flags == ActionModal.ButtonFlags.OK) { FileOpenScene(); } })); } ImGui.Separator(); if (ImGui.MenuItem("Save", Context.Scene != null)) { FileSaveScene(); } if (ImGui.MenuItem("Save As...", Context.Scene != null)) { FileSaveSceneAs(); } if (ImGui.MenuItem("Save Copy...", Context.Scene != null)) { FileSaveSceneAs(true); } ImGui.EndMenu(); } #endregion if (ImGui.BeginMenu("Edit")) { ImGui.Separator(); if (ImGui.MenuItem("Config")) { GetPanel <ConfigPanel>().Open = true; } ImGui.EndMenu(); } if (ImGui.BeginMenu("Window")) { if (ImGui.BeginMenu("Panels")) { for (int i = 0; i < _panels.Count; i++) { if (_panels[i].Open != null) { if (ImGui.MenuItem(_panels[i].WindowName, null, (bool)_panels[i].Open)) { _panels[i].Open = !(bool)_panels[i].Open; } } else { ImGui.MenuItem(_panels[i].WindowName); } } ImGui.EndMenu(); } ImGui.EndMenu(); } if (ImGui.BeginMenu("Resources", Context.Scene != null)) { //if (ImGui.BeginMenu("Import Assets")) //{ // if (ImGui.MenuItem("Texture")) // { // // } // // ImGui.EndMenu(); //} // //ImGui.Separator(); if (ImGui.BeginMenu("Assemblies")) { if (ImGui.MenuItem("Load...")) { AssembliesLoad(); ResetComponentTypeRegistry(); } if (ImGui.MenuItem("Load List...")) { AssembliesLoadList(); ResetComponentTypeRegistry(); } ImGui.Separator(); if (ImGui.BeginMenu("Reload", AssemblyLoader.LoadedAssemblies.Count > 0)) { if (ImGui.MenuItem("All")) { AssemblyLoader.ReloadAll(); ResetComponentTypeRegistry(); } ImGui.Separator(); foreach (var item in AssemblyLoader.LoadedAssemblies) { if (ImGui.MenuItem(item.Path)) { AssemblyLoader.Reload(item.Path); ResetComponentTypeRegistry(); break; } } ImGui.EndMenu(); } ImGui.Separator(); if (ImGui.MenuItem("Save List Copy...")) { AssembliesSaveList(); } ImGui.Separator(); if (ImGui.BeginMenu("Unload", AssemblyLoader.LoadedAssemblies.Count > 0)) { foreach (var item in AssemblyLoader.LoadedAssemblies) { if (ImGui.MenuItem(item.Path)) { AssemblyLoader.Unload(item.Path); ResetComponentTypeRegistry(); break; } } ImGui.EndMenu(); } ImGui.EndMenu(); } ImGui.EndMenu(); } // play mode button Vector2 cp = ImGui.GetCursorPos(); cp.X += ImGui.GetColumnWidth() / 2; ImGui.SetCursorPos(cp); bool colorPushed = Context.Scene?.Running == true; if (colorPushed) { ImGui.PushStyleColor(ImGuiCol.Text, 0xff0000dd /*new Vector4(1, 0.2f, 0.1f, 1)*/); } if (ImGui.ArrowButton("##play", Context.Scene?.Running == true ? ImGuiDir.Down : ImGuiDir.Right)) { if (Context.Scene != null) { if (!Context.Scene.Running) { StartPlaymode(); var gamePanel = GetPanel <GamePanel>(); if (gamePanel != null) { // initial resize event Context.Scene.OnEvent(new WindowResizeEvent((uint)gamePanel.WindowSize.X, (uint)gamePanel.WindowSize.Y)); ImGui.SetWindowFocus(gamePanel.WindowName); } } else { EndPlaymode(); SceneUpdate = true; ImGui.SetWindowFocus(GetPanel <ViewportPanel>()?.WindowName); } } } if (colorPushed) { ImGui.PopStyleColor(); } ImGui.Checkbox("##update", ref EditorLayer.Instance.SceneUpdate); ImGui.BeginMainMenuBar(); } }