Switched menu button system to component inheritance system.
This commit is contained in:
+15
-4
@@ -1,20 +1,31 @@
|
||||
#include "Crawler.h"
|
||||
#include "Menu.h"
|
||||
#include "DEFINES.h"
|
||||
#include "olcPixelGameEngine.h"
|
||||
#include "safemap.h"
|
||||
|
||||
INCLUDE_GFX
|
||||
|
||||
const Menu Menu::InitializeTestSubMenu(){
|
||||
Menu testSubMenu({24*4,24*5});
|
||||
|
||||
MenuFunc goBack=[](Menu&menu,Crawler*game){
|
||||
MenuFunc goBack=MENUFUNC{
|
||||
menu.stack.pop_back();
|
||||
};
|
||||
|
||||
testSubMenu.AddButton(MenuButton({{24*1,24*1},{24*2,24*1}},"Go Back",nullptr,goBack));
|
||||
testSubMenu.AddComponent(new MenuComponent({{24*1,24*1},{24*2,24*1}},"Go Back",goBack));
|
||||
|
||||
MenuFunc quitWindow=[](Menu&menu,Crawler*game){
|
||||
MenuFunc quitWindow=MENUFUNC{
|
||||
menu.stack.clear();
|
||||
};
|
||||
|
||||
testSubMenu.AddButton(MenuButton({{24*1,24*3},{24*3,24*1}},"Close Window",nullptr,quitWindow));
|
||||
testSubMenu.AddComponent(new MenuComponent({{24*1,24*3},{24*3,24*1}},"Close Window",quitWindow));
|
||||
|
||||
MenuFunc restoreMana=MENUFUNC{
|
||||
game->GetPlayer()->SetMana(game->GetPlayer()->GetMaxMana());
|
||||
};
|
||||
|
||||
testSubMenu.AddComponent(new MenuIconButton({{24*0,24*3},{24*1,24*2}},GFX["mana.png"].Decal(),restoreMana));
|
||||
|
||||
return testSubMenu;
|
||||
}
|
||||
Reference in New Issue
Block a user