The open source repository for the action RPG game in development by Sig Productions titled 'Adventures in Lestoria'!
https://forums.lestoria.net
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
1.8 KiB
67 lines
1.8 KiB
#include "Crawler.h"
|
|
#include "Menu.h"
|
|
#include "DEFINES.h"
|
|
#include "olcPixelGameEngine.h"
|
|
#include "safemap.h"
|
|
#include "MenuIconButton.h"
|
|
#include "MenuLabel.h"
|
|
|
|
INCLUDE_GFX
|
|
typedef Attribute A;
|
|
|
|
const Menu Menu::InitializeTestSubMenu(){
|
|
Menu testSubMenu({30,30},{24*4,24*5});
|
|
|
|
MenuFunc goBack=[](Menu&menu,Crawler*game){
|
|
menu.stack.pop_back();
|
|
};
|
|
|
|
testSubMenu.AddComponent("BACK",new MenuComponent({{24*1,24*1},{24*2,24*1}},"Go Back",goBack));
|
|
|
|
int index=0;
|
|
for(auto&theme:Menu::themes){
|
|
if(theme.displayName==Menu::themeSelection){
|
|
testSubMenu.I(A::INDEXED_THEME)=index;
|
|
break;
|
|
}
|
|
index++;
|
|
}
|
|
|
|
MenuFunc themePrev=[](Menu&menu,Crawler*game){
|
|
bool found=false;
|
|
menu.I(A::INDEXED_THEME)--;
|
|
if(menu.I(A::INDEXED_THEME)<0){
|
|
menu.I(A::INDEXED_THEME)=themes.size()-1;
|
|
}
|
|
int index=0;
|
|
for(auto&theme:Menu::themes){
|
|
if(index==menu.I(A::INDEXED_THEME)){
|
|
Menu::themeSelection=theme.displayName;
|
|
((MenuLabel*)(menu.components["THEME_DISPLAY"]))->SetLabel("Theme\n"+Menu::themes[themeSelection].GetThemeName());
|
|
break;
|
|
}
|
|
index++;
|
|
}
|
|
};
|
|
|
|
testSubMenu.AddComponent("PREV_THEME",new MenuComponent({{24*-0.5,24*3},{24*1,24*1}},"<",themePrev));
|
|
|
|
testSubMenu.AddComponent("THEME_DISPLAY",new MenuLabel({{24*0.5,24*3},{24*3,24*1}},"Theme\n"+Menu::themes[themeSelection].GetThemeName()));
|
|
|
|
MenuFunc themeNext=[](Menu&menu,Crawler*game){
|
|
menu.I(A::INDEXED_THEME)=(size_t(menu.I(A::INDEXED_THEME))+1)%themes.size();
|
|
int index=0;
|
|
for(auto&theme:Menu::themes){
|
|
if(index==menu.I(A::INDEXED_THEME)){
|
|
Menu::themeSelection=theme.displayName;
|
|
((MenuLabel*)(menu.components["THEME_DISPLAY"]))->SetLabel("Theme\n"+Menu::themes[themeSelection].GetThemeName());
|
|
break;
|
|
}
|
|
index++;
|
|
}
|
|
};
|
|
|
|
testSubMenu.AddComponent("NEXT_THEME",new MenuComponent({{24*3.5,24*3},{24*1,24*1}},">",themeNext));
|
|
|
|
return testSubMenu;
|
|
} |