本文整理汇总了C++中MenuItem::SetOptionId方法的典型用法代码示例。如果您正苦于以下问题:C++ MenuItem::SetOptionId方法的具体用法?C++ MenuItem::SetOptionId怎么用?C++ MenuItem::SetOptionId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MenuItem
的用法示例。
在下文中一共展示了MenuItem::SetOptionId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitMenu
void MenuOptions::InitMenu() {
SetFont(al_load_font("arial.ttf", 30, 0));
SetMenuHeader("Options");
SetId(STATES::EDITOROPTIONS);
MenuItem* itemStore = new MenuItem;
itemStore->SetMenuItemText("Current Width:");
//might need to delete this tempval char array? mmm looks to be in stack so should die when method finishs....
char tempVal[10];
sprintf_s(tempVal, "%i", GetSettings()->GetScreenWidth());
itemStore->InitMenuItemProperty(al_ustr_new(tempVal));
itemStore->SetMenuItemTargetable(false);
AddMenuItem(itemStore);
itemStore = new MenuItem;
itemStore->InitMenuItemProperty(al_ustr_new(""));
itemStore->SetOptionId(OPTIONTYPES::WIDTHOPTION);
itemStore->SetMenuItemText("New Width:");
AddMenuItem(itemStore);
itemStore = new MenuItem;
itemStore->SetMenuItemText("Current Height:");
sprintf_s(tempVal, "%i", GetSettings()->GetScreenHeight());
itemStore->InitMenuItemProperty(al_ustr_new(tempVal));
itemStore->SetMenuItemTargetable(false);
AddMenuItem(itemStore);
itemStore = new MenuItem;
itemStore->InitMenuItemProperty(al_ustr_new(""));
itemStore->SetOptionId(OPTIONTYPES::HEIGHTOPTION);
itemStore->SetMenuItemText("New Height:");
AddMenuItem(itemStore);
itemStore = new MenuItem;
itemStore->SetId(STATES::SAVE);
itemStore->SetMenuItemText("Save");
AddMenuItem(itemStore);
itemStore = new MenuItem;
itemStore->SetId(STATES::RETURN);
itemStore->SetMenuItemText("Return");
AddMenuItem(itemStore);
SetMenuX(200);
SetMenuY(100);
SetMenuWidth(400);
SetMenuHeight(400);
SetMenuHeaderX(200);
SetMenuHeaderY(50);
SetMenuHeaderWidth(400);
SetMenuHeaderHeight(50);
int i = 0;
int xloc = 355;
int yloc = 110;
int yspacing = 50;
for(i = 0; i < GetMenuItems().size(); i++)
{
GetMenuItems()[i]->SetMenuItemX(xloc);
GetMenuItems()[i]->SetMenuItemPropertyX(400+100);
GetMenuItems()[i]->SetMenuItemY(yloc);
yloc = yloc + yspacing;
}
SetMenuHeight(yloc-GetMenuY());
SetCurrentSelection();
}