예제 #1
0
 protected virtual void drawBones(com.brashmonkey.spriter.player.SpriterAbstractPlayer
                                  player)
 {
     this.setDrawColor(1, 0, 0, 1);
     for (int i = 0; i < player.getBonesToAnimate(); i++)
     {
         com.brashmonkey.spriter.objects.SpriterBone bone = player.getRuntimeBones()[i];
         float xx = bone.getX() + (float)System.Math.Cos(DegreeToRadian(bone.getAngle
                                                                            ())) * 5;
         float yy = bone.getY() + (float)System.Math.Sin(DegreeToRadian(bone.getAngle
                                                                            ())) * 5;
         float x2 = (float)System.Math.Cos(DegreeToRadian(bone.getAngle() + 90)) *
                    (SpriterCalculator.BONE_WIDTH / 2) * bone.getScaleY();
         float y2 = (float)System.Math.Sin(DegreeToRadian(bone.getAngle() + 90)) *
                    (SpriterCalculator.BONE_WIDTH / 2) * bone.getScaleY();
         float targetX = bone.getX() + (float)System.Math.Cos(DegreeToRadian(bone.getAngle
                                                                                 ())) * SpriterCalculator.BONE_LENGTH * bone.getScaleX();
         float targetY = bone.getY() + (float)System.Math.Sin(DegreeToRadian(bone.getAngle
                                                                                 ())) * SpriterCalculator.BONE_LENGTH * bone.getScaleX();
         float upperPointX = xx + x2;
         float upperPointY = yy + y2;
         this.drawLine(bone.getX(), bone.getY(), upperPointX, upperPointY);
         this.drawLine(upperPointX, upperPointY, targetX, targetY);
         float lowerPointX = xx - x2;
         float lowerPointY = yy - y2;
         this.drawLine(bone.getX(), bone.getY(), lowerPointX, lowerPointY);
         this.drawLine(lowerPointX, lowerPointY, targetX, targetY);
         this.drawLine(bone.getX(), bone.getY(), targetX, targetY);
     }
 }
예제 #2
0
 /// <summary>Draws the given player with its sprites.</summary>
 /// <remarks>Draws the given player with its sprites.</remarks>
 /// <param name="player">Player to draw.</param>
 public virtual void draw(com.brashmonkey.spriter.player.SpriterAbstractPlayer player
                          )
 {
     com.brashmonkey.spriter.draw.DrawInstruction[] instructions = player.getDrawInstructions
                                                                       ();
     for (int i = 0; i < player.getObjectsToDraw(); i++)
     {
         if (instructions[i].obj.isVisible())
         {
             this.draw(instructions[i]);
         }
         foreach (com.brashmonkey.spriter.player.SpriterAbstractPlayer pl in player.getAttachedPlayers
                      ())
         {
             if (player.getZIndex() == i)
             {
                 draw(pl);
                 pl.drawn = true;
             }
         }
     }
     foreach (com.brashmonkey.spriter.player.SpriterAbstractPlayer pl_1 in player.getAttachedPlayers
                  ())
     {
         if (!player.drawn)
         {
             draw(pl_1);
         }
         player.drawn = false;
     }
 }
 /// <summary>Returns an instance of this class, which will manage the interpolation between two #SpriterAbstractPlayer instances.
 ///     </summary>
 /// <remarks>Returns an instance of this class, which will manage the interpolation between two #SpriterAbstractPlayer instances.
 ///     </remarks>
 /// <param name="first">player to interpolate with the second one.</param>
 /// <param name="second">player to interpolate with the first one.</param>
 public SpriterPlayerInterpolator(com.brashmonkey.spriter.player.SpriterAbstractPlayer
                                  first, com.brashmonkey.spriter.player.SpriterAbstractPlayer second) : base(first
                                                                                                             .loader, first.animations)
 {
     this.weight = 0.5f;
     setPlayers(first, second);
     this.generateData();
     this.update(0, 0);
 }
 /// <summary>Note: Make sure, that both instances hold the same bone and object structure.
 ///     </summary>
 /// <remarks>
 /// Note: Make sure, that both instances hold the same bone and object structure.
 /// Otherwise you will not get the interpolation you wish.
 /// </remarks>
 /// <param name="first">SpriterPlayer instance to interpolate.</param>
 /// <param name="second">SpriterPlayer instance to interpolate.</param>
 public virtual void setPlayers(com.brashmonkey.spriter.player.SpriterAbstractPlayer
                                first, com.brashmonkey.spriter.player.SpriterAbstractPlayer second)
 {
     this.first         = first;
     this.second        = second;
     this.moddedBones   = this.first.moddedBones;
     this.moddedObjects = this.first.moddedObjects;
     this.first.setRootParent(this.rootParent);
     this.second.setRootParent(this.rootParent);
 }
