package edu.smcm.gamedev.butterseal;

import java.util.HashMap;
import java.util.Map;

import com.badlogic.gdx.Input;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.math.Rectangle;

/**
 * Contains program logic for the user interface.
 * 
 * This class handles such things as
 *   the pause menu,
 *   the directional pad,
 *   and power selection.
 * 
 * @author Sean
 *
 */
public class BSInterface {
	BSSession session;
	SpriteBatch batch;
	AssetManager assets;
	Map<Rectangle, Runnable> activeRegions;
	
	public BSInterface(BSSession session, SpriteBatch batch, AssetManager assets) {
		this.session = session;
		this.batch = batch;
		this.assets = assets;
		this.activeRegions = new HashMap<Rectangle, Runnable>();
	}
	
	/**
	 * Polls the given {@link Input} for valid player interaction
	 *   and handles it appropriately. 
	 * @param input
	 */
	public void poll(Input input) {
		
	}
	
	/**
	 * Draws the interface on the screen.
	 */
	public void draw() {
		/* If the game is in session, make the major interface elements.
		 * If the game is additionally paused, handle that as well.
		 * 
		 * If we are not in a game, then draw the title screen.
		 */
		
		if (session.isInGame) {
			MakePowerBar();
			MakePowerSelector();
			MakeDirectionalPad();
			MakePauseButton();

			if (session.isPaused) {
				MakePauseScreen();
			}
		} else {
			MakeTitleScreen();
		}
	}

	private void MakePowerBar() {
		
	}
	
	private void MakePowerSelector() {
		
	}
	
	private void MakeDirectionalPad() {
		
	}
	
	/**
	 * Dims the screen and displays the pause menu
	 */
	private void MakePauseButton() {
		
	}
	
	private void MakePauseScreen() {
		
	}
	
	private void MakeTitleScreen() {
		//batch.draw(region, x, y, originX, originY, width, height, scaleX, scaleY, rotation)
	}
}

@@ -777,188 +777,899 @@
 le, 
-Runnable%3E();%0A%09%7D%0A%09%0A%09/**%0A%09 * Polls the given %7B@link Input%7D for valid player interaction%0A%09 *   and handles it appropriately. %0A%09 * @param input%0A%09 */%0A%09public void poll(Input input) %7B%0A%09%09
+BSGameStateActor%3E();%0A%09%09%0A%09%09// test active region%0A%09%09activeRegions.put(new Rectangle().set(0, 0, 100, 100), new BSGameStateActor() %7B%0A%09%09%09@Override%0A%09%09%09public void act(BSPlayer player) %7B%0A%09%09%09%09// TODO Auto-generated method stub%0A%09%09%09%09System.out.println(%22test%22);%0A%09%09%09%7D%0A%09%09%7D);%0A%09%7D%0A%09%0A%09/**%0A%09 * Polls the given %7B@link Input%7D for valid player interaction%0A%09 *   and handles it appropriately. %0A%09 * @param input%0A%09 */%0A%09public void poll(Input input) %7B%0A%09%09for(Rectangle r : activeRegions.keySet())%7B%0A%09%09%09if (isTouchingInside(input, r))%7B%0A%09%09%09%09activeRegions.get(r).act(player);%0A%09%09%09%7D%0A%09%09%7D%0A%09%7D%0A%09%0A%09/**%0A%09 * %0A%09 * @param input%0A%09 * @param region%0A%09 * @return true if input is being touched within the given region, false otherwise%0A%09 */%0A%09public boolean isTouchingInside(Input input, Rectangle region) %7B%0A%09%09int x = input.getX();%0A%09%09int y = input.getY();%0A%09%09return region.x %3C x && x %3C region.width%0A%09%09%09&& region.y %3C x && x %3C region.height;
 %0A%09%7D%0A

Implement new actor interface and touch logic