protected override void OnLoad(EventArgs e) { base.OnLoad(e); this.MakeCurrent(); this._Renderer = new Renderer(); this._Renderer.Cache = new FileSystemRenderCache(Program.Cache["Render"]); this._Renderer.Initialize(); SystemTypeface.Create = this._Renderer.CreateSystemTypeface; this._Probe = new Probe(); this._InputContext = new InputContext(this._Probe); this._Camera = new Camera(new Point(0.0, 0.0), 1.0); this._Ambience = new OceanAmbience(Random.Default); this._World = new World(this._InputContext, new Theme()); this._MakeView(); Content testcontent = new EditorContent(); this._World.Spawn(testcontent, Point.Origin); }
/// <summary> /// Handles a probe signal change over the node. /// </summary> /// <param name="Offset">The offset of the probe from the top-left corner of the node.</param> public void ProbeSignalChange(World World, Probe Probe, Point Offset, ProbeSignal Signal, bool Value) { // See if the event can be handled by the content of the node if (this._InputContext.ProbeSignalChange(Probe, Signal, Value)) return; // Start dragging if possible if (this._DragState == null && Signal == ProbeSignal.Primary && Value == true) { this._DragState = new DragState { Offset = Offset, Probe = Probe, ReleaseProbe = Probe.Lock() }; } }
/// <summary> /// Independently updates the state of this node. /// </summary> public void Update(World World, double Time) { this._Position += this._Velocity * Time; this._Velocity *= Math.Pow(World.Damping, Time); // Handle dragging DragState dragstate = this._DragState; if (dragstate != null) { Probe dragprobe = dragstate.Probe; if (dragprobe[ProbeSignal.Primary]) { this.Pull(dragstate.Offset, dragprobe.Position, Time); } else { dragstate.ReleaseProbe(); this._DragState = null; } } }
/// <summary> /// Updates the state of the arc and influences the endpoint nodes as needed. /// </summary> public void Update(World World, double Time) { }