package com.uoc.educationalVG.memorycon;

import java.util.List;

import com.uoc.educationalVG.framework.Game;
import com.uoc.educationalVG.framework.Graphics;
import com.uoc.educationalVG.framework.Input.TouchEvent;
import com.uoc.educationalVG.utils.Assets;
import com.uoc.educationalVG.utils.Settings;

/**
 * @author "Beginning Android 4 Games Development"
 * @author (adapted by Sergi Colina)
 * 
 */
public class IntroScreen extends GameScreen {

	 public IntroScreen(Game game) {
	        super(game);
	 }   
	
	 @Override
	    public void update(float deltaTime) {
	        List<TouchEvent> touchEvents = game.getInput().getTouchEvents();
	        game.getInput().getKeyEvents();       
	        
	        int len = touchEvents.size();
	        for(int i = 0; i < len; i++) {
	            TouchEvent event = touchEvents.get(i);
	            if(event.type == TouchEvent.TOUCH_UP) {	//touch on screen
	            	
	            	if(inBounds(event, 120, 440, 80, 30) ) { //touch on "tornar"
	            		game.setScreen(new MainMenuScreen(game));
	                    if(Settings.isSoundEnabled())
	                        Assets.getClick().play(1);
	                    return;
	                }
	            }
	        }
	    }
	    
	   
	    @Override
	    public void present(float deltaTime) {
	        Graphics g = game.getGraphics();
	        
	        g.drawPixmap(Assets.getIntroScreen(), 0, 0);
	    }

	    @Override
	    public void pause() {        

	    }

	    @Override
	    public void resume() {

	    }

	    @Override
	    public void dispose() {

	    }
	}

