protected override void RenderContent(RenderComposer composer) { if (ImGui.Button("New From Image")) { var explorer = new FileExplorer <TextureAsset>(LoadSpriteSheetFile); Parent.AddWindow(explorer); } ImGui.SameLine(); if (ImGui.Button("Open AnimatedTexture")) { var explorer = new FileExplorer <XMLAsset <AnimatedTexture> >(LoadAnimatedTexture); Parent.AddWindow(explorer); } ImGui.SameLine(); if (ImGui.Button("Open AnimationController")) { var explorer = new FileExplorer <XMLAsset <AnimationController> >(LoadAnimationController); Parent.AddWindow(explorer); } if (_spriteSheetTexture == null) { return; } if (_animation == null) { ImGui.Text("How are the frames contained in your spritesheet?"); if (ImGui.Button("Grid")) { var win = new GridSettingsWindow(this, (fs, s) => { _animation = new AnimatedTexture(_spriteSheetTexture, fs, s, AnimationLoopType.Normal, 1000); }, (r, c) => { _animation = new AnimatedTexture(_spriteSheetTexture, c, r, AnimationLoopType.Normal, 1000); }); Parent.AddWindow(win); } ImGui.SameLine(); if (ImGui.Button("Auto Detect Frames")) { Rectangle[] frames = AutoDetectFrames(_spriteSheetTexture.Texture); _animation = new AnimatedTexture(_spriteSheetTexture, frames, AnimationLoopType.Normal, 1000); } return; } ImGui.Text($"Current File: {_saveName ?? "None"}"); ImGui.Text($"Texture File: {_spriteSheetTexture.Name} / Resolution: {_spriteSheetTexture.Texture.Size}"); if (ImGui.Button("Reload Image")) { LoadSpriteSheetFile(FileExplorer <TextureAsset> .ExplorerLoadAsset(_spriteSheetTexture.Name)); } if (_playing) { if (ImGui.Button("Pause")) { _playing = false; } } else { if (ImGui.Button("Play")) { _playing = true; } } ImGui.InputInt("Display Scale", ref Scale); ImGui.SameLine(); if (ImGui.Button("Mirror")) { _mirrored = !_mirrored; } if (ImGui.Button("Place Anchor Points")) { if (_anchorPlacerWindow == null || !_anchorPlacerWindow.Open) { Parent.AddWindow(_anchorPlacerWindow = new AnchorPlacer(this, _animation)); } } if (ImGui.Button("Order Frames")) { if (_orderWindow == null || !_orderWindow.Open) { Parent.AddWindow(_orderWindow = new FrameOrderWindow(this, _animation)); } } ImGui.Text($"Current Frame: {_animation.CurrentFrameIndex + 1}/{_animation.AnimationFrames + 1}"); ImGui.Text($"Current Anchor: {(_animation.Anchors.Length > 0 ? _animation.Anchors[_animation.CurrentFrameIndex].ToString() : "Unknown")}"); for (var i = 0; i <= _animation.TotalFrames; i++) { if (i != 0 && i % 5 != 0) { ImGui.SameLine(0, 5); } bool current = _animation.CurrentFrameIndex == i; Rectangle frameBounds = _animation.GetFrameBounds(i); (Vector2 u1, Vector2 u2) = _animation.Texture.GetImGuiUV(frameBounds); ImGui.Image(new IntPtr(_animation.Texture.Pointer), frameBounds.Size / 2f, u1, u2, Vector4.One, current ? new Vector4(1, 0, 0, 1) : Vector4.Zero); } RenderCurrentAnimationSettings(); RenderSaveSection(); RenderAnimation(composer); }