Version 2.0 of sigIRC rewritten and remastered for Java. Includes "Modules" which can be enabled/disabled to modify functionality of the program.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sigIRCv2/src/sig/TextRow.java

54 lines
1.2 KiB

package sig;
import java.util.Random;
public class TextRow {
private int maxX = 0; //Defines the greatest X position of all the messages in this row.
private int ypos = 0;
final int MESSAGE_SEPARATION=200;
private int scrollSpd = sigIRC.BASESCROLLSPD;
public TextRow(int ypos) {
this.ypos=ypos;
}
public int getY() {
return ypos;
}
public void setY(int ypos) {
this.ypos = ypos;
}
public int getMaxX() {
return maxX;
}
public int getScrollSpd() {
return scrollSpd;
}
public void updateRow(ScrollingText text) {
text.setX(maxX+sigIRC.panel.getWidth()+MESSAGE_SEPARATION);
text.setY(ypos);
text.setTextRow(this);
maxX+=text.getStringWidth()+MESSAGE_SEPARATION;
}
public void update() {
scrollSpd = DetermineScrollSpd();
if (maxX>0) {
maxX-=scrollSpd;
}
}
private int DetermineScrollSpd() {
return maxX/Math.max(1000,sigIRC.windowWidth)+sigIRC.chatScrollSpd;
}
public static TextRow PickRandomTextRow(String username) {
Random r = new Random();
r.setSeed(username.hashCode());
int randomnumb = r.nextInt(sigIRC.rowobj.size());
return sigIRC.rowobj.get(randomnumb);
}
}