Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2014
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. boolean backgroundMusicPlaying = backgroundMusic.isPlaying();
  2.  
  3. public MainMenuScreen(Game1 gam){
  4. (...)
  5. if(backgroundMusicPlaying != true){
  6. backgroundMusic.play();
  7. backgroundMusic.setVolume(0.3f);
  8. backgroundMusic.setLooping(true);
  9. backgroundMusicPlaying = true;
  10. }
  11. (...)
  12. }
  13.  
  14. game.setScreen(new playOptions(game));
  15.  
  16. public MainMenuScreen(Game1 gam){
  17. (...)
  18. boolean backgroundMusicPlaying = backgroundMusic.isPlaying();
  19. if(backgroundMusicPlaying != true){
  20. backgroundMusic.play();
  21. backgroundMusic.setVolume(0.3f);
  22. backgroundMusic.setLooping(true);
  23. backgroundMusicPlaying = true;
  24. }
  25.  
  26. public class MusicPlayer extends AsyncTask<Void, Void, Void>
  27. {
  28. public String filename;
  29. public boolean backgroundMusicPlaying;
  30. public ??? backgroundMusic;
  31.  
  32. @Override
  33. protected void onPreExecute() {
  34. super.onPreExecute();
  35. //this method will be running on UI thread
  36. }
  37. @Override
  38. protected Void doInBackground(Void... params) {
  39. //this method will be running on background thread so don't update UI frome here
  40. return null;
  41. }
  42.  
  43. @Override
  44. protected void onPostExecute(Void result) {
  45. super.onPostExecute(result);
  46.  
  47. //this method will be running on UI thread
  48. }
  49.  
  50.  
  51. public void playMusic() {
  52. // stub
  53. }
  54.  
  55. public void pauseMusic() {
  56. // stub
  57. }
  58.  
  59. public void setVolume(float level) {
  60. // stub
  61. }
  62.  
  63. // etc
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement