Exemple #1
0
Intro::Intro(const std::string& name, IFrontend* frontend) :
		UIWindow(name, frontend, WINDOW_FLAG_MODAL) {
	_onPop = CMD_START;

	_background = new UINodeIntroBackground(frontend);
	UINode *overlay = new UINode(frontend);
	overlay->setBackgroundColor(colorWhiteAlpha80);
	const float padding = 4.0f / std::max(_frontend->getWidth(), _frontend->getHeight());
	overlay->setSize(_background->getWidth() - 2.0f * padding, _background->getHeight() - 2.0f * padding);
	overlay->setPos(padding, padding);
	_background->add(overlay);
	add(_background);

	UINodeButton* close = new UINodeButton(_frontend);
	close->setImage("icon-close");
	close->setOnActivate(CMD_UI_POP);
	close->alignTo(_background, NODE_ALIGN_RIGHT | NODE_ALIGN_TOP, 0.01f);
	add(close);

	_panel = new UINode(frontend);
	_panel->setStandardPadding();
	_panel->setPos(0.0f, _background->getTop());
	_panel->setSize(_background->getWidth(), _background->getHeight());
	_panel->setAlignment(NODE_ALIGN_CENTER | NODE_ALIGN_TOP);
	UIVBoxLayout *layout = new UIVBoxLayout(0.01f, true, NODE_ALIGN_CENTER);
	_panel->setLayout(layout);
	setInactiveAfterPush(1000L);
}
UICampaignMapWindow::UICampaignMapWindow (IFrontend *frontend, CampaignManager &campaignManager) :
	UIMapSelectorWindow(new UINodeMapSelector(frontend, campaignManager), tr("Maps"), UI_WINDOW_CAMPAIGN_MAPS, frontend, WINDOW_FLAG_FULLSCREEN | WINDOW_FLAG_MAIN)
{
#if 0
	UINodeButton *resetButton = new UINodeButton(frontend);
	resetButton->setImage("icon-reset");
	resetButton->putUnderRight(_mapSelector);
	resetButton->addListener(UINodeListenerPtr(new ResetCampaignListener(_mapSelector, campaignManager)));
	add(resetButton);
#endif
}
UINodeMapOnScreenCursorControl::UINodeMapOnScreenCursorControl (IFrontend *frontend, IUINodeMap *mapNode) :
    UINode(frontend), _map(mapNode->getMap())
{
    setStandardPadding();

    UINodeButton *left = new UINodeButton(frontend);
    left->setImage("icon-cursor-left");
    left->setOnActivate(CMD_MOVE_LEFT);
    left->setAlignment(NODE_ALIGN_LEFT | NODE_ALIGN_BOTTOM);
    add(left);
    UINodeButton *right = new UINodeButton(frontend);
    right->setImage("icon-cursor-right");
    right->setOnActivate(CMD_MOVE_RIGHT);
    right->putRight(left);
    add(right);

    UINodeButton *down = new UINodeButton(frontend);
    down->setImage("icon-cursor-down");
    down->setOnActivate(CMD_MOVE_DOWN);
    down->setAlignment(NODE_ALIGN_RIGHT | NODE_ALIGN_BOTTOM);
    add(down);
    UINodeButton *up = new UINodeButton(frontend);
    up->setImage("icon-cursor-up");
    up->setOnActivate(CMD_MOVE_UP);
    up->putAbove(down);
    add(up);
}