Skip to content

Commit 82f76a1

Browse files
committed
Merge remote-tracking branch 'origin/aside'
2 parents 8f3b6ad + f9e2b33 commit 82f76a1

File tree

4 files changed

+55
-0
lines changed

4 files changed

+55
-0
lines changed

res/music/jl1.0.1.jar

103 KB
Binary file not shown.

res/music/yoshi.mp3

1.8 MB
Binary file not shown.

src/com/redomar/game/Game.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import com.redomar.game.gfx.Screen;
1818
import com.redomar.game.gfx.SpriteSheet;
1919
import com.redomar.game.level.LevelHandler;
20+
import com.redomar.game.lib.Music;
2021
import com.redomar.game.net.GameClient;
2122
import com.redomar.game.net.GameServer;
2223
import com.redomar.game.net.packets.Packet00Login;
@@ -108,6 +109,9 @@ public synchronized void start() {
108109
running = true;
109110
new Thread(this).start();
110111

112+
Music music = new Music();
113+
new Thread(music).start();
114+
111115
if (Jdata_Host == 0) {
112116
socketServer = new GameServer(this);
113117
socketServer.start();
@@ -213,6 +217,7 @@ public void render() {
213217
public static void main(String[] args) {
214218
try {
215219
JSplash splash = new JSplash(Game.class.getResource("/splash/splash.png"), true, true, false, "v1.4 Alpha", null, Color.RED, Color.ORANGE);
220+
splash.setAlwaysOnTop(true);
216221
splash.splashOn();
217222
splash.setProgress(10, "Initializing Game");
218223
Thread.sleep(750);
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package com.redomar.game.lib;
2+
3+
import java.io.BufferedInputStream;
4+
import java.io.InputStream;
5+
6+
import com.redomar.game.Game;
7+
8+
import javazoom.jl.player.Player;
9+
10+
public class Music implements Runnable{
11+
12+
private InputStream file;
13+
private Player musicPlayer;
14+
15+
public Music(InputStream url){
16+
this.file = url;
17+
}
18+
19+
public Music() {
20+
21+
}
22+
23+
public void Play(){
24+
try {
25+
BufferedInputStream buffered = new BufferedInputStream(file);
26+
musicPlayer = new Player(buffered);
27+
musicPlayer.play();
28+
} catch (Exception e) {
29+
System.out.println("Problem playing file " + file);
30+
System.out.println(e);
31+
}
32+
}
33+
34+
@Override
35+
public void run() {
36+
Music music = new Music(Game.class.getResourceAsStream("/music/yoshi.mp3"));
37+
while(true){
38+
music.Play();
39+
}
40+
}
41+
42+
public void stop() {
43+
Music music = new Music(Game.class.getResourceAsStream("/music/yoshi.mp3"));
44+
while(true){
45+
music.stop();
46+
}
47+
}
48+
49+
50+
}

0 commit comments

Comments
 (0)