OmokGame.java :  » Game » cluandroidteam » com » show » omokgame » Android Open Source

Android Open Source » Game » cluandroidteam 
cluandroidteam » com » show » omokgame » OmokGame.java
package com.show.omokgame;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Toast;

public class OmokGame extends Activity implements OnClickListener {
  
  public static final int BLACK = 0;
  public static final int WHITE = 1;
  public static final int boardSizeX = 15;  // size of the board 15x15
  public static final int boardSizeY = 15;
  
  // options global variables
  int diffLevel = 0;  // AI difficulty level
  boolean isSoundOn = false;  // see if the sound is set to on or off
  int[][] arBoard = new int[boardSizeX][boardSizeY];  // actuall game board grid
  
  //Player player1 = new Player();
  //Player player2 = new Player();
   
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);  // shows main title
        
        // registers onclicklistener to each button
        View continueButton = findViewById(R.id.continue_button);
        continueButton.setOnClickListener(this);
        View newButton = findViewById(R.id.gamestart_button);
        newButton.setOnClickListener(this);
        View optionButton = findViewById(R.id.options_button);
        optionButton.setOnClickListener(this);
        View aboutButton = findViewById(R.id.about_button);
        aboutButton.setOnClickListener(this);
        View exitButton = findViewById(R.id.exit_button);
        exitButton.setOnClickListener(this);
       
        
                
    }
    
    public void onClick(View v)
    {
      switch(v.getId())
      {
      case R.id.about_button:
        Intent i = new Intent(OmokGame.this, about.class);
        //try{
        startActivity(i);
        /*} catch(Exception e){
          Toast.makeText(this, "start activity  ", Toast.LENGTH_LONG).show();
        }*/
        break;
      /*case R.id.gamestart_button:
        Intent g = new Intent(this, GameStart.class);
        startActivity(g);
        break;*/
      case R.id.options_button:
        Intent h = new Intent(this, Options.class);
        startActivity(h);
        break;
      case R.id.exit_button:
        // ends the program and exits to the home screen
        break;
      case R.id.continue_button:
        // continues an unfinised game
        break;
      }
    }
   
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.