예제 #5
0
 /// <summary>
 /// Draws the playing animation in <code>player</code> with all bones (if
 /// <see cref="AbstractDrawer{L}.drawBone">AbstractDrawer&lt;L&gt;.drawBones</see>
 /// is true) and bounding boxes (if
 /// <see cref="AbstractDrawer{L}.drawBox">AbstractDrawer&lt;L&gt;.drawBoxes</see>
 /// is true) but without the corresponding sprites.
 /// </summary>
 /// <param name="player">
 ///
 /// <see>[com.brashmonkey.spriter.player.]SpriterAbstractPlayer AbstractPlayer</see>
 /// to draw
 /// </param>
 public virtual void debugDraw(com.brashmonkey.spriter.player.SpriterAbstractPlayer
                               player)
 {
     if (drawBox)
     {
         this.drawBoxes(player);
     }
     if (drawBone)
     {
         this.drawBones(player);
     }
 }
예제 #6
0
 protected virtual void drawBoxes(com.brashmonkey.spriter.player.SpriterAbstractPlayer
                                  player)
 {
     this.setDrawColor(0f, .25f, 1f, 1f);
     this.drawRectangle(player.getBoundingBox().left, player.getBoundingBox().bottom,
                        player.getBoundingBox().width, player.getBoundingBox().height);
     for (int j = 0; j < player.getObjectsToDraw(); j++)
     {
         com.brashmonkey.spriter.SpriterPoint[] points = player.getRuntimeObjects()[j].getBoundingBox
                                                             ();
         this.drawLine(points[0].x, points[0].y, points[1].x, points[1].y);
         this.drawLine(points[1].x, points[1].y, points[3].x, points[3].y);
         this.drawLine(points[3].x, points[3].y, points[2].x, points[2].y);
         this.drawLine(points[2].x, points[2].y, points[0].x, points[0].y);
     }
 }
예제 #7
0
 public virtual void setTarget(com.brashmonkey.spriter.player.SpriterAbstractPlayer
                               player)
 {
     this.player = player;
 }
예제 #8
0
 public SpriterCCDResolver(com.brashmonkey.spriter.player.SpriterAbstractPlayer target
                           )
 {
     this.player = target;
     this.temp   = new com.brashmonkey.spriter.objects.SpriterBone();
 }
예제 #9
0
        public virtual void setTarget(com.brashmonkey.spriter.player.SpriterAbstractPlayer
			 player)
        {
            this.player = player;
        }
예제 #10
0
        public SpriterCCDResolver(com.brashmonkey.spriter.player.SpriterAbstractPlayer target
			)
        {
            this.player = target;
            this.temp = new com.brashmonkey.spriter.objects.SpriterBone();
        }
        /// <summary>Note: Make sure, that both instances hold the same bone and object structure.
        /// 	</summary>
        /// <remarks>
        /// Note: Make sure, that both instances hold the same bone and object structure.
        /// Otherwise you will not get the interpolation you wish.
        /// </remarks>
        /// <param name="first">SpriterPlayer instance to interpolate.</param>
        /// <param name="second">SpriterPlayer instance to interpolate.</param>
        public virtual void setPlayers(com.brashmonkey.spriter.player.SpriterAbstractPlayer
			 first, com.brashmonkey.spriter.player.SpriterAbstractPlayer second)
        {
            this.first = first;
            this.second = second;
            this.moddedBones = this.first.moddedBones;
            this.moddedObjects = this.first.moddedObjects;
            this.first.setRootParent(this.rootParent);
            this.second.setRootParent(this.rootParent);
        }