Added ability to play mp3s from system for future music module. Continue

to improve and fix bugs with ScrollingChatModule and ChatLogModule.
dev
sigonasr2 7 years ago
parent 824b8249d9
commit 79bb1e576b
  1. 21
      .classpath
  2. BIN
      lib/basicplayer3.0.jar
  3. BIN
      lib/commons-logging-api.jar
  4. BIN
      lib/jl1.0.jar
  5. BIN
      lib/jogg-0.0.7.jar
  6. BIN
      lib/jorbis-0.0.15.jar
  7. BIN
      lib/jspeex0.9.7.jar
  8. BIN
      lib/mp3spi1.9.4.jar
  9. BIN
      lib/tritonus_share.jar
  10. BIN
      lib/vorbisspi1.0.2.jar
  11. BIN
      sigIRCv2.jar
  12. 12
      src/sig/Module.java
  13. 16
      src/sig/modules/ChatLog/ChatLogMessage.java
  14. 7
      src/sig/modules/ChatLogModule.java
  15. 29
      src/sig/modules/ScrollingChatModule.java
  16. 2
      src/sig/sigIRC.java
  17. 8
      src/sig/windows/LoadingDialog.java
  18. 46
      src/sig/windows/ModuleButton.java
  19. 55
      src/sig/windows/ProgramWindow.java

@ -15,5 +15,26 @@
<classpathentry kind="lib" path="lib/lwjgl-natives-windows.jar"/>
<classpathentry kind="lib" path="lib/jna-4.5.0.jar"/>
<classpathentry kind="lib" path="lib/jna-platform-4.5.0.jar"/>
<classpathentry kind="lib" path="C:/Users/Joshua Sigona/git/sigIRCv2/lib/basicplayer3.0.jar"/>
<classpathentry kind="lib" path="C:/Users/Joshua Sigona/git/sigIRCv2/lib/commons-io-2.5.jar"/>
<classpathentry kind="lib" path="C:/Users/Joshua Sigona/git/sigIRCv2/lib/commons-logging-api.jar"/>
<classpathentry kind="lib" path="C:/Users/Joshua Sigona/git/sigIRCv2/lib/jl1.0.jar"/>
<classpathentry kind="lib" path="C:/Users/Joshua Sigona/git/sigIRCv2/lib/jna-4.5.0.jar"/>
<classpathentry kind="lib" path="C:/Users/Joshua Sigona/git/sigIRCv2/lib/jna-platform-4.5.0.jar"/>
<classpathentry kind="lib" path="C:/Users/Joshua Sigona/git/sigIRCv2/lib/jogg-0.0.7.jar"/>
<classpathentry kind="lib" path="C:/Users/Joshua Sigona/git/sigIRCv2/lib/jorbis-0.0.15.jar"/>
<classpathentry kind="lib" path="C:/Users/Joshua Sigona/git/sigIRCv2/lib/jspeex0.9.7.jar"/>
<classpathentry kind="lib" path="C:/Users/Joshua Sigona/git/sigIRCv2/lib/lwjgl.jar"/>
<classpathentry kind="lib" path="C:/Users/Joshua Sigona/git/sigIRCv2/lib/lwjgl-glfw.jar"/>
<classpathentry kind="lib" path="C:/Users/Joshua Sigona/git/sigIRCv2/lib/lwjgl-glfw-natives-linux.jar"/>
<classpathentry kind="lib" path="C:/Users/Joshua Sigona/git/sigIRCv2/lib/lwjgl-glfw-natives-macos.jar"/>
<classpathentry kind="lib" path="C:/Users/Joshua Sigona/git/sigIRCv2/lib/lwjgl-glfw-natives-windows.jar"/>
<classpathentry kind="lib" path="C:/Users/Joshua Sigona/git/sigIRCv2/lib/lwjgl-natives-linux.jar"/>
<classpathentry kind="lib" path="C:/Users/Joshua Sigona/git/sigIRCv2/lib/lwjgl-natives-macos.jar"/>
<classpathentry kind="lib" path="C:/Users/Joshua Sigona/git/sigIRCv2/lib/lwjgl-natives-windows.jar"/>
<classpathentry kind="lib" path="C:/Users/Joshua Sigona/git/sigIRCv2/lib/mp3spi1.9.4.jar"/>
<classpathentry kind="lib" path="C:/Users/Joshua Sigona/git/sigIRCv2/lib/tritonus_share.jar"/>
<classpathentry kind="lib" path="C:/Users/Joshua Sigona/git/sigIRCv2/lib/twitch-api-wrapper-0.3-jar-with-dependencies.jar"/>
<classpathentry kind="lib" path="C:/Users/Joshua Sigona/git/sigIRCv2/lib/vorbisspi1.0.2.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -1,6 +1,7 @@
package sig;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Point;
import java.awt.Rectangle;
@ -55,7 +56,12 @@ public class Module extends JFrame implements ComponentListener, WindowListener,
int windowUpdateCounter = 30;
public Module(Rectangle bounds, String moduleName) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
this.addComponentListener(this);
this.addWindowListener(this);
this.addKeyListener(this);
@ -76,8 +82,8 @@ public class Module extends JFrame implements ComponentListener, WindowListener,
this.titleHeight = (int)TextUtils.calculateStringBoundsFont(this.name, sigIRC.userFont).getHeight();
this.setSize((int)position.getWidth(), (int)position.getHeight());
panel.setSize(this.getSize());
this.setMinimumSize(new Dimension((int)position.getWidth(), (int)position.getHeight()));
panel.setMinimumSize(this.getMinimumSize());
this.add(panel);
//this.pack();

