~ubuntu-branches/ubuntu/natty/balder2d/natty

« back to all changes in this revision

Viewing changes to src/menu/mainmenu.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Bjørn Hansen
  • Date: 2008-06-15 17:15:38 UTC
  • mfrom: (1.1.1 upstream) (3.1.2 hardy)
  • Revision ID: james.westby@ubuntu.com-20080615171538-e407e07wbtdy0qs8
Tags: 1.0-1
* new upstream release
* update for guichan 8.1 (Closes: #482584)
* use physicsfs to make data/config/map/aiscript loading more flexible
* new skins for menus
* fix typo in control file long description (Closes: #458401)

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
19
19
 ***************************************************************************/
20
20
 
21
 
#include "../../include/menu/menu.h"
22
 
#include "../../include/menu/mainmenu.h"
23
 
#include "../../include/menu/options.h"
 
21
#include "menu/menu.h"
 
22
#include "menu/mainmenu.h"
 
23
#include "menu/options.h"
24
24
 
25
25
using namespace Balder;
26
26
 
27
27
MainMenu::MainMenu(gcn::Container* top, Menu* menusystem):SubMenu(top),system(menusystem)
28
28
{
29
 
  page->setDimension(gcn::Rectangle(0, 0, 500, 400));
30
 
  page->setPosition(150,200);
31
 
 
32
 
  startButton = new gcn::Button("Start New Game");
33
 
  startButton->setEventId("startgame");
 
29
  startButton = new SkinnedButton("menu/buttonskins.png", 0, "Start Game");
 
30
  startButton->setActionEventId("startgame");
34
31
  startButton->addActionListener(this);
35
 
  startButton->setWidth(500);
 
32
  startButton->setWidth(300);
 
33
  startButton->setAlignment(gcn::Graphics::LEFT);
36
34
 
37
 
  optionsButton = new gcn::Button("Options");
38
 
  optionsButton->setEventId("optionsMenu");
 
35
  optionsButton = new SkinnedButton("menu/buttonskins.png", 0, "Options");
 
36
  optionsButton->setActionEventId("optionsMenu");
39
37
  optionsButton->addActionListener(this);
40
 
  optionsButton->setWidth(500);
 
38
  optionsButton->setWidth(300);
 
39
  optionsButton->setAlignment(gcn::Graphics::LEFT);
41
40
 
42
 
  quitButton = new gcn::Button("Quit");
43
 
  quitButton->setWidth(500);
44
 
  quitButton->setEventId("quitgame");
 
41
  quitButton = new SkinnedButton("menu/buttonskins.png", 0, "Quit");
 
42
  quitButton->setWidth(300);
 
43
  quitButton->setActionEventId("quitgame");
45
44
  quitButton->addActionListener(this);
 
45
  quitButton->setAlignment(gcn::Graphics::LEFT);
 
46
 
 
47
  versionLabel = new gcn::Label("Version 1.0");
46
48
 
47
49
  // Add them to the page container
48
 
  page->add(startButton, 0, 0);
49
 
  page->add(optionsButton, 0, 60);
50
 
  page->add(quitButton, 0, 180);
51
 
  
 
50
  page->add(startButton, 50, 50);
 
51
  page->add(optionsButton, 50, 100);
 
52
  page->add(quitButton, 50, 150);
 
53
  page->add(versionLabel, page->getWidth() - (50 + versionLabel->getWidth()), page->getHeight() - (50 + versionLabel->getHeight()));
 
54
 
52
55
  // create the submenus
53
56
  optionsMenu = new OptionsMenu(top, this);
54
57
}
55
58
 
56
59
MainMenu::~MainMenu()
57
60
{
58
 
    
 
61
 
59
62
}
60
63
 
61
 
void MainMenu::action(const std::string& action)
 
64
void MainMenu::action(const gcn::ActionEvent& action)
62
65
{
63
66
  // Main menu events.********************************************************
64
 
  if (action == "optionsMenu")
 
67
  if (action.getId() == "optionsMenu")
65
68
  {
66
69
    hide();
67
70
    optionsMenu->show();
68
 
  }  
 
71
  }
69
72
  else  system->action(action);
70
73
}