Exemplo n.º 1
0
        protected void DrawTileSelection(int tileX, int tileY)
        {
            Color   fillColor = new Color(80, 100, 150, 150);
            Vector2 pos       = new Vector2(tileX * TileGrid.TileSize.X * TileGrid.Scale.X,
                                            tileY * TileGrid.TileSize.Y * TileGrid.Scale.Y);
            Vector2 size = new Vector2(TileGrid.TileSize.X * TileGrid.Scale.X,
                                       TileGrid.TileSize.Y * TileGrid.Scale.Y);

            DrawingManager.DrawFilledRectangle(TileGrid.Layer, pos, size,
                                               fillColor, TileGrid.BlendingType);
            DebugShapes.DrawRectangle(new Rectangle((int)(pos.X + 1), (int)(pos.Y + 1), (int)size.X - 2, (int)size.Y - 2),
                                      Color.Aquamarine);
        }
Exemplo n.º 2
0
        protected void DrawBoneSceneItemBoundingRect(String boneTransformRef, Color color)
        {
            CompositeBoneTransform boneTransform
                = ParentEditor.SelectedCompositeKeyFrame.GetBoneTransformFromKeyFrame(
                      ParentEditor.SelectedCompositeKeyFrame, boneTransformRef);
            SceneItem boneTransformSceneItem = boneTransform.GetSceneItem();

            if (boneTransform.IsVisible == true &&
                boneTransformSceneItem != null)
            {
                Rectangle boundingRect = boneTransformSceneItem.BoundingRect;
                DebugShapes.DrawRectangle(boundingRect, color);
            }
        }
Exemplo n.º 3
0
 protected override void Draw()
 {
     Update(1f / 60f);
     if (CurrentScene != null)
     {
         DrawingManager.ViewPortSize = new Microsoft.Xna.Framework.Point(this.Width, this.Height);
         SquidCore.DrawSquidEngineScene(GraphicsDevice, 0.16f, SceneManager.ActiveScene);
         if (_highlightedItem != null)
         {
             Microsoft.Xna.Framework.Rectangle re = _highlightedItem.BoundingRect;
             if (_highlightedItem.IgnoreCameraPosition)
             {
                 Vector2 offset = CurrentScene.ActiveCameras[0].Position;
                 //offset *= -1;
                 re.Offset((int)offset.X, (int)offset.Y);
             }
             DebugShapes.DrawRectangle(re, Color.Yellow);
         }
         foreach (SceneItem item in _selectedItems)
         {
             Microsoft.Xna.Framework.Rectangle re = item.BoundingRect;
             if (item.IgnoreCameraPosition)
             {
                 Vector2 offset = CurrentScene.ActiveCameras[0].Position;
                 //offset *= -1;
                 re.Offset((int)offset.X, (int)offset.Y);
             }
             DebugShapes.DrawRectangle(re, Color.White);
         }
         if (PreviewedItem != null)
         {
             Vector2 oldPosition = PreviewedItem.Position;
             Vector2 oldPivot    = PreviewedItem.Pivot;
             int     oldLayer    = PreviewedItem.Layer;
             PreviewedItem.Position = Vector2.Zero;
             PreviewedItem.Layer    = 1;
             PreviewedItem.Pivot    = new Vector2(PreviewedItem.BoundingRect.Width / 2f, PreviewedItem.BoundingRect.Height / 2f);
             PreviewedItem.Update(1f / 60f);
             PreviewedItem.Draw(1f / 60f);
             PreviewedItem.Position = oldPosition;
             PreviewedItem.Layer    = oldLayer;
             PreviewedItem.Pivot    = oldPivot;
         }
         if (Preferences.ShowCameraBounds == true)
         {
             Point size     = SceneManager.GlobalDataHolder.NativeResolution;
             Point safeSize = Point.Zero;
             safeSize.X = (int)(size.X * 0.8f);
             safeSize.Y = (int)(size.Y * 0.8f);
             SquidEngine.Drawing.DebugShapes.DrawRectangle(
                 new Microsoft.Xna.Framework.Rectangle(-size.X / 2, -size.Y / 2, size.X, size.Y),
                 new Color(255, 0, 255, 200));
             SquidEngine.Drawing.DebugShapes.DrawRectangle(
                 new Microsoft.Xna.Framework.Rectangle(-safeSize.X / 2, -safeSize.Y / 2, safeSize.X, safeSize.Y),
                 new Color(255, 255, 255, 100));
         }
         if (Preferences.ShowGrid == true)
         {
             Point gridSize = Preferences.GridSizes[Preferences.SelectedGrid - 1];
             Microsoft.Xna.Framework.Rectangle screenBounds = SceneManager.ActiveScene.ActiveCameras[0].BoundingRect;
             Point start = new Point((int)Math.Floor((double)screenBounds.X / (double)gridSize.X),
                                     (int)Math.Floor((double)screenBounds.Y / (double)gridSize.X));
             Point end = new Point(1 + (int)Math.Floor((double)screenBounds.Right / (double)gridSize.X),
                                   1 + (int)Math.Floor((double)screenBounds.Bottom / (double)gridSize.Y));
             for (int x = start.X; x <= end.X; x++)
             {
                 SquidEngine.Drawing.DebugShapes.DrawLine(new Vector2(x * gridSize.X, start.Y * gridSize.Y),
                                                          new Vector2(x * gridSize.X, end.Y * gridSize.Y), (x == 0) ? Color.Black : Preferences.GridColor);
             }
             for (int y = start.Y; y <= end.Y; y++)
             {
                 SquidEngine.Drawing.DebugShapes.DrawLine(new Vector2(start.X * gridSize.X, y * gridSize.Y),
                                                          new Vector2(end.X * gridSize.X, y * gridSize.Y), (y == 0) ? Color.Black : Preferences.GridColor);
             }
         }
         SquidCore.RenderSquidEngine();
     }
 }