Skip to content

Commit c933e4f

Browse files
committed
Merge branch 'develop' - Alpha 1.8.4 merge
2 parents 26bed52 + b7498b5 commit c933e4f

File tree

16 files changed

+275
-219
lines changed

16 files changed

+275
-219
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ local.properties
5858
*.tlb
5959
*.tli
6060
*.tlh
61-
*.tmp
6261
*.vspscc
6362
.builds
6463
*.dotCover
@@ -182,10 +181,12 @@ JavaGame.ipr
182181
JavaGame.iws
183182
JavaGame.iml
184183
out/
184+
.idea/
185185

186186
###############
187187
## Debugging ##
188188
###############
189189

190190
.log.txt
191191
/.gradle/
192+
Package game.png

build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ apply plugin: 'java'
66

77
sourceSets{
88
main{
9-
java.srcDir 'src'
10-
resources.srcDir 'res'
9+
java.srcDirs = ['src']
10+
resources.srcDirs = ['res']
1111
}
1212
test{
13-
java.srcDir 'test'
13+
java.srcDirs = ['test']
1414
}
1515
}
1616

jar-in-jar-loader.zip

-7.1 KB
Binary file not shown.

jar/javagame.jar

-2.68 MB
Binary file not shown.

res/music/small.mp3

2.16 KB
Binary file not shown.

res/sfx/smallProjectile.wav

-9.95 KB
Binary file not shown.

src/com/redomar/game/Game.java

Lines changed: 174 additions & 118 deletions
Large diffs are not rendered by default.

src/com/redomar/game/audio/AudioEffect.java

Lines changed: 0 additions & 54 deletions
This file was deleted.

src/com/redomar/game/audio/AudioHandler.java

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,40 @@
11
package com.redomar.game.audio;
22

3+
import com.redomar.game.script.PrintTypes;
4+
import com.redomar.game.script.Printing;
5+
36
import javax.sound.sampled.*;
7+
import java.io.File;
48

59

610
public class AudioHandler {
711

812
private Clip clip;
913
private boolean active = false;
14+
private Printing p = new Printing();
1015

1116
public AudioHandler(String path){
17+
check(path);
18+
}
19+
20+
public AudioHandler(File file){
21+
check(file.toString());
22+
}
23+
24+
private void check(String path){
25+
try {
26+
if(path != ""){
27+
initiate(path);
28+
} else {
29+
throw new NullPointerException();
30+
}
31+
} catch (NullPointerException e){
32+
p.print("Destination Cannot be empty", PrintTypes.ERROR);
33+
throw e;
34+
}
35+
}
36+
37+
private void initiate(String path){
1238
try{
1339
AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(getClass().getResourceAsStream(path));
1440
AudioFormat baseformat = audioInputStream.getFormat();
@@ -26,15 +52,21 @@ public AudioHandler(String path){
2652
clip.open(decodedAudioInputStream);
2753
} catch (Exception e){
2854
System.err.println(e.getStackTrace());
55+
p.print("Audio Failed to initiate", PrintTypes.ERROR);
2956
}
3057
}
3158

3259
public void play(){
33-
if(clip == null) return;
34-
stop();
35-
clip.setFramePosition(0);
36-
clip.start();
37-
active = true;
60+
try{
61+
if(clip == null) return;
62+
stop();
63+
clip.setFramePosition(0);
64+
clip.start();
65+
active = true;
66+
} catch (Exception e) {
67+
p.print("Audio Failed to play", PrintTypes.ERROR);
68+
throw e;
69+
}
3870
}
3971

4072
public void setVolume(float velocity){

src/com/redomar/game/entities/Player.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import com.redomar.game.Game;
44
import com.redomar.game.InputHandler;
5-
import com.redomar.game.audio.AudioEffect;
65
import com.redomar.game.entities.efx.Swim;
76
import com.redomar.game.entities.projectiles.Medium;
87
import com.redomar.game.entities.projectiles.Projectile;

0 commit comments

Comments
 (0)