124 |
void draw_background(px::GC &gc); |
void draw_background(px::GC &gc); |
125 |
private: |
private: |
126 |
vector<Widget *> buttons; |
vector<Widget *> buttons; |
127 |
|
Widget *back; |
128 |
}; |
}; |
129 |
|
|
130 |
class MainMenu : public Menu { |
class MainMenu : public Menu { |
665 |
|
|
666 |
LevelPackMenu::LevelPackMenu() |
LevelPackMenu::LevelPackMenu() |
667 |
{ |
{ |
668 |
BuildVList b(this, Rect(0,0,150,40), 5); |
//BuildVList vlist(this, Rect(510,400,100,28), 5); |
669 |
|
//vlist.add( new TextButton("Back", this)); |
670 |
|
|
671 |
|
BuildVList b(this, Rect((640-150)/2,200,150,40), 5); |
672 |
|
|
673 |
for (unsigned i=0; i<enigma::LevelPacks.size(); ++i) { |
for (unsigned i=0; i<enigma::LevelPacks.size(); ++i) { |
674 |
LevelPack *lp = enigma::LevelPacks[i]; |
LevelPack *lp = enigma::LevelPacks[i]; |
675 |
|
if( lp->levels.size() > 0) |
676 |
buttons.push_back(b.add(new TextButton(lp->name, this))); |
buttons.push_back(b.add(new TextButton(lp->name, this))); |
677 |
} |
} |
678 |
|
|
679 |
|
BuildVList vlist(this, Rect(510,433,100,28), 5); |
680 |
|
back = new TextButton("Back", this); |
681 |
|
vlist.add( back); |
682 |
} |
} |
683 |
|
|
684 |
void |
void |
690 |
m.manage(video::GetScreen()); |
m.manage(video::GetScreen()); |
691 |
invalidate_all(); |
invalidate_all(); |
692 |
} |
} |
693 |
|
|
694 |
|
if( w == back) |
695 |
|
Menu::quit(); |
696 |
} |
} |
697 |
|
|
698 |
void |
void |
713 |
MainMenu::MainMenu() |
MainMenu::MainMenu() |
714 |
{ |
{ |
715 |
BuildVList b(this, Rect((640-150)/2,200,150,40), 5); |
BuildVList b(this, Rect((640-150)/2,200,150,40), 5); |
716 |
newgame = 0; //b.add(new TextButton("New Game", this)); |
if (enigma::LevelPacks.size() > 2) { |
717 |
playenigma = b.add(new TextButton("Play Enigma", this)); |
newgame = b.add(new TextButton("New Game", this)); |
718 |
playoxyd = b.add(new TextButton("Play Oxyd & Co", this)); |
playenigma = 0; |
719 |
|
playoxyd = 0; |
720 |
|
} else { |
721 |
|
newgame = 0; |
722 |
|
playenigma = b.add(new TextButton("Play Enigma", this)); |
723 |
|
playoxyd = b.add(new TextButton("Play Oxyd & Co", this)); |
724 |
|
} |
725 |
leveled = 0; //b.add(new TextButton("Editor", this)); |
leveled = 0; //b.add(new TextButton("Editor", this)); |
726 |
options = b.add(new TextButton("Options", this)); |
options = b.add(new TextButton("Options", this)); |
727 |
credits = b.add(new TextButton("Credits", this)); |
credits = b.add(new TextButton("Credits", this)); |
749 |
{ |
{ |
750 |
if (w == newgame) { |
if (w == newgame) { |
751 |
LevelPackMenu m; |
LevelPackMenu m; |
752 |
m.center(video::GetScreen()); |
//m.center(video::GetScreen()); |
753 |
m.manage(video::GetScreen()); |
m.manage(video::GetScreen()); |
754 |
} |
} |
755 |
else if (w == playenigma) { |
else if (w == playenigma) { |