Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- boolean backgroundMusicPlaying = backgroundMusic.isPlaying();
- public MainMenuScreen(Game1 gam){
- (...)
- if(backgroundMusicPlaying != true){
- backgroundMusic.play();
- backgroundMusic.setVolume(0.3f);
- backgroundMusic.setLooping(true);
- backgroundMusicPlaying = true;
- }
- (...)
- }
- game.setScreen(new playOptions(game));
- public MainMenuScreen(Game1 gam){
- (...)
- boolean backgroundMusicPlaying = backgroundMusic.isPlaying();
- if(backgroundMusicPlaying != true){
- backgroundMusic.play();
- backgroundMusic.setVolume(0.3f);
- backgroundMusic.setLooping(true);
- backgroundMusicPlaying = true;
- }
- public class MusicPlayer extends AsyncTask<Void, Void, Void>
- {
- public String filename;
- public boolean backgroundMusicPlaying;
- public ??? backgroundMusic;
- @Override
- protected void onPreExecute() {
- super.onPreExecute();
- //this method will be running on UI thread
- }
- @Override
- protected Void doInBackground(Void... params) {
- //this method will be running on background thread so don't update UI frome here
- return null;
- }
- @Override
- protected void onPostExecute(Void result) {
- super.onPostExecute(result);
- //this method will be running on UI thread
- }
- public void playMusic() {
- // stub
- }
- public void pauseMusic() {
- // stub
- }
- public void setVolume(float level) {
- // stub
- }
- // etc
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement