/// <summary>
        /// Draws the control.
        /// </summary>
        protected override void Draw()
        {
            GraphicsDevice.Clear(Color.Black);
            if (_background != null)
            {
                float       scaledWidth       = this.Width / (float)_background.Width;
                float       scaledHeight      = this.Height / (float)_background.Height;
                DrawRequest backgroundRequest = new DrawRequest(_background, Vector2.Zero,
                                                                null, 0, new Vector2(scaledWidth, scaledHeight), Vector2.Zero, false, Color.White, false, false, null);
                DrawingManager.DrawOnLayer(backgroundRequest, 10, DrawingBlendingType.Alpha);
            }
            _ppAnim.Update(1 / 60f);
            _parent = Parent as PostProcessAnimationEditor;
            // if the animation was paused externally, pause it in the GUI
            if (_ppAnim.IsPaused == true && _parent.toolStripButtonPause.Enabled == true)
            {
                _parent.toolStripButtonPause_Click(null, EventArgs.Empty);
            }
            // if the animation was stopped externally, stop it in the GUI
            if (_ppAnim.IsStopped == true && _parent.toolStripButtonStop.Enabled == true)
            {
                _parent.toolStripButtonStop_Click(null, EventArgs.Empty);
            }
            int oldLayer = _ppAnim.Layer;

            _ppAnim.Draw(1 / 60f);
            _ppAnim.Layer = oldLayer;
            DrawingManager.ViewPortSize = new Point(this.Width, this.Height);
            MilkshakeForm.SwapCameraAndRenderScene(ParentEditor.ZoomBox.Camera);
            ((PostProcessAnimationEditor)this.Parent).Update(1 / 60f);
        }
Beispiel #2
0
 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()
 {
     GraphicsDevice.Clear(Color.Black);
     if (_background != null)
     {
         float scaledWidth = this.Width / (float)_background.Width;
         float scaledHeight = this.Height / (float)_background.Height;
         DrawRequest backgroundRequest = new DrawRequest(_background, Vector2.Zero,false,
             null, 0, new Vector2(scaledWidth, scaledHeight), Vector2.Zero, false, Color.White, false, false, null);
         DrawingManager.DrawOnLayer(backgroundRequest, 10, DrawingBlendingType.Alpha);
     }
     _ppAnim.Update(1 / 60f);
     _parent = Parent as PostProcessAnimationEditor;
     // if the animation was paused externally, pause it in the GUI
     if (_ppAnim.IsPaused == true && _parent.toolStripButtonPause.Enabled == true)
     {
         _parent.toolStripButtonPause_Click(null, EventArgs.Empty);
     }
     // if the animation was stopped externally, stop it in the GUI
     if (_ppAnim.IsStopped == true && _parent.toolStripButtonStop.Enabled == true)
     {
         _parent.toolStripButtonStop_Click(null, EventArgs.Empty);
     }
     int oldLayer = _ppAnim.Layer;
     _ppAnim.Draw(1 / 60f);
     _ppAnim.Layer = oldLayer;
     DrawingManager.ViewPortSize = new Point(this.Width, this.Height);            
     MilkshakeForm.SwapCameraAndRenderScene(ParentEditor.ZoomBox.Camera);
     ((PostProcessAnimationEditor)this.Parent).Update(1/60f);
 }