Game Development Reference
In-Depth Information
menu.add(0, 2, 2, "Exit").setIcon(R.drawable.exit);
return true;
}
/**
* Menu actions
*/
@Override
public boolean onOptionsItemSelected(MenuItem item) {
super.onOptionsItemSelected(item);
switch (item.getItemId()) {
case 0:
// Screen size
LayoutParams lp = mView.getLayoutParams();
// 0 == prt, 1 = land
int orien = getWindowManager().getDefaultDisplay()
.getOrientation();
if (orien == 1) {
if (lp.width < 0 || lp.height < 0) {
lp.width = 480;
lp.height = 320;
return true;
}
lp.width = lp.width == 320 ? 480 : 320;
lp.height = lp.height == 200 ? 320 : 200;
} else {
DialogTool.Toast(this, "Gotta be in landscape.");
}
return true;
case 1:
// navigation method
DialogTool.showNavMethodDialog(this);
return true;
case 2:
// Exit
WolfTools.hardExit(0);
return true;
}
return false;
}
Search WWH ::




Custom Search