Skip to content

Commit

Permalink
Fixed music option saving/restoring. The game preferences need to be …
Browse files Browse the repository at this point in the history
…restored before music player creation.
  • Loading branch information
forteri76 committed Jun 1, 2013
1 parent b16b06d commit 3d26cb4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
5 changes: 3 additions & 2 deletions src/org/jfedor/frozenbubble/FrozenBubble.java
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setVolumeControlStream(AudioManager.STREAM_MUSIC);
requestWindowFeature(Window.FEATURE_NO_TITLE);
restoreGamePrefs();

currentOrientation = getScreenOrientation();
myOrientationEventListener =
Expand Down Expand Up @@ -236,12 +237,12 @@ public void onOrientationChanged(int arg0) {
mGameThread.restoreState(savedInstanceState);

mGameView.requestFocus();
setFullscreen();
playMusic(false);
}
else {
startCustomGame(intent);
}
restoreGamePrefs();
}

@Override
Expand Down Expand Up @@ -424,7 +425,6 @@ private void restoreGamePrefs() {
soundOn = mConfig.getBoolean("soundOn", true );
targetMode = mConfig.getInt ("targetMode", POINT_TO_SHOOT);

setFullscreen();
setTargetMode(targetMode);
}

Expand Down Expand Up @@ -555,6 +555,7 @@ private void startCustomGame(Intent intent) {
mGameView.setGameListener(this);
mGameThread = mGameView.getThread();
mGameView.requestFocus();
setFullscreen();
playMusic(false);
}

Expand Down
10 changes: 5 additions & 5 deletions src/org/jfedor/frozenbubble/GameView.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ public void setGameListener (GameListener gl) {
class GameThread extends Thread {
private static final int FRAME_DELAY = 40;

public static final int STATE_RUNNING = 1;
public static final int STATE_PAUSE = 2;
public static final int STATE_ABOUT = 4;
public static final int STATE_RUNNING = 1;
public static final int STATE_PAUSE = 2;
public static final int STATE_ABOUT = 4;

public static final int GAMEFIELD_WIDTH = 320;
public static final int GAMEFIELD_HEIGHT = 480;
Expand Down Expand Up @@ -330,7 +330,7 @@ public GameThread(SurfaceHolder surfaceHolder, byte[] customLevels,

mImageList = new Vector<BmpWrap>();

mBubbles = new BmpWrap[8];
mBubbles = new BmpWrap[8];
for (int i = 0; i < mBubbles.length; i++) {
mBubbles[i] = NewBmpWrap();
}
Expand Down Expand Up @@ -609,7 +609,7 @@ public void setSurfaceSize(int width, int height) {
mDisplayScale = (1.0 * height) / GAMEFIELD_HEIGHT;
mDisplayDX = (int)((width - (mDisplayScale *
EXTENDED_GAMEFIELD_WIDTH)) / 2);
mDisplayDY = 0;
mDisplayDY = 0;
}
else {
mDisplayScale = 1.0 * width / GAMEFIELD_WIDTH;
Expand Down

0 comments on commit 3d26cb4

Please sign in to comment.