// Jason Brillante "Damdoshi"
// Hanged Bunny Studio 2014-2015
//
// Sewer Glue

#include		"SewerGlue.hpp"
#include		"Menu.hpp"

bool			hbs::Menu::Event(const sf::Event		&event)
{
  if (warping || arriving)
    return (false);
  if (event.type == sf::Event::KeyPressed)
    {
      if (event.key.code == sf::Keyboard::Escape)
	{
	  warping = true;
	  destination = hbs::SewerGlue::LAST_KLONDIKE;
	  warp_animation = 0;
	}
      if (intro_step >= 6)
	{
	  if (event.key.code == sf::Keyboard::Return)
	    {
	      if (cursor == 0)
		{
		  sg->module[hbs::SewerGlue::INGAME]->Reset();
		  warping = true;
		  destination = hbs::SewerGlue::INGAME;
		  warp_animation = 0;
		}
	      else if (cursor == 1)
		{
		  sg->module[hbs::SewerGlue::INTRO]->Reset();
		  theme.stop();
		  warping = true;
		  destination = hbs::SewerGlue::INTRO;
		  warp_animation = 0;
		}
	      else
		{
		  warping = true;
		  destination = hbs::SewerGlue::LAST_KLONDIKE;
		  warp_animation = 0;
		}
	    }
	  else if (event.key.code == sf::Keyboard::Up)
	    cursor = cursor > 0 ? cursor - 1 : 0;
	  else if (event.key.code == sf::Keyboard::Down)
	    cursor = cursor < 2 ? cursor + 1 : 2;
	}
    }
  return (false);
}

