GameOverMenu::MenuResult GameOverMenu::show(sf::RenderWindow& window)
{
    //Setup clickable regions

    //Play playAgain item coordinates
    MenuItem playAgainButton;
    playAgainButton.rect.top = 482;
    playAgainButton.rect.height = 547;
    playAgainButton.rect.left = 153;
    playAgainButton.rect.width = 350;
    playAgainButton.action = PlayAgain;

    //Exit menuButton item coordinates
    MenuItem menuButton;
    menuButton.rect.top = 571;
    menuButton.rect.height = 636;
    menuButton.rect.left = 153;
    menuButton.rect.width = 350;
    menuButton.action = Menu;

    //add all the buttons to the list of menuItems
    menuItems.push_back(playAgainButton);
    menuItems.push_back(menuButton);

    return GetMenuResponse(window); //return the action of the button clicked on
}
Exemplo n.º 2
0
MainMenu::MenuResult MainMenu::Show(sf::RenderWindow& renderWindow)
{
	sf::Texture texture;
	texture.loadFromFile("images/menu.png");

	sf::Sprite sprite(texture);

	MenuItem playButton;
	playButton.rect.top = 145;
	playButton.rect.left = 0;
	playButton.rect.width = 1023;
	playButton.rect.height = 235;
	playButton.action = Play;

	MenuItem exitButton;
	playButton.rect.top = 383;
	playButton.rect.left = 0;
	playButton.rect.width = 1023;
	playButton.rect.height = 235;
	playButton.action = Exit;

	menuItems.push_back(playButton);
	menuItems.push_back(exitButton);

	renderWindow.draw(sprite);
	renderWindow.display();

	return GetMenuResponse(renderWindow);
}
Exemplo n.º 3
0
MainMenu::MenuResult MainMenu::Show(sf::RenderWindow& window)
{

  //Load menu image from file
  sf::Image image;
  image.LoadFromFile("images/mainmenu.png");
  sf::Sprite sprite(image);

  //Setup clickable regions

  //Play menu item coordinates
  MenuItem playButton;
  playButton.rect.Top= 145;
  playButton.rect.Bottom = 380;
  playButton.rect.Left = 0;
  playButton.rect.Right = 1023;
  playButton.action = Play;

  //Exit menu item coordinates
  MenuItem exitButton;
  exitButton.rect.Left = 0;
  exitButton.rect.Right = 1023;
  exitButton.rect.Top = 383;
  exitButton.rect.Bottom = 560;
  exitButton.action = Exit;
 
  _menuItems.push_back(playButton);
  _menuItems.push_back(exitButton);
 
  window.Draw(sprite);
  window.Display();

  return GetMenuResponse(window);
}
Exemplo n.º 4
0
MainMenu::MenuResult MainMenu::Show(sf::RenderWindow& window)
{ 
	//Load menu image from file
	sf::Texture image;
	image.loadFromFile("assets/images/mainMenu-background.png");
	sf::Sprite sprite(image);
 
	//Setup clickable regions
 
	//Play menu item coordinates
	MenuItem playButton;
	playButton.rect.top= 200;
	playButton.rect.height= 100;
	playButton.rect.left = 0;
	playButton.rect.width = 800;
	playButton.action = Play;
 
	//Exit menu item coordinates
	MenuItem exitButton;
	exitButton.rect.left = 0;
	exitButton.rect.width = 600;
	exitButton.rect.top = 400;
	exitButton.rect.height = 100;
	exitButton.action = Exit;
 
	_menuItems.push_back(playButton);
	_menuItems.push_back(exitButton);
 
	window.draw(sprite);
	window.display();
 
	return GetMenuResponse(window);
}
Exemplo n.º 5
0
TitleMenu::MenuResult TitleMenu::Show(sf::RenderWindow &window)
{
  // Load menu items from an image
  sf::Texture title_image;
  title_image.loadFromFile(image_path);
  sf::Sprite title_sprite(title_image);

  // Set up click able regions

  // Play menu item coordinates
  MenuItem playButton;
  playButton.rect.left = 0;
  playButton.rect.width = 1023;
  playButton.rect.top = 130;
  playButton.rect.height = 220;
  playButton.action = ePlay;

  // Exit menu item coordinates
  MenuItem exitButton;
  exitButton.rect.left = 0;
  exitButton.rect.width = 1023;
  exitButton.rect.top = 350;
  exitButton.rect.height = 167;
  exitButton.action = eExit;

  _menuItems.push_back(playButton);
  _menuItems.push_back(exitButton);

  window.draw(title_sprite);
  window.display();

  return GetMenuResponse(window);
}
Exemplo n.º 6
0
// TerminalMenuManager
// Control routine for operating the menu.
// 
// Parameters: None
// Generate menu
// output menu
// prompt for valid selection
// do action of selection
// until done.
int Menu::TerminalMenuManager() {
  
  char* pMenuBuffer = NULL;
  boolean bDone = false;
  int iMenuResponse, iActionID;
  while (!bDone) {

    pMenuBuffer = (char*) malloc(150);
    GenerateMenu(pMenuBuffer, 150,true);
    Serial << endl << pMenuBuffer;
    free(pMenuBuffer);
    
    gBuffer[0] = GetMenuResponse( GetBuffer_P(STI_MENU_PROMPT_1000, gBuffer, ENTRY_FIELD_SIZE) ,9); 
    gBuffer[1] = '\0';
    iMenuResponse = atoi(gBuffer);
    iActionID = paMenuActions[iMenuResponse];
    
    PerformAction(iActionID);
    if (iCurrentMenu < MENU_MAIN ) {
      bDone = true;
    }
    
    
  }
}
Exemplo n.º 7
0
MainMenu::MenuResult MainMenu::Show(sf::RenderWindow & window) {
    sf::Texture texture;
    if (!texture.loadFromFile("img/mainMenu.png"))
        std::cout << "Error loading main menu image\n";
    sf::Sprite sprite(texture);

    // Play menu item coordinates
    MenuItem play_button;
    play_button.rect.top= 145;
    play_button.rect.height = 380;
    play_button.rect.left = 0;
    play_button.rect.width = 1023;
    play_button.action = Play;
    play_button.alt_key = sf::Keyboard::S;

    // Exit menu item coordinates
    MenuItem exit_button;
    exit_button.rect.left = 0;
    exit_button.rect.height = 1023;
    exit_button.rect.top = 383;
    exit_button.rect.width = 560;
    exit_button.action = Exit;
    exit_button.alt_key = sf::Keyboard::Escape;

    _menu_items.push_back(play_button);
    _menu_items.push_back(exit_button);

    window.clear();
    window.draw(sprite);
    window.display();

    return GetMenuResponse(window);
}
Exemplo n.º 8
0
MainMenu::MenuResult MainMenu::Show(sf::RenderWindow& window)
{
	//Load menu image from file
	//sf::Image image;
	//image.loadFromFile("images/mainmenu.png");
	sf::Texture texture;
	texture.loadFromFile("images/mainmenu.png");
	sf::Sprite sprite(texture);

	//Setup clickable regions

	//Play menu item coordinates
	MenuItem playButton;
	playButton.rect.top = 145;
	playButton.rect.left = 0;
	playButton.rect.height = 380 - playButton.rect.top;
	playButton.rect.width = 1023 - playButton.rect.left;
	playButton.action = Play;

	//Exit menu item coordinates
	MenuItem exitButton;
	exitButton.rect.top = 383;
	exitButton.rect.left = 0;
	exitButton.rect.height = 560 - exitButton.rect.top;
	exitButton.rect.width = 1023 - exitButton.rect.left;
	exitButton.action = Exit;

	_menuItems.push_back(playButton);
	_menuItems.push_back(exitButton);

	window.draw(sprite);
	window.display();

	return GetMenuResponse(window);
}
Exemplo n.º 9
0
void PauseMenu::Loop()
{
    _rw->draw(_sprite);
    _rw->display();

    switch(GetMenuResponse(*_rw))
    {
        case PauseMenu::Exit:
            Game::StateStack()->Clear();
            break;
        case PauseMenu::Play:
            Game::StateStack()->Pop();
            break;
        case PauseMenu::Nothing:
            break;
    }
}
Exemplo n.º 10
0
void MainMenu::Loop()
{
    _rw->draw(_sprite);
    _rw->display();

    switch(GetMenuResponse(*_rw))
    {
        case MainMenu::Exit:
            Game::StateStack()->Clear();
            break;
        case MainMenu::Play:
            Game::StateStack()->Pop();
            Game::StateStack()->Push(new PlayScreen(_rw));
            break;
        case MainMenu::Nothing:
            break;
    }
}
MainMenu::MenuResult MainMenu::Show(sf::RenderWindow& window)
{

	//Load menu image from file
	sf::Image image;
	image.LoadFromFile("images/MainScreen.png");
	sf::Sprite sprite(image);

	//Setup clickable regions

	//Play menu item coordinates
	MenuItem playButton1;
	playButton1.rect.Top= 35;
	playButton1.rect.Bottom =103;
	playButton1.rect.Left = 35;
	playButton1.rect.Right = 367;
	playButton1.action = Play1;

	MenuItem playButton2;
	playButton2.rect.Top= 130;
	playButton2.rect.Bottom = 198;
	playButton2.rect.Left = 35;
	playButton2.rect.Right = 367;
	playButton2.action = Play2;

	//Exit menu item coordinates
	MenuItem helpButton;
	helpButton.rect.Top = 213;
	helpButton.rect.Bottom = 282;
	helpButton.rect.Left = 35;
	helpButton.rect.Right = 367;
	helpButton.action = Help;

	_menuItems.push_back(playButton1);
	_menuItems.push_back(playButton2);
	_menuItems.push_back(helpButton);

	window.Draw(sprite);
	window.Display();

	return GetMenuResponse(window);
}
Exemplo n.º 12
0
MainMenu::MenuResult MainMenu::Show(sf::RenderWindow& window) {

	//Load menu image from file
	sf::Texture texture;
	texture.loadFromFile("images/MainMenu.png");
	sf::Sprite sprite(texture);
	window.draw(sprite);

	//load gambar peti
	texture.loadFromFile("images/chest1.png");
	sf::Sprite sprite2(texture);
	sprite2.setPosition(400, 250);
	window.draw(sprite2);

	//load gambar orang
	texture.loadFromFile("images/hunter1.png");
	sf::Sprite sprite3(texture);
	sprite3.setPosition(270, 350);
	window.draw(sprite3);

	//load gambar kaki
	texture.loadFromFile("images/footprints1.png");
	sf::Sprite sprite4(texture);
	sprite4.setPosition(100, 250);
	window.draw(sprite4);
	sprite4.setPosition(160, 350);
	window.draw(sprite4);
	sprite4.setPosition(220, 430);
	window.draw(sprite4);

	//Play menu item coordinates
	MenuItem PlayButton;
	PlayButton.texture.loadFromFile("images/PlayButton.png");
	PlayButton.sprite.setTexture(PlayButton.texture);
	PlayButton.sprite.setPosition(840,325);
	PlayButton.action = Play;
	window.draw(PlayButton.sprite);

	//Credit menu item coordinates
	MenuItem CreditsButton;
	CreditsButton.texture.loadFromFile("images/CreditsButton.png");
	CreditsButton.sprite.setTexture(CreditsButton.texture);
	CreditsButton.sprite.setPosition(840,405);
	CreditsButton.action = Credits;
	window.draw(CreditsButton.sprite);

	//Exit menu item coordinates
	MenuItem ExitButton;
	ExitButton.texture.loadFromFile("images/ExitButton.png");
	ExitButton.sprite.setTexture(ExitButton.texture);
	ExitButton.sprite.setPosition(840,485);
	ExitButton.action = Exit;
	window.draw(ExitButton.sprite);
	window.display();

	_menuItems.push_back(PlayButton);
	_menuItems.push_back(CreditsButton);
	_menuItems.push_back(ExitButton);

	return GetMenuResponse(window);
}