private void UpdateMenu() { if (Engine.Tool.BeginMainMenuBar()) { if (Engine.Tool.BeginMenu("File", true)) { if (Engine.Tool.MenuItem("Save", "", false, true)) { NodeEditorModel.Save(); } if (Engine.Tool.MenuItem("Load", "", false, true)) { NodeEditorModel.Load(); } Engine.Tool.EndMenu(); } if (Engine.Tool.BeginMenu("Edit", true)) { if (Engine.Tool.MenuItem("Undo", "", false, true)) { NodeEditorModel.Undo(); } if (Engine.Tool.MenuItem("Redo", "", false, true)) { NodeEditorModel.Redo(); } Engine.Tool.EndMenu(); } Engine.Tool.Text(Engine.CurrentFPS.ToString()); Engine.Tool.EndMainMenuBar(); } MenuHeight = Engine.Tool.GetFrameHeight(); }
public void SaveLoad() { NodeEditorHost.Initialize("SaveLoad", 1500, 800, new Configuration() { ConsoleLoggingEnabled = true, IsResizable = true }); var spriteID = NodeEditorModel.AddNode <SpriteNode>(); var textID = NodeEditorModel.AddNode <TextNode>(); var arcID = NodeEditorModel.AddNode <ArcNode>(); var circleID = NodeEditorModel.AddNode <CircleNode>(); var lineID = NodeEditorModel.AddNode <LineNode>(); var rectID = NodeEditorModel.AddNode <RectangleNode>(); var triangleID = NodeEditorModel.AddNode <TriangleNode>(); if (Engine.DoEvents()) { NodeEditorHost.Update(); } var circle = NodeEditorModel.FindInstance(circleID) as CircleNode; NodeEditorModel.StartEditFields(circle); NodeEditorModel.NotifyEditFields(circle); circle.Radius = 100; circle.Position = new Vector2F(500, 500); circle.Color = new Color(255, 0, 100, 255); NodeEditorModel.EndEditFields(circle); while (Engine.DoEvents()) { NodeEditorHost.Update(); } NodeEditorModel.Save("TestData/Editor/SaveLoadTest"); var before = NodeEditorModel.NodeTree; NodeEditorHost.Terminate(); NodeEditorHost.Initialize("SaveLoad", 1500, 800, new Configuration() { ConsoleLoggingEnabled = true, IsResizable = true }); NodeEditorModel.Load("TestData/Editor/SaveLoadTest.nodes"); while (Engine.DoEvents()) { NodeEditorHost.Update(); } var after = NodeEditorModel.NodeTree; NodeEditorHost.Terminate(); Assert.True(PartsTreeSystemTest.Helper.IsValueEqual(before, after)); }