@ -4,6 +4,7 @@ import java.awt.Color;
import java.awt.Graphics;
import java.awt.Point;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
@ -34,25 +35,32 @@ public class ChatLogMessage {
this.refModule = ChatLogModule.chatlogmodule;
this.rawMessage = rawMessage;
this.position = new Point(0,(int)refModule.getPosition().getHeight()-MESSAGE_SPACING);
//System.out.println("1");
WrapText();
//System.out.println("2");
for (ChatLogMessage clm : this.refModule.messageHistory) {
clm.position.setLocation(
clm.position.getX(),
clm.position.getY()-messageDisplaySize.getY());
//System.out.println(clm.rawMessage+": "+clm.position);
}
//System.out.println("3");
this.position.setLocation(this.position.getX(), this.position.getY()-messageDisplaySize.getY()+ChatLogModule.chatlogmodule.scrolllog_yoffset);
//System.out.println(displayMessage);
this.username = DetectUsername(displayMessage);
//System.out.println("4");
if (this.username!=null) {
displayMessage.set(0,GetMessage(displayMessage.get(0)+" "));
usernameWidth = (int)TextUtils.calculateStringBoundsFont(this.username, sigIRC.userFont).getWidth();
}
for (int i=0;i<displayMessage.size();i++) {
//System.out.println("displayMessage["+i+"] before: "+displayMessage.get(i));
displayMessage.set(i, ReplaceMessageWithEmoticons(" "+displayMessage.get(i)+" ",(i==0)?usernameWidth:0,i*MESSAGE_SPACING));
String msg = ReplaceMessageWithEmoticons(" "+displayMessage.get(i)+" ",(i==0)?usernameWidth:0,i*MESSAGE_SPACING);
displayMessage.set(i, msg);
//System.out.println("displayMessage["+i+"] after: "+displayMessage.get(i));
}
//System.out.println("5 "+displayMessage.size());
//System.out.println("6");
}
private String ReplaceMessageWithEmoticons(String basemsg, int xpos, int ypos) {
@ -233,12 +241,16 @@ public class ChatLogMessage {
public static void importMessages(String...logContents) {
if (sigIRC.chatlogmodule_enabled) {
//System.out.println("Adding chat message "+Arrays.toString(logContents));
for (String s : logContents) {
//System.out.println(" For "+s+":");
if (s!=null) {
if (ChatLogModule.chatlogmodule.messageHistory.size()>=ChatLogModule.messageHistoryCount) {
//System.out.println(" Removed.");
ChatLogModule.chatlogmodule.messageHistory.remove(0).cleanup();
}
ChatLogModule.chatlogmodule.messageHistory.add(new ChatLogMessage(s));
//System.out.println(" Adding "+s+".");
ChatLogModule.chatlogmodule.messageQueue.add(s);
}
}
}

@ -24,7 +24,7 @@ import sig.utils.DrawUtils;
import sig.utils.FileUtils;
public class ChatLogModule extends Module{
public static int messageHistoryCount = 50;
public static int messageHistoryCount = 20;
public List<ChatLogMessage> messageHistory = new ArrayList<ChatLogMessage>();
int delay = 150;
boolean initialized=false;
@ -34,6 +34,7 @@ public class ChatLogModule extends Module{
long positionsNeedUpdating = 0; //Set it to System.currentTimeMillis() to request a configuration save.
Rectangle prevpos = (Rectangle)position.clone();
int justOpened=2;
public List<String> messageQueue = new ArrayList<String>();
public ChatLogModule(Rectangle bounds, String moduleName) {
@ -59,6 +60,10 @@ public class ChatLogModule extends Module{
public void run() {
super.run();
for (int i=0;i<messageQueue.size();i++) {
messageHistory.add(new ChatLogMessage(messageQueue.remove(0)));
i--;
}
if (delay>0 && sigIRC.subEmotesCompleted) {
delay--;
} else

@ -28,20 +28,18 @@ public class ScrollingChatModule extends Module{
ScrollingChatModule.module = this;
String[] filedata = FileUtils.readFromFile(sigIRC.BASEDIR+"sigIRC/oauthToken.txt");
final String oauth = filedata[0].trim().substring(0, Math.min(36,filedata[0].trim().length()));
Thread t = new Thread(()->{
sigIRC.InitializeIRCConnection(sigIRC.server, sigIRC.nickname, sigIRC.channel, oauth);
});
t.start();
UpdateSubEmoticons();
for (int i=0;i<sigIRC.chatRows;i++) {
sigIRC.rowobj.add(new TextRow(32+sigIRC.ROWSEPARATION*i));
}
//UpdateSubEmoticons();
}
public void run() {
super.run();
UpdateScrollingText();
UpdateAuthenticationCountdownMessage();
//System.out.println("Called.");
}
@ -61,7 +59,20 @@ public class ScrollingChatModule extends Module{
}
}
public void ApplyConfigWindowProperties() {
sigIRC.scrollingchatmodule_X=(int)position.getX();
sigIRC.scrollingchatmodule_Y=(int)position.getY();
sigIRC.scrollingchatmodule_width=(int)position.getWidth();
sigIRC.scrollingchatmodule_height=(int)position.getHeight();
sigIRC.config.setInteger("SCROLLINGCHAT_module_X", sigIRC.scrollingchatmodule_X);
sigIRC.config.setInteger("SCROLLINGCHAT_module_Y", sigIRC.scrollingchatmodule_Y);
sigIRC.config.setInteger("SCROLLINGCHAT_module_width", sigIRC.scrollingchatmodule_width);
sigIRC.config.setInteger("SCROLLINGCHAT_module_height", sigIRC.scrollingchatmodule_height);
sigIRC.config.saveProperties();
}
public void draw(Graphics g) {
super.draw(g);
for (int i=0;i<sigIRC.textobj.size();i++) {
if (sigIRC.textobj.get(i).isActive()) {
if (sigIRC.overlayMode) {
@ -167,7 +178,7 @@ public class ScrollingChatModule extends Module{
}
}
for (int i=0;i<sigIRC.textobj.size();i++) {
System.out.println(sigIRC.textobj.get(i).getX()+","+sigIRC.textobj.get(i).getY());
//System.out.println(sigIRC.textobj.get(i).getX()+","+sigIRC.textobj.get(i).getY());
boolean keep = sigIRC.textobj.get(i).run();
if (!keep) {
sigIRC.textobj.remove(i--);

@ -111,7 +111,7 @@ public class sigIRC{
public static int windowY=0;
public static int windowWidth=0;
public static int windowHeight=0;
static int chatRows=3;
public static int chatRows=3;
static int chatScrollSpd=4;
static int rowSpacing=64;
static String messageFont="Gill Sans Ultra Bold Condensed";

@ -197,7 +197,13 @@ public class LoadingDialog extends JFrame{
sigIRC.emoticons.add(new Emoticon(":D","11"));
sigIRC.emoticons.add(new Emoticon(">(","12"));
sigIRC.emoticons.add(new Emoticon("<3","13"));
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
//Load is done. Start up the panel.
sigIRC.window = new ProgramWindow();
this.setVisible(false);

@ -0,0 +1,46 @@
package sig.windows;
import java.awt.Color;
import java.awt.Dimension;
import javax.swing.JToggleButton;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import sig.Module;
@SuppressWarnings("serial")
class ModuleButton extends JToggleButton{
String label = "";
ModuleButton button;
Module myModule;
public ModuleButton(String label, Module module) {
this.label=label;
this.button=this;
this.myModule=module;
this.setBackground(Color.DARK_GRAY);
this.setText(label);
this.setToolTipText("Click to enable and disable the \n"+label+" module.");
this.setPreferredSize(new Dimension(160,56));
this.setForeground(Color.GRAY);
this.setIconTextGap(4);
this.setSelectedIcon(ProgramWindow.selected_icon);
this.setIcon(ProgramWindow.deselected_icon);
this.setSelected(true);
button.setForeground(Color.BLUE);
this.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
if (button.isSelected()) {
button.setForeground(Color.BLUE);
}
else {
button.setBackground(Color.DARK_GRAY);
button.setForeground(Color.GRAY);
}
myModule.setVisible(button.isSelected());
}
});
}
}

@ -1,7 +1,6 @@
package sig.windows;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.Rectangle;
@ -10,6 +9,7 @@ import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
@ -21,10 +21,12 @@ import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JToggleButton;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javazoom.jlgui.basicplayer.BasicController;
import javazoom.jlgui.basicplayer.BasicPlayer;
import javazoom.jlgui.basicplayer.BasicPlayerEvent;
import javazoom.jlgui.basicplayer.BasicPlayerException;
import javazoom.jlgui.basicplayer.BasicPlayerListener;
import sig.BackgroundColorButton;
import sig.ColorPanel;
import sig.Module;
@ -117,6 +119,15 @@ public class ProgramWindow extends JFrame{
}
GridLayout myLayout = new GridLayout(0,1);
sigIRC.panel.setLayout(myLayout);
///Play MUSIC
/*BasicPlayer player = new BasicPlayer();
try {
player.open(new File("D:\\Videos\\4K Video Downloader\\3R2 - The Truth Never Spoken (Energetic Trance Mix).mp3"));
player.play();
} catch (BasicPlayerException e) {
e.printStackTrace();
}*/
//colorpanel = new ColorPanel();
//this.add(colorpanel);
@ -139,40 +150,4 @@ public class ProgramWindow extends JFrame{
//Module testMod = new Module(new Rectangle(0,0,640,480),"Test");
}
}
@SuppressWarnings("serial")
class ModuleButton extends JToggleButton{
String label = "";
ModuleButton button;
Module myModule;
public ModuleButton(String label, Module module) {
this.label=label;
this.button=this;
this.myModule=module;
this.setBackground(Color.DARK_GRAY);
this.setText(label);
this.setToolTipText("Click to enable and disable the \n"+label+" module.");
this.setPreferredSize(new Dimension(160,56));
this.setForeground(Color.GRAY);
this.setIconTextGap(4);
this.setSelectedIcon(ProgramWindow.selected_icon);
this.setIcon(ProgramWindow.deselected_icon);
this.setSelected(true);
button.setForeground(Color.BLUE);
this.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
if (button.isSelected()) {
button.setForeground(Color.BLUE);
}
else {
button.setBackground(Color.DARK_GRAY);
button.setForeground(Color.GRAY);
}
myModule.setVisible(button.isSelected());
}
});
}
}
Loading…
Cancel
Save