Game Development Reference
In-Depth Information
mGameDir += getString(R.string.pkg_name) + File.separator
+ "files" + File.separator;
if (!mGameStarted)
DialogTool.Toast(this, "Menu for options");
// Image size
setImageSize(320, 200);
// Start Game
startGame(mGameDir, WolfTools.GAME_ID, true);
}
private void initController() {
// No controller in landscape
if (!isPortrait()) {
return;
}
// init controller
if (controller == null) {
controller = new SNESController(this);
controller.setListener(this);
}
findViewById(R.id.snes).setVisibility(View.VISIBLE);
mNavMethod = eNavMethod.PANEL;
}
public boolean isPortrait() {
return getWindowManager().getDefaultDisplay().getOrientation() == 0;
}
/**
* This will set the size of the image view
*
* @param w
* @param h
*/
private void setImageSize(int w, int h) {
LayoutParams lp = mView.getLayoutParams();
lp.width = w;
lp.height = h;
}
Other tasks handled by Listing 6-2 include the following:
It initializes the movement controller, setting WolfLauncher as the listener for
controller events. It makes the controller visible, and sets the navigation method
to PANEL . (see the section titled Movement Controller for more details on this
class):
Search WWH ::




Custom Search