Пример #1
0
void MenuTalker::createActionBuffer() {
	createActionButtons(-1);

	int button_height = 0;
	if (!actions.empty()) {
		button_height = static_cast<int>(actions.size()) * actions[0].btn->pos.h;
	}

	for (size_t i = 0; i < actions.size(); ++i) {
		actions[i].btn->pos.x = text_offset.x;
		actions[i].btn->pos.y = (static_cast<int>(i) * actions[i].btn->pos.h);
		actions[i].btn->refresh();
	}

	label_name->setText(npc->name);
	label_name->setFont(font_who);
	textbox->resize(textbox->pos.w, button_height);

	align();

	closeButton->enabled = true;
	advanceButton->enabled = false;

	setupTabList();
}
void GameStateConfigDesktop::init() {
	VIDEO_TAB = 0;
	AUDIO_TAB = 1;
	INTERFACE_TAB = 2;
	INPUT_TAB = 3;
	KEYBINDS_TAB = 4;
	MODS_TAB = 5;

	tab_control->setTabTitle(VIDEO_TAB, msg->get("Video"));
	tab_control->setTabTitle(AUDIO_TAB, msg->get("Audio"));
	tab_control->setTabTitle(INTERFACE_TAB, msg->get("Interface"));
	tab_control->setTabTitle(INPUT_TAB, msg->get("Input"));
	tab_control->setTabTitle(KEYBINDS_TAB, msg->get("Keybindings"));
	tab_control->setTabTitle(MODS_TAB, msg->get("Mods"));
	tab_control->updateHeader();

	readConfig();

	// Allocate KeyBindings ScrollBox
	input_scrollbox = new WidgetScrollBox(scrollpane.w, scrollpane.h);
	input_scrollbox->setBasePos(scrollpane.x, scrollpane.y);
	input_scrollbox->bg.r = scrollpane_color.r;
	input_scrollbox->bg.g = scrollpane_color.g;
	input_scrollbox->bg.b = scrollpane_color.b;
	input_scrollbox->transparent = false;
	input_scrollbox->resize(scrollpane.w, scrollpane_contents);

	// Set positions of secondary key bindings
	for (unsigned int i = key_count; i < key_count*2; i++) {
		keybinds_btn[i]->pos.x = keybinds_btn[i-key_count]->pos.x + secondary_offset.x;
		keybinds_btn[i]->pos.y = keybinds_btn[i-key_count]->pos.y + secondary_offset.y;
	}

	// Set positions of joystick bindings
	for (unsigned int i = key_count*2; i < keybinds_btn.size(); i++) {
		keybinds_btn[i]->pos.x = keybinds_btn[i-(key_count*2)]->pos.x + (secondary_offset.x*2);
		keybinds_btn[i]->pos.y = keybinds_btn[i-(key_count*2)]->pos.y + (secondary_offset.y*2);
	}

	addChildWidgets();
	addChildWidgetsDesktop();
	setupTabList();

	refreshWidgets();

	update();
}
Пример #3
0
void GameStateConfigBase::init() {
	AUDIO_TAB = 0;
	INTERFACE_TAB = 1;
	MODS_TAB = 2;

	tab_control->setTabTitle(AUDIO_TAB, msg->get("Audio"));
	tab_control->setTabTitle(INTERFACE_TAB, msg->get("Interface"));
	tab_control->setTabTitle(MODS_TAB, msg->get("Mods"));
	tab_control->updateHeader();

	readConfig();

	addChildWidgets();
	setupTabList();

	refreshWidgets();

	update();
}
Пример #4
0
void MenuTalker::createBuffer() {
	clearActionButtons();

	if (static_cast<unsigned>(dialog_node) >= npc->dialog.size() || event_cursor >= npc->dialog[dialog_node].size())
		return;

	createActionButtons(dialog_node);

	int button_height = 0;
	if (!actions.empty()) {
		button_height = static_cast<int>(actions.size()) * actions[0].btn->pos.h;
	}

	std::string line;

	// speaker name
	int etype = npc->dialog[dialog_node][event_cursor].type;
	std::string who;

	if (etype == EventComponent::NPC_DIALOG_THEM) {
		who = npc->name;
	}
	else if (etype == EventComponent::NPC_DIALOG_YOU) {
		who = hero_name;
	}

	label_name->setText(who);
	label_name->setFont(font_who);


	line = Utils::substituteVarsInString(npc->dialog[dialog_node][event_cursor].s, pc);

	// render dialog text to the scrollbox buffer
	Point line_size = font->calc_size(line,textbox->pos.w-(text_offset.x*2));
	textbox->resize(textbox->pos.w, line_size.y + button_height);
	font->setFont(font_dialog);
	font->render(
		line,
		text_offset.x,
		0,
		FontEngine::JUSTIFY_LEFT,
		textbox->contents->getGraphics(),
		text_pos.w - text_offset.x*2,
		font->getColor(FontEngine::COLOR_MENU_NORMAL)
	);

	for (size_t i = 0; i < actions.size(); ++i) {
		actions[i].btn->pos.x = text_offset.x;
		actions[i].btn->pos.y = line_size.y + (static_cast<int>(i) * actions[i].btn->pos.h);
		actions[i].btn->refresh();
	}

	align();

	if (!actions.empty()) {
		advanceButton->enabled = false;
		closeButton->enabled = false;
	}
	else if (!npc->dialog[dialog_node].empty() && event_cursor < npc->dialog[dialog_node].size()-1 && npc->dialog[dialog_node][event_cursor+1].type != EventComponent::NONE) {
		advanceButton->enabled = true;
		closeButton->enabled = false;
	}
	else {
		advanceButton->enabled = false;
		closeButton->enabled = true;
	}

	setupTabList();
}