package rpgEngine.Logic.Camera;

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;

import rpgEngine.Resources.FontPool;
import rpgEngine.Resources.ImagePool;
import rpgEngine.UI.TitlePanel;

public class TitleCamera extends GenericCamera {
	private TitlePanel panel;
	
	public TitleCamera(TitlePanel p) {
		super();
		
		panel = p;
	}

	@Override
	public BufferedImage getImage() {
		BufferedImage img = null;
		Graphics2D g = null;
		Integer width = 800;
		Integer height = 600;
		Integer cursorPos = 0;
		
		img = new BufferedImage(800,600,BufferedImage.TYPE_INT_RGB);
		
		g = img.createGraphics();
		
		//Draw Background
		g.setColor(Color.BLACK);
		g.fillRect(0, 0, width, height);		
		g.drawImage(ImagePool.getInstance().getPoolItem(ImagePool.ID_TITLE_BACKGROUND),0,0,width,height,null);
		
		//Draw Title
		//g.setColor(Color.WHITE);
		//g.setFont(FontPool.getInstance().getPoolItem(FontPool.FONT_MINECRAFT).deriveFont(Font.BOLD,60));
		//g.drawString("RPG ENGINE", (width/2)-210, (height/3));
		
		//Draw Menu Choices
		g.setColor(Color.WHITE);
		g.setFont(FontPool.getInstance().getPoolItem(FontPool.FONT_MINECRAFT).deriveFont(Font.BOLD,24));
		g.drawString("New Game", (width/2)-64, (height/3)+100);
		g.drawString("Load Game", (width/2)-67, (height/3)+130);
		g.drawString("Quit", (width/2)-28, (height/3)+160);
		
		//Draw Cursor Position
		cursorPos = panel.getCursorPosition();
		
		if(cursorPos == TitlePanel.CURSOR_NEWGAME) {
			g.fillRect((width/2)-90, (height/3)+84, 16, 16);
		}
		else if(cursorPos == TitlePanel.CURSOR_LOADGAME) {
			g.fillRect((width/2)-90, (height/3)+114, 16, 16);
		}
		else if(cursorPos == TitlePanel.CURSOR_QUIT) {
			g.fillRect((width/2)-90, (height/3)+144, 16, 16);
		}
		
		return img;
	}
	
	
}
