bool MenuShopIntro::initWithDialogueAndResponses(std::string npcName, std::string npcDialogue)
{
    m_bChoiceMade = false;
    
    m_pMenu = Menu::create();
    CreateMenuButtons();
    this->addChild(m_pMenu, 0);
    m_pMenu->setVisible(false);
    
    return ChatBox::initWithDialogue(npcName, npcDialogue);
}
// call this method in the main menu scene to create the main menu
void TavernFoyerController::CreateMainMenu(TavernFoyer *that, Size visibleSize, Vec2 origin)
{
    log("You Went to the EIS Foyer");
    
    // create the a vector to hold the menu items
    cocos2d::Vector<cocos2d::MenuItem*> pMenuItems = CreateMenuButtons(that, visibleSize, origin);
    
    // create menu, it's an autorelease object
    auto menu = Menu::createWithArray(pMenuItems);
    menu->setPosition(Vec2::ZERO);
    that->addChild(menu, 3);
    
    // add "MenuScene" splash screen"
    auto sprite = Sprite::create("Tavern_background.png");
    
    // position the sprite on the center of the screen
    sprite->setPosition(Point(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));
    
    // add the sprite as a child to this layer
    that->addChild(sprite, 0);
    
    auto sBubble = Sprite::create("NPC/speech_small2.png");
    sBubble->setPosition(Vec2(visibleSize.width/2 + origin.x - 110, visibleSize.height/2 + origin.y + 155 ));
    sBubble->setScaleX(-1.0f);
    sBubble->setScaleY(.9);
    sBubble->setName("sBubble");
    sBubble->setVisible(false);
    that->addChild(sBubble, 11);
    
    auto introText = ui::Text::create("Hey! You're too\nyoung to be in\nhere!\nScram kid!", "Arial", 30);
    introText->setPosition(Vec2(visibleSize.width/2 + origin.x - 100, visibleSize.height/2 + origin.y + 160 ));
    introText->setColor(Color3B::BLACK);
    introText->setName("Text");
    introText->setVisible(false);
    that->addChild(introText, 11);
    
    Sprite* barCounter = Sprite::create("Tavern_bar.png");
    barCounter->setPosition(Vec2(origin.x + visibleSize.width / 2 - 300, origin.y + visibleSize.height / 2 - 40 ));
    that->addChild(barCounter, 10);
    
    Sprite* barTable = Sprite::create("Tavern_table.png");
    barTable->setPosition(Vec2(origin.x + visibleSize.width / 2 + 260, origin.y + visibleSize.height / 2 - 80));
    that->addChild(barTable,2);
    
    Sprite* barCouches = Sprite::create("Tavern_couches2.png");
    barCouches->setPosition(Vec2(origin.x + visibleSize.width / 2 + 260, origin.y + visibleSize.height / 2 + 10));
    that->addChild(barCouches,1);
    
    

}
Beispiel #3
0
main(int argc, char **argv)
{
    XtAppContext appContext;
    Arg args[20];
    int n;

    Widget toplevel, mainWindow, spinContainer, comboContainer, menuContainer;
    
    toplevel = XtAppInitialize(&appContext, ApplicationClass, NULL, 0,
						&argc, argv, NULL, NULL, 0);

    n = 0;
    XtSetArg(args[n], XmNorientation, XmHORIZONTAL); n++;
    XtSetArg(args[n], XmNspacing, 40); n++;
    mainWindow = XmCreateWorkArea(toplevel, "mainWindow", args, n);
    XtManageChild(mainWindow);

    n = 0;
    XtSetArg(args[n], XmNspacing, 20); n++;
    spinContainer = XmCreateWorkArea(mainWindow, "spinContainer", args, n);
    XtManageChild(spinContainer);
    CreateSpinBoxes(spinContainer);

    n = 0;
    XtSetArg(args[n], XmNspacing, 20); n++;
    comboContainer = XmCreateWorkArea(mainWindow, "comboContainer", args, n);
    XtManageChild(comboContainer);
    CreateComboBoxes(comboContainer);

    n = 0;
    XtSetArg(args[n], XmNspacing, 20); n++;
    menuContainer = XmCreateWorkArea(mainWindow, "menuContainer", args, n);
    XtManageChild(menuContainer);
    CreateMenuButtons(menuContainer);

    XtRealizeWidget(toplevel);
    XtAppMainLoop(appContext);
}
// call this method in the main menu scene to create the main menu
void EIS_Hallway_Controller::CreateMainMenu(EIS_Hallway *that, Size visibleSize, Vec2 origin)
{
    log("You Went to the EIS Hallway");
    
    // create the a vector to hold the menu items
    cocos2d::Vector<cocos2d::MenuItem*> pMenuItems = CreateMenuButtons(that, visibleSize, origin);
    
    // create menu, it's an autorelease object
    auto menu = Menu::createWithArray(pMenuItems);
    menu->setPosition(Vec2::ZERO);
    menu->setName("menu");
    that->addChild(menu, 1);
    
    // add "MenuScene" splash screen"
    auto sprite = Sprite::create("EIS_Rooms.png");
    
    // position the sprite on the center of the screen
    sprite->setPosition(Point(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));
    
    // add the sprite as a child to this layer
    that->addChild(sprite, 0);
    
    // add labels for the doors
    auto lectLabel = Label::createWithSystemFont("Lecture", "Verdana", 20);
    auto tutLabel = Label::createWithSystemFont("Tutorial", "Verdana", 20);
    
    lectLabel->setColor(Color3B(0, 0, 0));
    tutLabel->setColor(Color3B(0, 0, 0));
    
    lectLabel->setPosition(Vec2(visibleSize.width * .54, visibleSize.height * 0.5));
    tutLabel->setPosition(Vec2(visibleSize.width * .15, visibleSize.height * 0.5));
    
    that->addChild(lectLabel, 5);
    that->addChild(tutLabel, 5);
    
    
}
// call this method in the main menu scene to create the main menu
void LibraryRoomsController::CreateMainMenu(LibraryRooms *that, Size visibleSize, Vec2 origin)
{
    log("You Went to the Library Meeting Rooms");
    
    // create the a vector to hold the menu items
    cocos2d::Vector<cocos2d::MenuItem*> pMenuItems = CreateMenuButtons(that, visibleSize, origin);
    
    // create menu, it's an autorelease object
    auto menu = Menu::createWithArray(pMenuItems);
    menu->setPosition(Vec2::ZERO);
    menu->setName("menu");
    that->addChild(menu, 1);
    
    // add "MenuScene" splash screen"
    auto sprite = Sprite::create("Library_Rooms.png");
    
    // position the sprite on the center of the screen
    sprite->setPosition(Point(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));
    
    // add the sprite as a child to this layer
    that->addChild(sprite, 0);
    
    // add labels to the doors
    auto solo = Label::createWithSystemFont("Study", "verdana", 20);
    auto group = Label::createWithSystemFont("Group", "verdana", 20);
    
    solo->setColor(Color3B(0, 0, 0));
    group->setColor(Color3B(0, 0, 0));
    
    solo->setPosition(Vec2(visibleSize.width * 0.13, visibleSize.height * 0.6));
    group->setPosition(Vec2(visibleSize.width * 0.87, visibleSize.height * 0.6));
    
    that->addChild(solo, 2);
    that->addChild(group, 2);
    
}