Game Java

package pyjioh.apps.tictactoe.activities;

import pyjioh.apps.tictactoe.R;
import pyjioh.apps.tictactoe.models.TicTacToeModel;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

public class TicTacToe extends Activity {

public static final int MENU_CONTINUE = Menu.FIRST+1;
public static final int MENU_NEW = Menu.FIRST+2;
public static final int MENU_OPTION = Menu.FIRST+3;
public static final int MENU_ABOUT = Menu.FIRST+4;
public static final int MENU_EXIT = Menu.FIRST+5;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
menu
.add(Menu.NONE, MENU_CONTINUE, Menu.NONE, "Continue")
.setIcon(R.drawable.continue_game);
menu
.add(Menu.NONE, MENU_NEW, Menu.NONE, "New Game")
.setIcon(R.drawable.new_game);
menu
.add(Menu.NONE, MENU_OPTION, Menu.NONE, "Options")
.setIcon(R.drawable.option_game);
menu
.add(Menu.NONE, MENU_ABOUT, Menu.NONE, "About")
.setIcon(R.drawable.about_game);
menu
.add(Menu.NONE, MENU_EXIT, Menu.NONE, "Exit")
.setIcon(R.drawable.exit_game);

return(super.onCreateOptionsMenu(menu));
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case MENU_CONTINUE:
startActivity(new Intent(this, Game.class));
return(true);
case MENU_NEW:
TicTacToeModel.getInstance().newGame();
startActivity(new Intent(this, Game.class));
return(true);
case MENU_OPTION:
startActivity(new Intent(this, Options.class));
return(true);
case MENU_ABOUT:
startActivity(new Intent(this, About.class));
return(true);
case MENU_EXIT:
finish();
return(true);
}

return(super.onOptionsItemSelected(item));
}
}
Share on Google Plus

About Unknown

Nama saya adalah Gifari Alfan Reza, seorang yang tak luput dari kesalahan dan juga membutuhkan orang lain dalam menjalani hidup ini karena manusia tidak sendiri. Saya yang berkeinginan bisa pergi keluar negeri itu sangat itu aku inginkan "Bersemangatlah field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 komentar:

Posting Komentar