Changed debug GUI for gears to support any MechanicalNode

This commit is contained in:
Robert S 2014-06-10 10:42:56 -04:00
parent 51cb0119e0
commit 1773bc4b2d
3 changed files with 8 additions and 9 deletions

View file

@ -83,7 +83,7 @@ public abstract class PartMechanical extends JCuboidPart implements JNormalOcclu
//Opens a debug GUI //Opens a debug GUI
if (frame == null) if (frame == null)
{ {
frame = new GearDebugFrame(this); frame = new GearDebugFrame(this.node);
frame.showDebugFrame(); frame.showDebugFrame();
} //Closes the debug GUI } //Closes the debug GUI
else else

View file

@ -28,9 +28,9 @@ public class GearDebugFrame extends Frame implements ActionListener
Label[] connections = new Label[20]; Label[] connections = new Label[20];
long tick = 0; long tick = 0;
PartMechanical part = null; MechanicalNode part = null;
public GearDebugFrame(PartMechanical part) public GearDebugFrame(MechanicalNode part)
{ {
this.part = part; this.part = part;
setLayout(new BorderLayout()); setLayout(new BorderLayout());
@ -93,7 +93,7 @@ public class GearDebugFrame extends Frame implements ActionListener
@Override @Override
public String buildLabel() public String buildLabel()
{ {
return super.buildLabel() + GearDebugFrame.this.part.node.angularVelocity; return super.buildLabel() + GearDebugFrame.this.part.angularVelocity;
} }
}; };
dataLabels.add(velLabel); dataLabels.add(velLabel);
@ -104,7 +104,7 @@ public class GearDebugFrame extends Frame implements ActionListener
@Override @Override
public String buildLabel() public String buildLabel()
{ {
return super.buildLabel() + GearDebugFrame.this.part.node.renderAngle; return super.buildLabel() + GearDebugFrame.this.part.renderAngle;
} }
}; };
dataLabels.add(angleLabel); dataLabels.add(angleLabel);
@ -115,7 +115,7 @@ public class GearDebugFrame extends Frame implements ActionListener
@Override @Override
public String buildLabel() public String buildLabel()
{ {
return super.buildLabel() + GearDebugFrame.this.part.node.torque; return super.buildLabel() + GearDebugFrame.this.part.torque;
} }
}; };
dataLabels.add(torqueLabel); dataLabels.add(torqueLabel);
@ -154,7 +154,7 @@ public class GearDebugFrame extends Frame implements ActionListener
label.update(); label.update();
} }
int c = 0; int c = 0;
for (Entry<MechanicalNode, ForgeDirection> entry : part.node.getConnections().entrySet()) for (Entry<MechanicalNode, ForgeDirection> entry : part.getConnections().entrySet())
{ {
if (entry.getKey() != null) if (entry.getKey() != null)
{ {

View file

@ -16,8 +16,7 @@ public interface IMechanicalNode extends INode
public double getAngularSpeed(); public double getAngularSpeed();
/** Applies rotational force and velocity to the mechanical object */ /** Applies rotational force and velocity to the mechanical object */
public void apply(Object source, double torque, double angularVelocity); public void apply(Object source, double torque, double angularVelocity);
/** The Rotational force */ /** The Rotational force */