Fix bug with Controller Module breaking.
This commit is contained in:
parent
643be89570
commit
56367b6047
BIN
sigIRCv2.jar
BIN
sigIRCv2.jar
Binary file not shown.
@ -14,9 +14,13 @@ import sig.utils.TextUtils;
|
|||||||
public class ClickableButton {
|
public class ClickableButton {
|
||||||
protected int x,y,width,height;
|
protected int x,y,width,height;
|
||||||
protected String label;
|
protected String label;
|
||||||
protected Module module;
|
protected ControllerModule module;
|
||||||
|
|
||||||
public ClickableButton(Rectangle position, String button_label, Module parent_module) {
|
public ClickableButton(Rectangle position, String button_label) {
|
||||||
|
this(position,button_label,null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClickableButton(Rectangle position, String button_label, ControllerModule parent_module) {
|
||||||
this.x = (int)position.getX();
|
this.x = (int)position.getX();
|
||||||
this.y = (int)position.getY();
|
this.y = (int)position.getY();
|
||||||
this.width = (int)position.getWidth();
|
this.width = (int)position.getWidth();
|
||||||
|
@ -17,7 +17,7 @@ public class CopyClickableButton extends ClickableButton{
|
|||||||
|
|
||||||
public void onClickEvent(MouseEvent ev) {
|
public void onClickEvent(MouseEvent ev) {
|
||||||
super.onClickEvent(ev);
|
super.onClickEvent(ev);
|
||||||
if (mouseInsideBounds(ev)) {;
|
if (mouseInsideBounds(ev)) {
|
||||||
module.resetDragPoints();
|
module.resetDragPoints();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
55
src/sig/modules/RabiRace/ClickableButton.java
Normal file
55
src/sig/modules/RabiRace/ClickableButton.java
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
package sig.modules.RabiRace;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Graphics;
|
||||||
|
import java.awt.Rectangle;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
|
|
||||||
|
import sig.Module;
|
||||||
|
import sig.sigIRC;
|
||||||
|
import sig.modules.ControllerModule;
|
||||||
|
import sig.modules.RabiRaceModule;
|
||||||
|
import sig.utils.DrawUtils;
|
||||||
|
import sig.utils.TextUtils;
|
||||||
|
|
||||||
|
public class ClickableButton {
|
||||||
|
protected int x,y,width,height;
|
||||||
|
protected String label;
|
||||||
|
protected RabiRaceModule module;
|
||||||
|
|
||||||
|
public ClickableButton(Rectangle position, String button_label, RabiRaceModule parent_module) {
|
||||||
|
this.x = (int)position.getX();
|
||||||
|
this.y = (int)position.getY();
|
||||||
|
this.width = (int)position.getWidth();
|
||||||
|
this.height = (int)position.getHeight();
|
||||||
|
this.label=button_label;
|
||||||
|
this.module = parent_module;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClickEvent(MouseEvent ev) {
|
||||||
|
/*if (mouseInsideBounds(ev)) {
|
||||||
|
//System.out.println("Click performed!");
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setButtonLabel(String text) {
|
||||||
|
this.label = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean mouseInsideBounds(MouseEvent ev) {
|
||||||
|
return ev.getX()>=module.getPosition().getX()+x && ev.getX()<=module.getPosition().getX()+x+width &&
|
||||||
|
ev.getY()>=module.getPosition().getY()+y && ev.getY()<=module.getPosition().getY()+y+height;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void draw(Graphics g) {
|
||||||
|
Color color_identity = g.getColor();
|
||||||
|
g.setColor(Color.WHITE);
|
||||||
|
g.drawRect((int)module.getPosition().getX()+x,
|
||||||
|
(int)module.getPosition().getY()+y, width, height);
|
||||||
|
g.setColor(Color.BLACK);
|
||||||
|
g.fillRect((int)module.getPosition().getX()+x+1,
|
||||||
|
(int)module.getPosition().getY()+y+1, width-1, height-1);
|
||||||
|
DrawUtils.drawTextFont(g, sigIRC.panel.userFont, module.getPosition().getX()+x-TextUtils.calculateStringBoundsFont(label, sigIRC.panel.userFont).getWidth()/2+width/2, module.getPosition().getY()+y+height-1, Color.WHITE, label);
|
||||||
|
g.setColor(color_identity);
|
||||||
|
}
|
||||||
|
}
|
@ -5,12 +5,11 @@ import java.awt.event.MouseEvent;
|
|||||||
|
|
||||||
import sig.Module;
|
import sig.Module;
|
||||||
import sig.modules.RabiRaceModule;
|
import sig.modules.RabiRaceModule;
|
||||||
import sig.modules.Controller.ClickableButton;
|
|
||||||
|
|
||||||
public class CreateButton extends ClickableButton{
|
public class CreateButton extends ClickableButton{
|
||||||
|
|
||||||
public CreateButton(Rectangle position, String button_label, Module parent_module) {
|
public CreateButton(Rectangle position, String button_label, RabiRaceModule module) {
|
||||||
super(position, button_label, parent_module);
|
super(position, button_label, module);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onClickEvent(MouseEvent ev) {
|
public void onClickEvent(MouseEvent ev) {
|
||||||
|
@ -10,12 +10,11 @@ import java.net.URL;
|
|||||||
import sig.Module;
|
import sig.Module;
|
||||||
import sig.sigIRC;
|
import sig.sigIRC;
|
||||||
import sig.modules.RabiRaceModule;
|
import sig.modules.RabiRaceModule;
|
||||||
import sig.modules.Controller.ClickableButton;
|
|
||||||
|
|
||||||
public class JoinButton extends ClickableButton{
|
public class JoinButton extends ClickableButton{
|
||||||
|
|
||||||
public JoinButton(Rectangle position, String button_label, Module parent_module) {
|
public JoinButton(Rectangle position, String button_label, RabiRaceModule module) {
|
||||||
super(position, button_label, parent_module);
|
super(position,button_label,module);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onClickEvent(MouseEvent ev) {
|
public void onClickEvent(MouseEvent ev) {
|
||||||
|
@ -31,7 +31,7 @@ import com.sun.jna.platform.win32.WinNT.HANDLE;
|
|||||||
import sig.FileManager;
|
import sig.FileManager;
|
||||||
import sig.Module;
|
import sig.Module;
|
||||||
import sig.sigIRC;
|
import sig.sigIRC;
|
||||||
import sig.modules.Controller.ClickableButton;
|
import sig.modules.RabiRace.ClickableButton;
|
||||||
import sig.modules.RabiRace.ColorCycler;
|
import sig.modules.RabiRace.ColorCycler;
|
||||||
import sig.modules.RabiRace.CreateButton;
|
import sig.modules.RabiRace.CreateButton;
|
||||||
import sig.modules.RabiRace.JoinButton;
|
import sig.modules.RabiRace.JoinButton;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user