public CursorController(FractalWindow mainWindow, GuiElement[] buttons) { ButtonsActive = new bool[buttons.Length]; AllButtons = buttons; MainWindow = mainWindow; MainWindow = mainWindow; CursorElement = new EmptyComponent(new RectangleF(0, 0, CursorSize, CursorSize)); mainWindow.ChildElements.Add(CursorElement); MainWindow.MouseDownEvent += MainWindowClick; for (int i = 0; i < AllButtons.Length; i++) { AllButtons[i].Enabled = false; mainWindow.ChildElements.Add(AllButtons[i]); AllButtons[i].FrameColor = Color.Red; AllButtons[i].MouseDownEvent += ButtonClick; } CursorElement.Enabled = false; CursorElement.DrawFrame = false; CursorElement.DragEvent += CursorDragged; CursorElement.LateDraw += CursorLateDraw; ExtendTimer.FinishedEvent += ExtendTimerFinish; ExtendTimer.Tick += ExtendTimerTick; TeleportTimer.FinishedEvent += TeleportTimerFinish; TeleportTimer.Tick += TeleportTimerTick; CursorElement.MouseDownEvent += CursorClick; MainWindow.Controller.FinishEvent += MainComputed; }
public void ReadXml(XmlReader reader) { name = reader["Name"]; components = new List <IFactoryComponent>(); owner = World.Instance.FactionList.GetFaction(reader["Owner"]); owner.AddFactoryEntity(this); //owner = Convert.ToInt32(reader["Z"]); reader.MoveToContent(); if (reader.ReadToDescendant(typeof(IFactoryComponent).Name)) { while (reader.MoveToContent() == XmlNodeType.Element && reader.LocalName == typeof(IFactoryComponent).Name) { var component = new EmptyComponent(); component.ReadXml(reader); components.Add(component.ActualComponent); } } foreach (var component in components) { component.Parent = this; } reader.Read(); }
static void Main(string[] args) { // Args: ("VCNNodes"FolderPath) Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", false); if (args.Length < 2) { Console.WriteLine("You need to specify the path of the \"VCNNodes\" folder as first argument."); Console.ReadLine(); return; } // Do not remove. This will force a load of the custom components in the current assembly EmptyComponent ec = new EmptyComponent(); string vCNNodesFolderPath = args[0]; string vCNVSProjectsPath = args[1]; List<Type> componentTypes = VCNNodesCSharp.VCNNodesCSharpHelper.GetListOfComponents(); List<string> exportedFiles = new List<string>(); XElement vcsprojDoc = null; try { vcsprojDoc = XElement.Load(vCNVSProjectsPath + Path.DirectorySeparatorChar + "VCNNodes.vcxproj"); } catch (System.Exception) {} XElement vcsprojFiltersDoc = null; try { vcsprojFiltersDoc = XElement.Load(vCNVSProjectsPath + Path.DirectorySeparatorChar + "VCNNodes.vcxproj.filters"); } catch (System.Exception) {} if (vcsprojDoc == null || vcsprojFiltersDoc == null) { Console.WriteLine("Could not open vcxproj or the vcxproj.filters file for edit. You may have to add the new components manually to the VCNNodes project."); } foreach (Type componentType in componentTypes) { string componentName = componentType.Name; if (BuildHFile(componentType, vCNNodesFolderPath)) { exportedFiles.Add(componentName + ".h"); Console.WriteLine(".hp file created/updated for component " + componentName); } else { Console.WriteLine("Could not create .h file for class " + componentName); } if (BuildCPPFile(componentType, vCNNodesFolderPath)) { exportedFiles.Add(componentName + ".cpp"); Console.WriteLine(".cpp file created/updated for component " + componentName); } else { Console.WriteLine("Could not create .cpp file for class " + componentName); } if (vcsprojDoc != null && vcsprojFiltersDoc != null) { bool vcxprojNeedsSave = false; bool vcxprojFilterNeedsSave = false; vcxprojNeedsSave |= UpdateVSProjectXml(ref vcsprojDoc, componentName, "ClCompile", "Include", "cpp"); vcxprojNeedsSave |= UpdateVSProjectXml(ref vcsprojDoc, componentName, "ClInclude", "Include", "h"); vcxprojFilterNeedsSave |= UpdateVSProjectXml(ref vcsprojFiltersDoc, componentName, "ClCompile", "Include", "cpp"); vcxprojFilterNeedsSave |= UpdateVSProjectXml(ref vcsprojFiltersDoc, componentName, "ClInclude", "Include", "h"); if (vcxprojNeedsSave) { vcsprojDoc.Save(vCNVSProjectsPath + Path.DirectorySeparatorChar + "VCNNodes.vcxproj"); } if (vcxprojFilterNeedsSave) { vcsprojFiltersDoc.Save(vCNVSProjectsPath + Path.DirectorySeparatorChar + "VCNNodes.vcxproj.filters"); } } Console.WriteLine(""); } if (GenerateComponentFactory(vCNNodesFolderPath, componentTypes)) { Console.WriteLine("Component Factory created."); } else { Console.WriteLine("Could not create component factory"); } Console.WriteLine("Adding files to svn"); try { Process proc = new Process(); proc.StartInfo.WorkingDirectory = "C:\\Program Files\\TortoiseSVN\\bin"; proc.StartInfo.FileName = "C:\\Program Files\\TortoiseSVN\\bin\\TortoiseProc.exe"; StringBuilder sb = new StringBuilder(); sb.Append("/command:add /path:\""); for (int i = 0; i < exportedFiles.Count; i++ ) { string filename = exportedFiles[i]; sb.Append(vCNNodesFolderPath + Path.DirectorySeparatorChar + filename); if (i != exportedFiles.Count- 1 ) { sb.Append("*"); } } sb.Append("\" /closeonend:0"); proc.StartInfo.Arguments = sb.ToString(); proc.StartInfo.UseShellExecute = false; proc.StartInfo.RedirectStandardError = false; proc.Start(); proc.WaitForExit(); proc.Close(); } catch (Exception) { } Console.WriteLine("\nOperation completed"); Console.WriteLine("Press enter to exit"); Console.ReadLine(); }
public MainCursorSystem(FractalWindow mainWindow) { MainWindow = mainWindow; float size = CursorController.ButtonSize; JuliaWindow = new FractalWindow(new RectangleF(MainWindow.Rect.Width - JuliaWindowSize - 20, 20, JuliaWindowSize, JuliaWindowSize)); //AllButtons[0] = PinButton = new EmptyComponent(new RectangleF(0, 0, ButtonSize, ButtonSize)); JuliaButton = new FractalWindow(new RectangleF(0, 0, size, size)); OrbitButton = new FractalWindow(new RectangleF(0, 0, size, size)); SoundButton = new EmptyComponent(new RectangleF(0, 0, size, size)); mainController = new CursorController(mainWindow, new GuiElement[] { OrbitButton, SoundButton, JuliaButton }); JuliaPeriodButton = new FractalWindow(new RectangleF(0, 0, size, size)); JuliaOrbitButton = new FractalWindow(new RectangleF(0, 0, size, size)); JuliaOffsetButton = new EmptyComponent(new RectangleF(0, 0, size, size)); juliaController = new CursorController(JuliaWindow, new GuiElement[] { JuliaOrbitButton, JuliaPeriodButton, JuliaOffsetButton } ); SoundButton.LateDraw += SoundButtonLateDraw; SoundButton.MouseDownEvent += SoundButtonClick; mainController.MenuUpdatedEvent += MenuUpdated; mainController.PositionEvent += CursorChanged; juliaController.MenuUpdatedEvent += JuliaMenuUpdated; juliaController.PositionEvent += JuliaCursorChanged; //AllButtons[3] = OrbitButton = new FractalWindow(new RectangleF(0, 0, ButtonSize, ButtonSize)); JuliaButton.Controller.Iterations = 1000; JuliaButton.Controller.Zoom = 0.14; JuliaButton.Controller.ColorScale = 2; JuliaButton.Controller.ColorOffset = 0.9f; JuliaButton.Controller.Julia = true; JuliaButton.Controller.JuliaPos = new Complex(-0.16037822, -1.0375242); JuliaButton.EnableInteraction = false; OrbitButton.Controller.CameraPos = new Complex(-0.0978, -0.747457); OrbitButton.Controller.Zoom = 0.15; OrbitButton.Controller.PeriodHighlight = 5; OrbitButton.OrbitActive = true; OrbitButton.OrbitPosition = new Complex(-0.03137, -0.79095); OrbitButton.OrbitScale = 0.5f; OrbitButton.StrippleScale = 1; OrbitButton.EnableInteraction = false; JuliaOrbitButton.EnableInteraction = false; JuliaOrbitButton.Controller.Zoom = 1.0; JuliaOrbitButton.OrbitActive = true; JuliaOrbitButton.Controller.CameraPos = new Complex(-0.3, -0.3); JuliaOrbitButton.Controller.JuliaPos = new Complex(-0.504455304069502, -0.562767203932328); JuliaOrbitButton.Controller.Julia = true; JuliaOrbitButton.OrbitScale = 0.5f; JuliaOrbitButton.StrippleScale = 1; JuliaOrbitButton.Controller.CenterDotStrength = 0; JuliaPeriodButton.EnableInteraction = false; JuliaPeriodButton.Controller.JuliaPos = new Complex(-0.153974876797236, -1.03769787591661); JuliaPeriodButton.Controller.Julia = true; JuliaPeriodButton.Controller.Zoom = 0.117; JuliaPeriodButton.Controller.FinalDotStrength = 0.001f; JuliaPeriodButton.fractalMath.CoefficientArray = JuliaWindow.Controller.CoefficientArray; JuliaPeriodButton.fractalMath.SetCoefficients(JuliaPeriodButton.Controller.JuliaPos); Complex Z = new Complex(0, 0); for (int i = 0; i < JuliaPeriodButton.Controller.Iterations; i++) { Z = JuliaPeriodButton.fractalMath.Compute(Z); } JuliaPeriodButton.Controller.FinalDotPosition = Z; //JuliaWindow = new FractalWindow(new RectangleF(20, 20, JuliaWindowSize, JuliaWindowSize)); JuliaWindow.Controller.Julia = true; JuliaWindow.Enabled = false; JuliaWindow.Controller.QuaternionJulia = false; JuliaSizeBox = new EmptyComponent(new RectangleF(5, JuliaWindowSize - JuliaSizeBoxSize - 5, JuliaSizeBoxSize, JuliaSizeBoxSize)); mainWindow.ChildElements.Add(JuliaWindow); JuliaWindow.ChildElements.Add(JuliaSizeBox); JuliaSizeBox.DragEvent += JuliaSizeBoxDrag; JuliaSizeBox.LateDraw += JuliaResizeLateDraw; JuliaSizeBox.DrawFrame = false; /*Julia3dButton = new FractalWindow(new RectangleF(5, 5, size, size)); * Julia3dButton.Controller.Julia=true; * Julia3dButton.Controller.QuaternionJulia = true; * * Julia3dCutoffButton = new FractalWindow(new RectangleF(10 + size, 5, size, size)); * Julia3dCutoffButton.Controller.Julia = true; * Julia3dCutoffButton.Controller.QuaternionJulia = true; * Julia3dCutoffButton.Controller.QuaternionJuliaCutoff = false; * Julia3dCutoffButton.Enabled = false; * JuliaWindow.ChildElements.Add(Julia3dButton); * JuliaWindow.ChildElements.Add(Julia3dCutoffButton); * Julia3dButton.ClickEvent += Julia3dClick; * Julia3dCutoffButton.ClickEvent += JuliaCutoffClick;*/ //CursorWorldPosition = new Complex(-Math.PI/4, -0.15); //CursorPosition = MainWindow.GetScreenFromWorld(CursorWorldPosition); //CursorActive = true; //CursorElement.Enabled = true; OrbitButton.MouseDownEvent += OrbitClick; JuliaButton.MouseDownEvent += JuliaClick; JuliaOrbitButton.MouseDownEvent += JuliaOrbitClick; JuliaPeriodButton.MouseDownEvent += JuliaPeriodClick; JuliaOffsetButton.MouseDownEvent += JuliaOffsetClick; }