Skip to content

Commit 7c3170f

Browse files
chore: doing animation section
1 parent 3055c85 commit 7c3170f

1 file changed

Lines changed: 24 additions & 7 deletions

File tree

FreeFrame/Window.cs

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ protected override void OnRenderFrame(FrameEventArgs e)
142142
{
143143
if (_selectedShape != null)
144144
{
145-
RemoveInTimeline(_selectedShape);
145+
RemoveElementInTimeline(_selectedShape);
146146

147147
_shapes.Remove(_selectedShape);
148148
_selectedShape.DeleteObjects();
@@ -223,15 +223,15 @@ protected override void OnRenderFrame(FrameEventArgs e)
223223
//GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill);
224224

225225
_ImGuiController.Update(this, (float)e.Time); // TODO: Explain what's the point of this. Also explain why this order is necessary
226-
//ImGui.ShowDemoWindow();
226+
ImGui.ShowDemoWindow();
227227
ShowUI();
228228
ShowUIDebug();
229229

230230
_ImGuiController.Render(); // Render ImGui elements
231231

232232
SwapBuffers();
233233
}
234-
public void RemoveInTimeline(Shape shapeToRemove)
234+
public void RemoveElementInTimeline(Shape shapeToRemove)
235235
{
236236
List<int> shapesToDelete = new();
237237
foreach (KeyValuePair<int, List<Shape>> shapes in _timeline) // Remove element in the timeline
@@ -253,13 +253,10 @@ public void RemoveInTimeline(Shape shapeToRemove)
253253
}
254254
public void ResetTimeline()
255255
{
256-
List<int> shapesToDelete = new();
257256
foreach (KeyValuePair<int, List<Shape>> shapes in _timeline) // Remove element in the timeline
258257
{
259258
foreach (Shape shape in shapes.Value)
260-
{
261-
shape.DeleteObjects();
262-
}
259+
shape.DeleteObjects();
263260
shapes.Value.Clear();
264261
}
265262
_timeline.Clear();
@@ -689,6 +686,26 @@ public void ShowUI()
689686
ImGui.SetWindowSize(new System.Numerics.Vector2(ClientSize.X / 2, 200));
690687
ImGui.SetWindowPos(new System.Numerics.Vector2(0, ClientSize.Y - ImGui.GetWindowHeight()));
691688
ImGui.Text("Animation");
689+
ImGui.Spacing();
690+
691+
692+
if (_timeline.Count > 0 && _timeline.ContainsKey(_ioTimeline))
693+
{
694+
foreach (Shape shape in _timeline[_ioTimeline])
695+
{
696+
// TODO: Only show the edited fields
697+
ImGui.Text(shape.GetType().Name);
698+
ImGui.Indent();
699+
ImGui.Text(string.Format("X: {0}", shape.X));
700+
ImGui.Text(string.Format("Y: {0}", shape.Y));
701+
ImGui.Text(string.Format("Width: {0}", shape.Width));
702+
ImGui.Text(string.Format("Height: {0}", shape.Height));
703+
ImGui.Text(string.Format("Color: {0}", shape.Color.ToString()));
704+
ImGui.Unindent();
705+
}
706+
}
707+
708+
692709
ImGui.End();
693710

694711

0 commit comments

Comments
 (0)