void NBEditor::load_ui()
{
	IGUIStaticText *sidebar = state->menu->sidebar;

	if (!sidebar) {
		return;
	}

	IGUIEnvironment *guienv = state->device->getGUIEnvironment();
	Node *node = state->project->GetCurrentNode();
	if (!node) {
		sidebar->getElementFromId(ENB_GUI_MAIN_MSG)->setVisible(true);
		sidebar->getElementFromId(ENB_GUI_MAIN_LISTBOX)->setVisible(false);
		sidebar->getElementFromId(ENB_GUI_PROP)->setVisible(false);
	} else {
		IGUIListBox *lb = (IGUIListBox *) sidebar->getElementFromId(ENB_GUI_MAIN_LISTBOX);		
		sidebar->getElementFromId(ENB_GUI_MAIN_MSG)->setVisible(false);
		sidebar->getElementFromId(ENB_GUI_PROP)->setVisible(false);

		if (lb) {
			lb->clear();
			lb->setVisible(true);
			std::vector<NodeBox*> & boxes = node->boxes;
			for (std::vector<NodeBox*>::const_iterator it = boxes.begin();
					it != boxes.end();
					++it) {
				lb->addItem(narrow_to_wide((*it)->name).c_str());
			}
			lb->setSelected(lb->getListItem(node->GetId()));
		}

		fillProperties();
	}
}
Example #2
0
void NBEditor::load_ui(){
	IGUIStaticText* sidebar = GetState()->Menu()->GetSideBar();
	IGUIEnvironment* guienv = GetState()->GetDevice()->getGUIEnvironment();
	Node* node = GetState()->project->GetCurrentNode();
	if (!node){
		sidebar->getElementFromId(GUI_SIDEBAR_LABEL)->setVisible(true);
		sidebar->getElementFromId(GUI_SIDEBAR_LISTBOX)->setVisible(false);
	}else{
		IGUIListBox* lb = (IGUIListBox*) sidebar->getElementFromId(GUI_SIDEBAR_LISTBOX);		
		sidebar->getElementFromId(GUI_SIDEBAR_LABEL)->setVisible(false);

		if (lb){
			lb->clear();
			lb->setVisible(true);
			for (int i = 0;i<NODEB_MAX;i++){
				NodeBox* box = node->GetNodeBox(i);
				if (box){
					size_t origsize = strlen(box->name.c_str()) + 1;
					static wchar_t wcstring[1024];
					mbstowcs(wcstring, box->name.c_str(), origsize);
					wcscat(wcstring, L"");
					lb->addItem(wcstring);
				}
			}
			lb->setSelected(lb->getListItem(node->GetId()));
		}
	}
}
Example #3
0
//Update the items list in gameplay
void GUIGame::updateItemsList()
{
	IGUIImage* guiPlayerLootImage = (IGUIImage*)GUIManager::getInstance()->getGUIElement(GUIManager::IMG_LOOT);
	IGUIListBox* guiPlayerItems =(IGUIListBox*)GUIManager::getInstance()->getGUIElement(GUIManager::LB_ID_PLAYER_ITEMS);
    guiPlayerItems->clear();
   
	vector<DynamicObject*> lootitems = DynamicObjectsManager::getInstance()->getPlayer()->getLootItems();
	std::sort(lootitems.begin(), lootitems.end());

    
	for(int i = 0; i<(int)lootitems.size(); i++)
	{
		//internalname is the Alias name of the object. If undefined it use the internal name
		guiPlayerItems->addItem(stringw(lootitems[i]->internalname).c_str());
	}

	if (guiPlayerItems->getSelected()<0)
	{
		ITexture* info_none = driver->getTexture("../media/editor/info_none.jpg");
		guiPlayerLootImage->setImage(info_none);
		((IGUIStaticText*)guienv->getRootGUIElement()->getElementFromId(GUIManager::TXT_ID_LOOT_DESCRIPTION,true))->setText(L"");
	}
}