protected void DrawTiles() { if (_highlightedTile > -1) { Point pos = GetPosOfTile(_highlightedTile); int halfPadding = _padding / 2; pos.X -= halfPadding - this.AutoScrollPosition.X; pos.Y -= halfPadding - this.AutoScrollPosition.Y; DrawingManager.DrawFilledRectangle(ParentGrid.Layer, new Vector2(pos.X, pos.Y), new Vector2(ParentGrid.TileSize.X + _padding, ParentGrid.TileSize.Y + _padding), Color.DarkGray, ParentGrid.BlendingType); } if (TileGridEditor.Instance.SelectedBrushTile > -1) { Point pos = GetPosOfTile(TileGridEditor.Instance.SelectedBrushTile); int halfPadding = _padding / 2; pos.X -= halfPadding - this.AutoScrollPosition.X; pos.Y -= halfPadding - this.AutoScrollPosition.Y; DrawingManager.DrawFilledRectangle(ParentGrid.Layer, new Vector2(pos.X, pos.Y), new Vector2(ParentGrid.TileSize.X + _padding, ParentGrid.TileSize.Y + _padding), Color.White, ParentGrid.BlendingType); } for (int i = 0; i < _rowsCountOnTexture * ParentGrid.ColumnsCountOnTexture; i++) { DrawRequest drawRequest = default(DrawRequest); drawRequest.scaleRatio = Vector2.One; drawRequest.tint = Color.White; drawRequest.texture = ParentGrid.Material.Texture; Point pos = GetPosOfTile(i); drawRequest.position.X = pos.X + this.AutoScrollPosition.X; drawRequest.position.Y = pos.Y + this.AutoScrollPosition.Y; drawRequest.sourceRectangle = ParentGrid.GetSourceRectOfTile(i); DrawingManager.DrawOnLayer(drawRequest, 1, DrawingBlendingType.Alpha); } }
public void Draw(int layer, DrawingBlendingType blendingType) { if (_isActive) { DrawingManager.DrawOnLayer(_drawRequest, layer, blendingType); } }
public void Draw(float elapsed) { if (this.Parent.Material == null) { return; } DrawRequest _drawRequest = new DrawRequest(); _drawRequest.texture = this.Parent.Material.Texture; _drawRequest.position = this.Parent.Position; _drawRequest.rotation = this.Parent.Rotation; _drawRequest.scaleRatio = this.Parent.Scale; if (this.AnimationFrames != null && this.AnimationFrames.Count > _currentFrameIndex && this.Parent.Material.Areas.ContainsKey(this.AnimationFrames[_currentFrameIndex].Area)) { _drawRequest.sourceRectangle = this.Parent.Material. Areas[this.AnimationFrames[_currentFrameIndex].Area]; } else { _drawRequest.sourceRectangle = null; } _drawRequest.pivot = this.Parent.Pivot; _drawRequest.isPivotRelative = this.Parent.IsPivotRelative; _drawRequest.tint = this.Parent.Tint; _drawRequest.hFlip = this.Parent.FlipHorizontal; _drawRequest.vFlip = this.Parent.FlipVertical; DrawingManager.DrawOnLayer(_drawRequest, this.Parent.Layer, this.Parent.BlendingType); }
/// <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); SquidEditorForm.SwapCameraAndRenderScene(ParentEditor.ZoomBox.Camera); ParentEditor.Update(1 / 60f); }
/// <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); }
public override void Draw(float elapsed) { if (!this.Visible) { return; } // Draw in reverse order from the list for (int i = TileLayers.Count - 1; i >= 0; i--) { TileLayer layer = TileLayers[i]; if (!layer.Visible) { continue; } for (int y = _visibleTiles.Top; y < _visibleTiles.Bottom; y++) { for (int x = _visibleTiles.Left; x < _visibleTiles.Right; x++) { Tile tile = layer.Tiles[x][y]; if (tile.Index != -1) { Vector2 drawPos = _scaledTilePivot; drawPos.X += (float)x * _scaledTileSize.X; drawPos.Y += (float)y * _scaledTileSize.Y; if (this.Rotation != 0) { drawPos = Vector2.Transform(drawPos, _rotationMatrix); } drawPos -= _scaledPivot; DrawRequest _drawRequest = new DrawRequest(); _drawRequest.texture = this.Material.Texture; _drawRequest.position = this.Position + drawPos; _drawRequest.rotation = tile.Rotation * MathHelper.PiOver2 + this.Rotation; _drawRequest.pivot = _tilePivot; _drawRequest.isPivotRelative = false; _drawRequest.hFlip = tile.HFlip; _drawRequest.vFlip = tile.VFlip; _drawRequest.sourceRectangle = GetSourceRectOfTile(tile.Index); if (tile.Rotation == 1 || tile.Rotation == 3) { _drawRequest.scaleRatio = _rotatedScale; } else { _drawRequest.scaleRatio = Scale; } _drawRequest.tint = this.Tint; DrawingManager.DrawOnLayer(_drawRequest, this.Layer, this.BlendingType); } } } } }
public void DrawSpriteAtPos(Vector2 position, bool hFlip, bool vFlip) { _drawRequest.texture = this.Material.Texture; _drawRequest.position = position; _drawRequest.rotation = this.Rotation; _drawRequest.scaleRatio = this.Scale; _drawRequest.tint = this.Tint; _drawRequest.isPivotRelative = this.IsPivotRelative; _drawRequest.hFlip = hFlip; _drawRequest.vFlip = vFlip; _drawRequest.sourceRectangle = SourceRectangle; DrawingManager.DrawOnLayer(_drawRequest, this.Layer, _blendingType); }
public override void Draw(float elapsed) { if (!this.Visible) { return; } if (this.Shadow == true) { DrawRequest _drawRequestShadow = new DrawRequest(); //_drawRequest.font = this.Material.Texture; _drawRequestShadow.position = this.Position + new Vector2(3, 2); _drawRequestShadow.rotation = this.Rotation; _drawRequestShadow.scaleRatio = this.Scale; Color shadowColor = Color.Black; shadowColor.A = _opacity; _drawRequestShadow.tint = shadowColor; _drawRequestShadow.font = _font.Font; _drawRequestShadow.text = Text; _drawRequestShadow.isFont = true; _drawRequestShadow.textSize = this.BoundingRectSize; _drawRequestShadow.pivot = Pivot; _drawRequestShadow.isPivotRelative = this.IsPivotRelative; DrawingManager.DrawOnLayer(_drawRequestShadow, this.Layer, _blendingType); } //_drawRequest.font = this.Material.Texture; _drawRequest.position = this.Position; _drawRequest.rotation = this.Rotation; _drawRequest.scaleRatio = this.Scale; if (_font == null) { _font = SceneManager.GetEmbeddedFont("DefaultFont"); } _drawRequest.font = _font.Font; _drawRequest.isFont = true; _drawRequest.textSize = this.BoundingRectSize; _drawRequest.text = this.Text; _drawRequest.isPivotRelative = this.IsPivotRelative; _drawRequest.pivot = this.Pivot; DrawingManager.DrawOnLayer(_drawRequest, this.Layer, _blendingType); base.Draw(elapsed); }