Merge branch 'master' of github.com:jokerx3/prp

This commit is contained in:
toksikk
2014-12-18 15:11:08 +01:00
6 changed files with 39 additions and 13 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ package de.heatup.audio;
public class AudioFiles {
//base path
private static final String basePath = "src/de/heatup/resources/audio/";
private static final String basePath = "de/heatup/resources/audio/";
//sound files
private String Invaders;
+15 -5
View File
@@ -10,7 +10,11 @@ import javax.sound.sampled.LineListener;
public class AudioPlayer {
public AudioPlayer() {}
private ClassLoader cl;
public AudioPlayer() {
this.cl = Thread.currentThread().getContextClassLoader();
}
/** plays a file once */
public void play(String file) {
@@ -26,13 +30,17 @@ public class AudioPlayer {
}
});
/**
File f = new File(file);
if(!f.exists()) {
System.out.println("File not found: " + f.getAbsolutePath());
return;
}
}
*/
clip.open(AudioSystem.getAudioInputStream(f));
clip.open(AudioSystem.getAudioInputStream(cl.getResourceAsStream(file)));
clip.start();
} catch (Exception e) {
@@ -54,13 +62,15 @@ public class AudioPlayer {
}
});
/**
File f = new File(file);
if(!f.exists()) {
System.out.println("File not found: " + f.getAbsolutePath());
return;
}
}
*/
clip.open(AudioSystem.getAudioInputStream(f));
clip.open(AudioSystem.getAudioInputStream(cl.getResourceAsStream(file)));
clip.loop(clip.LOOP_CONTINUOUSLY);
} catch(Exception e) {
@@ -1,12 +1,9 @@
package de.heatup.objects;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.Random;
import javax.imageio.ImageIO;
import de.heatup.cfg.Config;
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

+22 -3
View File
@@ -47,6 +47,7 @@ public class Main extends JFrame implements Runnable {
private static JPanel outerPanel;
private static JPanel statusPanel;
private static JPanel gamePanel;
private static JPanel menuPanel;
private static JPanel leftPanel;
private static JPanel rightPanel;
private static JPanel actionPanel;
@@ -66,22 +67,29 @@ public class Main extends JFrame implements Runnable {
outerPanel = new JPanel();
outerPanel.setLayout(new BorderLayout());
outerPanel.setFocusable(false);
outerPanel.setFocusable(true);
statusPanel = new JPanel();
statusPanel.setPreferredSize(new Dimension(800,80));
statusPanel.setFocusable(true);
statusPanel.setFocusable(false);
gamePanel = new JPanel();
gamePanel.setLayout(null);
gamePanel.setPreferredSize(new Dimension(800,600));
gamePanel.setFocusable(false);
gamePanel.setBackground(Color.black);
menuPanel = new JPanel();
menuPanel.setLayout(null);
menuPanel.setPreferredSize(new Dimension(800,600));
menuPanel.setFocusable(false);
menuPanel.setBackground(Color.black);
actionPanel = new JPanel();
actionPanel.setLayout(new GridLayout(1,1));
actionPanel.setPreferredSize(new Dimension(800,80));
actionPanel.setFocusable(true);
actionPanel.setFocusable(false);
leftPanel = new JPanel();
leftPanel.setLayout(null);
@@ -252,7 +260,18 @@ public class Main extends JFrame implements Runnable {
private void tick() {
PanelBuilder.kb.checkKeyActivity();
if (!pause) {
if ( ! gamePanel.isVisible() ) {
gamePanel.setVisible(true);
actionPanel.setVisible(true);
statusPanel.setVisible(true);
}
PanelBuilder.tick();
} else if ( pause ) {
// Hier einfügen was passiert wenn ESC gedrückt wird
gamePanel.setVisible(false);
actionPanel.setVisible(false);
statusPanel.setVisible(false);
}
}
// alles was animiert wird hier rein (paints)
+1 -1
View File
@@ -132,7 +132,7 @@ public class PanelBuilder {
kb = new KeyBindings(player01);
statusPanel.addKeyListener(kb);
outerPanel.addKeyListener(kb);
MapEngine me;
if (map > 0) {