CUIDragItem* CUIWeaponCellItem::CreateDragItem() { CUIDragItem* i = inherited::CreateDragItem(); CUIStatic* s = NULL; if(GetIcon(eSilencer)) { s = new CUIStatic(); s->SetAutoDelete(true); s->SetShader (InventoryUtilities::GetEquipmentIconsShader()); InitAddon (s, *object()->GetSilencerName(), m_addon_offset[eSilencer], false); s->SetColor (i->wnd()->GetColor()); i->wnd ()->AttachChild (s); } if(GetIcon(eScope)) { s = new CUIStatic(); s->SetAutoDelete(true); s->SetShader (InventoryUtilities::GetEquipmentIconsShader()); InitAddon (s, *object()->GetScopeName(), m_addon_offset[eScope], false); s->SetColor (i->wnd()->GetColor()); i->wnd ()->AttachChild (s); } if(GetIcon(eLauncher)) { s = new CUIStatic(); s->SetAutoDelete(true); s->SetShader (InventoryUtilities::GetEquipmentIconsShader()); InitAddon (s, *object()->GetGrenadeLauncherName(),m_addon_offset[eLauncher], false); s->SetColor (i->wnd()->GetColor()); i->wnd ()->AttachChild (s); } return i; }
CUIStatic* init_addon( CUIWeaponCellItem *cell_item, LPCSTR sect, float scale, float scale_x, eAddonType idx) { CUIStatic *addon = xr_new<CUIStatic>(); addon->SetAutoDelete(true); auto pos = cell_item->get_addon_offset(idx); pos.x *= scale*scale_x; pos.y *= scale; auto width = (float)pSettings->r_u32(sect, "inv_grid_width")*INV_GRID_WIDTH; auto height = (float)pSettings->r_u32(sect, "inv_grid_height")*INV_GRID_HEIGHT; auto tex_x = (float)pSettings->r_u32(sect, "inv_grid_x")*INV_GRID_WIDTH; auto tex_y = (float)pSettings->r_u32(sect, "inv_grid_y")*INV_GRID_HEIGHT; addon->SetStretchTexture (true); addon->InitTexture ("ui\\ui_icon_equipment"); addon->SetOriginalRect (tex_x, tex_y, width, height); addon->SetWndRect (pos.x, pos.y, width*scale*scale_x, height*scale); addon->SetColor (color_rgba(255,255,255,192)); return addon; }