Item::Item() { itemWeight = 1; SetItemName(""); ItemID = 0; }
char* ItemMaterial::GetItemName() { switch(SubID) { case 0: SetItemName("Wood"); break; }; return Item::GetItemName(); }
ItemWeapon::ItemWeapon() { ItemID = 1; vector<char*> description; description.push_back(new char[30]); strcpy_s(description.back(), 30, "A simple handy weapon for the"); description.push_back(new char[30]); strcpy_s(description.back(), 30, "allday use!"); itemDamage = 0; SetItemName("Iron Sword"); SetItemDescription(description); };
void KVLVEntry::Refresh() { // Update the object characteristics and ask for redraw KVLVContainer* cnt = (KVLVContainer*)GetParent(); TObject* obj = (TObject*)fUserData; SetItemName(cnt->fColData[0]->GetDataString(obj)); for (int i = 0; fSubnames[i] != 0; i++) fSubnames[i]->SetString(cnt->fColData[i + 1]->GetDataString(obj)); for (int i = 0; fSubnames[i] != 0; ++i) fCtw[i] = gVirtualX->TextWidth(fFontStruct, fSubnames[i]->GetString(), fSubnames[i]->GetLength()); SetWindowName(); TGPosition pos = cnt->GetPagePosition(); cnt->DrawRegion(GetX() - pos.fX, GetY() - pos.fY, GetWidth(), GetHeight()); }
/////////////////////////////////////////////////////////////////////////////// // Descripcion: // - Notificacion de un evento producido sobre un componente // - Al seleccionar y deseleccionar se llamara tambien al metodo destinado a // establecer el nombre del item seleccionado como texto flotante. // Parametros: // - GUICEvent. Evento // Devuelve: // Notas: // - En caso de que se halla elegido que solo se pueda escoger de un // selector cuando este tenga asociado un item, siempre se recibira // el handle a un item valido. En caso contrario, podra ser o no ser // un item valido. ////////////////////////////////////////////////////////////////////////////// void CGUIWBaseItemSelector::ComponentNotify(const GUIDefs::sGUICEvent& GUICEvent) { // SOLO si instancia inicializada ASSERT(Inherited::IsInitOk()); // Se localiza el nodo VisualizableItemListIt It; FindVisibleItemNode(GUICEvent.IDComponent, It); ASSERT((It != m_InterfazInfo.VisualizableItems.end()) != 0); // Comprueba el tipo de evento y realiza operacion switch(GUICEvent.Event) { case GUIDefs::GUIC_SELECT: { // Seleccion (*It)->ItemSelector.Select(true); SetItemName((*It)->hItem, true); } break; case GUIDefs::GUIC_UNSELECT: { // Deseleccion (*It)->ItemSelector.Select(false); SetItemName((*It)->hItem, false); } break; case GUIDefs::GUIC_BUTTONLEFT_PRESSED: { // Pulsacion con boton izquierdo sobre un selector de item. OnItemLeftClick((*It)->hItem, (*It)->ItemSelector); } break; case GUIDefs::GUIC_BUTTONRIGHT_PRESSED: { // Pulsacion con boton derecho sobre un selector de item. OnItemRightClick((*It)->hItem, (*It)->ItemSelector); } break; }; // ~ switch }