diff --git a/src/main/scala/resonantinduction/core/debug/FrameDebug.java b/src/main/scala/resonantinduction/core/debug/FrameDebug.java new file mode 100644 index 000000000..1f5b2b3c3 --- /dev/null +++ b/src/main/scala/resonantinduction/core/debug/FrameDebug.java @@ -0,0 +1,92 @@ +package resonantinduction.core.debug; + +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Frame; +import java.awt.Panel; + +import net.minecraft.tileentity.TileEntity; +import resonant.api.grid.INode; + +@SuppressWarnings("serial") +public class FrameDebug extends Frame +{ + /** Linked tile */ + TileEntity tile = null; + /** Linked node */ + INode node = null; + /** Are we debugging a node */ + boolean debugNode = false; + + public FrameDebug(TileEntity tile) + { + this(); + this.tile = tile; + } + + public FrameDebug(INode node) + { + this(); + this.node = node; + } + + protected FrameDebug() + { + buildGUI(); + } + + /** Called to build the base of the GUI */ + protected void buildGUI() + { + UpdatePanel topPanel = new UpdatePanel(); + UpdatePanel botPanel = new UpdatePanel(); + UpdatePanel leftPanel = new UpdatePanel(); + UpdatePanel rightPanel = new UpdatePanel(); + + buildTop(topPanel); + buildBottom(botPanel); + buildLeft(leftPanel); + buildRight(rightPanel); + + this.add(topPanel, BorderLayout.NORTH); + this.add(botPanel, BorderLayout.SOUTH); + this.add(rightPanel, BorderLayout.EAST); + this.add(leftPanel, BorderLayout.WEST); + } + + /** Top are of the Frame */ + public void buildTop(Panel panel) + { + + } + + /** Bottom are of the Frame */ + public void buildBottom(Panel panel) + { + + } + + /** Left are of the Frame */ + public void buildLeft(Panel panel) + { + + } + + /** Right are of the Frame */ + public void buildRight(Panel panel) + { + + } + + /** Called each tick by the host of this GUI */ + public void update() + { + for(Component component : getComponents()) + { + if(component instanceof IUpdate) + { + ((IUpdate)component).update(); + } + } + } +} diff --git a/src/main/scala/resonantinduction/core/debug/IDebug.java b/src/main/scala/resonantinduction/core/debug/IDebug.java new file mode 100644 index 000000000..839d85b0a --- /dev/null +++ b/src/main/scala/resonantinduction/core/debug/IDebug.java @@ -0,0 +1,9 @@ +package resonantinduction.core.debug; + +/** Used to pass info to the debug GUI + * + * @author Darkguardsman */ +public interface IDebug +{ + +} diff --git a/src/main/scala/resonantinduction/core/debug/IUpdate.java b/src/main/scala/resonantinduction/core/debug/IUpdate.java new file mode 100644 index 000000000..389f6246a --- /dev/null +++ b/src/main/scala/resonantinduction/core/debug/IUpdate.java @@ -0,0 +1,9 @@ +package resonantinduction.core.debug; + +/** Used by objects can update each tick + * + * @author Darkguardsman */ +public interface IUpdate +{ + public void update(); +} diff --git a/src/main/scala/resonantinduction/core/debug/UpdatePanel.java b/src/main/scala/resonantinduction/core/debug/UpdatePanel.java new file mode 100644 index 000000000..206d4eba2 --- /dev/null +++ b/src/main/scala/resonantinduction/core/debug/UpdatePanel.java @@ -0,0 +1,20 @@ +package resonantinduction.core.debug; + +import java.awt.Component; +import java.awt.Panel; + +@SuppressWarnings("serial") +public class UpdatePanel extends Panel implements IUpdate +{ + @Override + public void update() + { + for(Component component : getComponents()) + { + if(component instanceof IUpdate) + { + ((IUpdate)component).update(); + } + } + } +} diff --git a/src/main/scala/resonantinduction/core/debug/UpdatedLabel.java b/src/main/scala/resonantinduction/core/debug/UpdatedLabel.java new file mode 100644 index 000000000..788bbd2ac --- /dev/null +++ b/src/main/scala/resonantinduction/core/debug/UpdatedLabel.java @@ -0,0 +1,30 @@ +package resonantinduction.core.debug; + +import java.awt.Label; + +/** Simple label with an update method + * + * @author Darkguardsman */ +@SuppressWarnings("serial") +public class UpdatedLabel extends Label implements IUpdate +{ + String start_string = "I Am a Label"; + + public UpdatedLabel(String start) + { + super(start); + this.start_string = start; + } + + @Override + public void update() + { + this.setText(buildLabel()); + } + + /** Recreates then returns the label's string value */ + public String buildLabel() + { + return start_string; + } +}