diff --git a/bin/screenshot.png b/bin/screenshot.png new file mode 100644 index 0000000..b49cd06 Binary files /dev/null and b/bin/screenshot.png differ diff --git a/ding.wav b/ding.wav new file mode 100644 index 0000000..0aa72ef Binary files /dev/null and b/ding.wav differ diff --git a/screenshot.png b/screenshot.png new file mode 100644 index 0000000..cd34877 Binary files /dev/null and b/screenshot.png differ diff --git a/scripts/md5 b/scripts/md5 index c4273a3..51bd804 100644 --- a/scripts/md5 +++ b/scripts/md5 @@ -1,5 +1,5 @@ -build.sh:a833e7598ad65672a9c01306d244b49f - -clean.sh:96ce35f2d2dcb555421e00a6afda23ca - -commit.sh:21af1fa6f09d01679c9e11408967264a - -jar.sh:2ac636f584c43a1124affb9ea6bdc7bf - -lean.sh:3be7b8b182ccd96e48989b4e57311193 - +build.sh:de32fdf9f3ce9eb5d4ea9902ee48dbe0 *- +clean.sh:8aec15e447257f1c3a4e978f1b56a78e *- +commit.sh:a592fe2113538f8cf933907eeda13ddc *- +jar.sh:58c4f48f7e34425e55358a165a81c03b *- +lean.sh:3be7b8b182ccd96e48989b4e57311193 *- diff --git a/src/sig/ArcadeScreenshotHandler.java b/src/sig/ArcadeScreenshotHandler.java index 1493ec3..572979e 100644 --- a/src/sig/ArcadeScreenshotHandler.java +++ b/src/sig/ArcadeScreenshotHandler.java @@ -7,9 +7,17 @@ import java.awt.AWTException; import java.awt.GraphicsEnvironment; import javax.imageio.ImageIO; +import javax.sound.sampled.AudioInputStream; +import javax.sound.sampled.AudioSystem; +import javax.sound.sampled.Clip; +import javax.swing.JButton; import javax.swing.JFrame; +import javax.swing.JLabel; import java.awt.Robot; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + import sig.engine.Panel; public class ArcadeScreenshotHandler { @@ -17,26 +25,53 @@ public class ArcadeScreenshotHandler { public static final String PROGRAM_NAME="Sig's Java Project Template"; public static void main(String[] args) { JFrame f = new JFrame(PROGRAM_NAME); - Panel p = new Panel(f); + JButton button = new JButton("Capture"); + + JLabel text = new JLabel(""); - p.init(); + button.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent e) { + System.out.println(e.getActionCommand()); + BufferedImage img; + try { + img = CaptureScreen(); + ImageIO.write(img,"png",Path.of("..","screenshot.png").toFile()); + } catch (IOException e1) { + e1.printStackTrace(); + } + playSound(Path.of("..","ding.wav")); + } + + }); - f.add(p); - f.setSize(1280,720); + f.add(button); + //f.add(text); + f.pack(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); - - p.render(); try { r = new Robot(); - BufferedImage img = CaptureScreen(); - ImageIO.write(img,"png",Path.of("screenshot.png").toFile()); - } catch (AWTException | IOException e) { + } catch (AWTException e) { e.printStackTrace(); } } + public static void playSound(Path file) { + try { + AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(file.toFile()); + Clip clip = AudioSystem.getClip(); + clip.open(audioInputStream); + clip.start(); + // If you want the sound to loop infinitely, then put: clip.loop(Clip.LOOP_CONTINUOUSLY); + // If you want to stop the sound, then use clip.stop(); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + private static BufferedImage CaptureScreen() throws IOException { BufferedImage screenshot = r.createScreenCapture(GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds()); //ImageIO.write(screenshot,"png",new File("screenshot.png")); diff --git a/src/sig/engine/Panel.java b/src/sig/engine/Panel.java index 33e010d..579794a 100644 --- a/src/sig/engine/Panel.java +++ b/src/sig/engine/Panel.java @@ -108,33 +108,6 @@ public class Panel extends JPanel implements Runnable { p[y*width+x]=(0<<16)+(0<<8)+0; } } - - x_offset+=1; - y_offset=50; - - FillPolygon(p,Color.WHITE,50,50,new Point[] { - new Point(135,2), - new Point(166,96), - new Point(265,97), - new Point(185,156), - new Point(215,251), - new Point(134,192), - new Point(54,251), - new Point(84,156), - new Point(4,97), - new Point(103,96), - }); - FillPolygon(p,Color.BRIGHT_CYAN,x_offset,y_offset,new Point[] { - new Point(28,29), - new Point(78,103), - new Point(120,31), - new Point(123,221), - new Point(30,218), - }); - //FillRect(p,Color.BRIGHT_RED,200,200,600,64); - final Color testAlpha = new Color(150,0,0,128); - FillCircle(p,testAlpha,150,150,100); - FillOval(p,Color.BRIGHT_GREEN,300,150,100,50); } public void FillRect(int[] p,Color col,double x,double y,double w,double h) { diff --git a/utils/md5 b/utils/md5 index 715e752..81ea9d5 100644 --- a/utils/md5 +++ b/utils/md5 @@ -1,5 +1,5 @@ -.coauthors:3785ad38663e5fc43e574914ad067294 - -define.sh:d6b20a25a04a60d94f466e48fa60ac69 - -main.sh:32a1f953ffca8584d1eb57c0ecd8a582 - -search.sh:28d0ede8345514d80cc68cc756870002 - -.updateDirectories:0ede00461e947494545e694040787b3f - +.coauthors:3785ad38663e5fc43e574914ad067294 *- +.updateDirectories:0ede00461e947494545e694040787b3f *- +define.sh:d6b20a25a04a60d94f466e48fa60ac69 *- +main.sh:32a1f953ffca8584d1eb57c0ecd8a582 *- +search.sh:6eec52214a36f2114442c41ab9c04f72 *- diff --git a/utils/search.sh b/utils/search.sh index 5392df5..dd40bcf 100644 --- a/utils/search.sh +++ b/utils/search.sh @@ -37,6 +37,7 @@ function check() { if [ "$g" != "md5" ]; then if [ -f $1$g ]; then + if [ "$g" != ".coauthors" ]; then echo "++Redownload $1$g..." if [ -f "$1$g" ]; then #Read the 2nd line and see if it has a special directory. @@ -58,6 +59,7 @@ function check() { echo "===Could not find directory, assuming regular scripts directory exists." curl -H 'Cache-Control: no-cache, no-store' https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1$g --output scripts/$g fi + fi else echo "++==Downloading $1$g..." curl -H 'Cache-Control: no-cache, no-store' https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1$g --output $1$g @@ -74,4 +76,4 @@ function check() { check $1$g/ fi done -} \ No newline at end of file +}