/// <summary> /// Draws the control. /// </summary> protected override void Draw() { ParentEditor.ZoomBox.Camera.Update(1 / 60f); if (particleEffect.Position != updatedPosition) { particleEffect.Position = updatedPosition; } particleEffect.Update(1 / 60f); _parent = Parent as ParticleEffectEditor; // if the animation was paused externally, pause it in the GUI if (particleEffect.Emitter.IsPaused == true && _parent.toolStripButtonPause.Enabled == true) { _parent.toolStripButtonPause_Click(null, EventArgs.Empty); } // if the animation was stopped externally, stop it in the GUI if (particleEffect.Emitter.IsStopped == true && _parent.toolStripButtonStop.Enabled == true) { _parent.toolStripButtonStop_Click(null, EventArgs.Empty); } if (background != null) { DrawRequest backgroundRequest = new DrawRequest(background, Vector2.Zero, false, null, 0, Vector2.One, new Vector2(0.5f), true, Color.White, false, false, null); DrawingManager.DrawOnLayer(backgroundRequest, 10, DrawingBlendingType.Alpha); } particleEffect.Draw(1f); GraphicsDevice.Clear(backgroundColor); DrawingManager.ViewPortSize = new Point(this.Width, this.Height); MilkshakeForm.SwapCameraAndRenderScene(ParentEditor.ZoomBox.Camera); ParentEditor.Update(1 / 60f); }
public bool OpenSceneItemInEditor(SceneItem item, bool isSceneInstance) { SceneItemType itemType = GetTypeOfSceneItem(item); SceneItemEditor editor = null; switch (itemType) { case SceneItemType.TileGrid: editor = new TileGridEditor(); break; case SceneItemType.ParticleEffect: editor = new ParticleEffectEditor(); break; case SceneItemType.AnimatedSprite: editor = new AnimatedSpriteEditor(); break; case SceneItemType.Sprite: editor = new SpriteEditor(); break; case SceneItemType.PostProcessingAnimation: editor = new PostProcessAnimationEditor(); break; case SceneItemType.CompositeEntity: editor = new CompositeEntityEditor(); break; default: editor = null; break; } if (editor != null) { editor.SceneItem = item; editor.ItemIsLocal = isSceneInstance; editor.StartPosition = FormStartPosition.CenterParent; if (editor.ShowDialog(this) == DialogResult.OK) { if (SceneManager.GlobalDataHolder.TemplateItems.Contains(item)) { this.SceneWasModified = true; } else { this.SceneWasModified = true; } } } return false; }
/// <summary> /// Draws the control. /// </summary> protected override void Draw() { ParentEditor.ZoomBox.Camera.Update(1 / 60f); if (particleEffect.Position != updatedPosition) { particleEffect.Position = updatedPosition; } particleEffect.Update(1 / 60f); _parent = Parent as ParticleEffectEditor; // if the animation was paused externally, pause it in the GUI if (particleEffect.Emitter.IsPaused == true && _parent.toolStripButtonPause.Enabled == true) { _parent.toolStripButtonPause_Click(null, EventArgs.Empty); } // if the animation was stopped externally, stop it in the GUI if (particleEffect.Emitter.IsStopped == true && _parent.toolStripButtonStop.Enabled == true) { _parent.toolStripButtonStop_Click(null, EventArgs.Empty); } if (background != null) { DrawRequest backgroundRequest = new DrawRequest(background, Vector2.Zero, false, null, 0, Vector2.One, new Vector2(0.5f), true, Color.White, false, false, null); DrawingManager.DrawOnLayer(backgroundRequest, 10, DrawingBlendingType.Alpha); } particleEffect.Draw(1f); GraphicsDevice.Clear(backgroundColor); DrawingManager.ViewPortSize = new Point(this.Width, this.Height); MilkshakeForm.SwapCameraAndRenderScene(ParentEditor.ZoomBox.Camera); ParentEditor.Update(1 / 60f); }