v2.0.0: added a desktop setting for playing music when focus is lost
This commit is contained in:
@@ -25,6 +25,7 @@ import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Window;
|
||||
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3WindowListener;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.SPDSettings;
|
||||
import com.watabou.noosa.audio.Music;
|
||||
|
||||
public class DesktopWindowListener implements Lwjgl3WindowListener {
|
||||
|
||||
@@ -41,8 +42,16 @@ public class DesktopWindowListener implements Lwjgl3WindowListener {
|
||||
|
||||
@Override
|
||||
public void iconified ( boolean b ) { }
|
||||
public void focusLost () { }
|
||||
public void focusGained () { }
|
||||
public void focusLost () {
|
||||
if (!SPDSettings.playMusicInBackground()) {
|
||||
Music.INSTANCE.pause();
|
||||
}
|
||||
}
|
||||
public void focusGained () {
|
||||
if (!SPDSettings.playMusicInBackground()){
|
||||
Music.INSTANCE.resume();
|
||||
}
|
||||
}
|
||||
public boolean closeRequested () { return true; }
|
||||
public void filesDropped ( String[] strings ) { }
|
||||
public void refreshRequested () { }
|
||||
|
||||
Reference in New Issue
Block a user