@Override
	public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException {
		Input in = gc.getInput();
		float mouseX = in.getMouseX();
		float mouseY = in.getMouseY();
		
		if (mouseX != lastMouseX || mouseY != lastMouseY){
			for (int i = 0; i < buttons.size();i++){
				buttons.get(i).checkMouseHover(new Vector2f(mouseX, mouseY));
			}
			lastMouseX = mouseX;
			lastMouseY = mouseY;
		}
		if (in.isMousePressed(Input.MOUSE_LEFT_BUTTON)){
			for (int i = 0; i < buttons.size();i++){
				boolean temp = buttons.get(i).checkMouseClick(new Vector2f(mouseX, mouseY), 0);
				if (temp && tf.getText().length() > 0){
					int e = buttons.get(i).getButtonID();
					Vector2f point = rm.getMap("World_1.tmx").getStartLocation();
					int x = (int) point.x;
					int y = (int) point.y;
					switch (e){
					case 0:
						p = new Player(Settings.PLAYER_X, Settings.PLAYER_Y, rm.getSprite("knight.png"), tf.getText(), CType.KNIGHT, x, y, rm.getLog());
						break;
					case 1:
						p = new Player(Settings.PLAYER_X, Settings.PLAYER_Y, rm.getSprite("mage.png"),tf.getText(), CType.MAGE, x, y,rm.getLog());
						break;
					case 2:
						p = new Player(Settings.PLAYER_X, Settings.PLAYER_Y, rm.getSprite("thief.png"),tf.getText(), CType.THIEF,x,y,rm.getLog());
						break;
					}
					am = new AtlasMain(p,rm,2);
					sbg.addState(am);
					am.init(gc, sbg);
					sbg.enterState(2);
				}
			}
		}
		if (in.isKeyPressed(Input.KEY_ESCAPE)){
			System.exit(0);
		}
		
	}