package com.example.super_duckhunt;

import android.app.Activity;
import android.app.Dialog;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;

public class Start extends Activity implements OnClickListener {
	MediaPlayer ob;
	Dialog d;
	public boolean music=true;
	int i=0;
ImageButton rule,play,exit,info;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.start);
		 rule=(ImageButton)findViewById(R.id.rule);
		 play=(ImageButton)findViewById(R.id.game);
		 exit=(ImageButton)findViewById(R.id.close);
		
		 info=(ImageButton)findViewById(R.id.info);
		 rule.setOnClickListener(this);
		 play.setOnClickListener(this);
		 exit.setOnClickListener(this);
		 info.setOnClickListener(this);
		
		 ob=MediaPlayer.create(Start.this,R.raw.start);
		 if(music==true && i==0){
		 ob.start();		 
		}
		
			
		
	}
	public void onClick(View v) {
		// TODO Auto-generated method stub
		
		 if(v.equals(info)){
			Intent i=new Intent("android.intent.action.INFO");
			ob.release();
			startActivity(i);
		}else if(v.equals(exit)){
			System.exit(0);
			ob.release();
		}else if(v.equals(play)){
			Intent i=new Intent("android.intent.action.GENDER");
			ob.stop();
		
			
			startActivity(i);
		}else if(v.equals(rule)){
		Intent i=new Intent("android.intent.action.RULE");
	
		startActivity(i);

			ob.release();
		}
    
	}}
