void CUIListWnd::create_active_back() { if(m_ActiveBackgroundFrame) return; m_ActiveBackgroundFrame = xr_new<CUIFrameLineWnd>(); m_ActiveBackgroundFrame->InitFrameLineWnd("ui_listline",Fvector2().set(0.0f,0.0f), Fvector2().set(GetWidth(),18.0f) ); }
void CUICellItem::Update() { if (m_pParentList) EnableHeading(m_pParentList->GetVerticalPlacement()); if(Heading()) { SetHeading ( 90.0f * (PI/180.0f) ); SetHeadingPivot (Fvector2().set(0.0f,0.0f), Fvector2().set(0.0f,GetWndSize().y), true); }else ResetHeadingPivot (); inherited::Update(); if ( CursorOverWindow() ) { Frect clientArea; m_pParentList->GetClientArea(clientArea); Fvector2 cp = GetUICursor()->GetCursorPosition(); if(clientArea.in(cp)) GetMessageTarget()->SendMessage(this, DRAG_DROP_ITEM_FOCUSED_UPDATE, NULL); } m_b_already_drawn=false; }
void CUIOutfitDragDropList::SetOutfit(CUICellItem* itm) { m_background->SetWndPos (Fvector2().set(0,0)); m_background->SetWndSize (Fvector2().set(GetWidth(), GetHeight())); m_background->SetStretchTexture (true); if ((!IsGameTypeSingle()) && !itm) { CObject *pActor = NULL; pActor = smart_cast<CActor*>(Level().CurrentEntity()); xr_string a; if (pActor) a = *pActor->cNameVisual(); else a = *m_default_outfit; xr_string::iterator it = std::find(a.rbegin(), a.rend(), '\\').base(); // Cut leading full path if (it != a.begin()) a.erase(a.begin(), it); // Cut trailing ".ogf" R_ASSERT(xr_strlen(a.c_str()) > 4); if ('.' == a[a.size() - 4]) a.erase(a.size() - 4); m_background->InitTexture(a.c_str()); } else { if(itm) { PIItem _iitem = (PIItem)itm->m_pData; CCustomOutfit* pOutfit = smart_cast<CCustomOutfit*>(_iitem); VERIFY(pOutfit); /* r.lt = pOutfit->GetIconPos(); r.x1 *= ICON_GRID_WIDTH; r.y1 *= ICON_GRID_HEIGHT; */ m_background->InitTexture (pOutfit->GetFullIconName().c_str()); }else { m_background->InitTexture ("npc_icon_without_outfit"); } /* r.x2 = r.x1+CHAR_ICON_FULL_WIDTH*ICON_GRID_WIDTH; r.y2 = r.y1+CHAR_ICON_FULL_HEIGHT*ICON_GRID_HEIGHT; m_background->SetShader (InventoryUtilities::GetCharIconsShader()); m_background->SetOriginalRect (r); */ } m_background->TextureOn (); // m_background->RescaleRelative2Rect (r); }
void C2DFrustum::CreateFromRect (const Frect& rect) { m_rect.set(float(rect.x1), float(rect.y1), float(rect.x2), float(rect.y2) ); planes.resize (4); planes[0].build (rect.lt, Fvector2().set(-1, 0)); planes[1].build (rect.lt, Fvector2().set( 0,-1)); planes[2].build (rect.rb, Fvector2().set(+1, 0)); planes[3].build (rect.rb, Fvector2().set( 0,+1)); }
void CUIStatsPlayerList::InitHeader(CUIXml& xml_doc, LPCSTR path) { string256 _path; CUIXmlInit::InitStatic(xml_doc, strconcat(sizeof(_path),_path, path, ":list_header"), 0, m_header); m_header->SetWidth(this->GetDesiredChildWidth()); m_h.h = m_header->GetHeight(); CUIXmlInit::InitFont(xml_doc, strconcat(sizeof(_path),_path, path, ":list_header:text_format"), 0, m_h.c, m_h.f); float indent = 5; if (!m_bSpectator || m_bStatus_mode) { for (u32 i = 0; i<m_field_info.size(); ++i) { CUIStatic* st = new CUIStatic(); st->SetAutoDelete(true); st->SetWndPos(Fvector2().set(indent,10.0f)); st->SetWndSize(Fvector2().set(m_field_info[i].width, m_header->GetHeight())); indent += m_field_info[i].width; if (0 == xr_strcmp(m_field_info[i].name, "rank")) st->SetText(""); else if (0 == xr_strcmp(m_field_info[i].name, "death_atf")) st->SetText(""); else { st->SetTextST(GetST_entry(*m_field_info[i].name)); } if (m_h.f) st->SetFont(m_h.f); st->SetTextColor(m_h.c); st->SetTextComplexMode(false); if (0 != i) st->SetTextAlignment(CGameFont::alCenter); m_header->AttachChild(st); } } else { CUIStatic* st = new CUIStatic(); st->SetAutoDelete (true); st->SetWndPos (Fvector2().set(10,0)); st->SetWndSize (Fvector2().set(this->GetDesiredChildWidth(),m_h.h)); if (m_h.f) m_header->SetFont (m_h.f); st->SetTextColor (m_h.c); st->SetVTextAlignment (valCenter); st->SetTextComplexMode (false); st->SetTextST ("mp_spectators"); m_header->AttachChild (st); } }
void CUIWeaponCellItem::InitAddon(CUIStatic* s, LPCSTR section, Fvector2 addon_offset, bool b_rotate) { Frect tex_rect; Fvector2 base_scale; if(Heading()) { base_scale.x = GetHeight()/(INV_GRID_WIDTHF*m_grid_size.x); base_scale.y = GetWidth()/(INV_GRID_HEIGHTF*m_grid_size.y); }else { base_scale.x = GetWidth()/(INV_GRID_WIDTHF*m_grid_size.x); base_scale.y = GetHeight()/(INV_GRID_HEIGHTF*m_grid_size.y); } Fvector2 cell_size; cell_size.x = pSettings->r_u32(section, "inv_grid_width")*INV_GRID_WIDTHF; cell_size.y = pSettings->r_u32(section, "inv_grid_height")*INV_GRID_HEIGHTF; tex_rect.x1 = pSettings->r_u32(section, "inv_grid_x")*INV_GRID_WIDTHF; tex_rect.y1 = pSettings->r_u32(section, "inv_grid_y")*INV_GRID_HEIGHTF; tex_rect.rb.add (tex_rect.lt,cell_size); cell_size.mul (base_scale); if(b_rotate) { s->SetWndSize (Fvector2().set(cell_size.y, cell_size.x) ); Fvector2 new_offset; new_offset.x = addon_offset.y*base_scale.x; new_offset.y = GetHeight() - addon_offset.x*base_scale.x - cell_size.x; addon_offset = new_offset; }else { s->SetWndSize (cell_size); addon_offset.mul (base_scale); } s->SetWndPos (addon_offset); s->SetOriginalRect (tex_rect); s->SetStretchTexture (true); s->EnableHeading (b_rotate); if(b_rotate) { s->SetHeading (GetHeading()); Fvector2 offs; offs.set (0.0f, s->GetWndSize().y); s->SetHeadingPivot (Fvector2().set(0.0f,0.0f), /*Fvector2().set(0.0f,0.0f)*/offs, true); } }
void CUIListBox::AddExistingItem(CUIListBoxItem* item) { item->InitFrameLineWnd (Fvector2().set(0,0), Fvector2().set(GetDesiredChildWidth()-5, m_def_item_height)); item->SetWidth (GetDesiredChildWidth()); if(m_selection_texture.size()) item->InitTexture (m_selection_texture.c_str(), "hud\\default"); else item->InitDefault (); item->SetSelected (false); item->SetMessageTarget (this); AddWindow (item, true); }
void CUIDragDropReferenceList::Initialize() { for(int i=0; i<m_container->CellsCapacity().x; i++) { m_references.push_back(xr_new<CUIStatic>()); Fvector2 pos = Fvector2().set((m_container->CellSize().x+m_container->CellsSpacing().x)*i,0); m_references.back()->SetAutoDelete(true); m_references.back()->SetWndPos(pos); m_references.back()->SetWndSize(Fvector2().set(m_container->CellSize().x, m_container->CellSize().y)); AttachChild(m_references.back()); m_references.back()->SetWindowName("cell_item_reference"); Register(m_references.back()); } }
void CUIListItem::InitListItem(Fvector2 pos, Fvector2 size) { inherited::SetWndPos (pos); inherited::SetWndSize (size); SetPressMode (CUIButton::DOWN_PRESS); SetPushOffset ( Fvector2().set(0.0f,0.0f)); }
void CUICellItem::UpdateConditionProgressBar() { if(m_pParentList && m_pParentList->GetConditionProgBarVisibility()) { PIItem itm = (PIItem)m_pData; CWeapon* pWeapon = smart_cast<CWeapon*>(itm); CCustomOutfit* pOutfit = smart_cast<CCustomOutfit*>(itm); if(pWeapon || pOutfit ) { Ivector2 itm_grid_size = GetGridSize(true); if(m_pParentList->GetVerticalPlacement()) std::swap(itm_grid_size.x, itm_grid_size.y); Ivector2 cell_size = m_pParentList->CellSize(); m_pConditionState->SetWidth(cell_size.x); float x = 0.5f*(itm_grid_size.x * (cell_size.x)-m_pConditionState->GetWidth()); float y = itm_grid_size.y * (cell_size.y) - m_pConditionState->GetHeight() - 1.f; m_pConditionState->SetWndPos(Fvector2().set(x,y)); m_pConditionState->SetProgressPos(itm->GetCondition()*100.0f); m_pConditionState->Show(true); return; } } m_pConditionState->Show(false); }
CUITrashIcon() { m_icon.SetWndSize(Fvector2().set(29.0f * UI()->get_current_kx(), 36.0f)); m_icon.SetStretchTexture(true); // m_icon.SetAlignment (waCenter); m_icon.InitTexture("ui_inGame2_inv_trash"); }
void CUISequenceVideoItem::Load(CUIXml* xml, int idx) { CUISequenceItem::Load (xml,idx); XML_NODE* _stored_root = xml->GetLocalRoot(); xml->SetLocalRoot (xml->NavigateToNode("item",idx)); LPCSTR str = xml->Read ("pause_state",0,"ignore"); m_flags.set (etiNeedPauseOn, 0==_stricmp(str, "on")); m_flags.set (etiNeedPauseOff, 0==_stricmp(str, "off")); LPCSTR str2 = xml->Read ("pause_sound",0,"ignore"); m_flags.set (etiNeedPauseSound, 0==_stricmp(str2, "on")); str = xml->Read ("can_be_stopped",0,"on"); m_flags.set (etiCanBeStopped, 0==_stricmp(str, "on")); str = xml->Read ("back_show",0,"on"); m_flags.set (etiBackVisible, 0==_stricmp(str, "on")); m_flags.set (etiGrabInput, TRUE); m_delay = _max(xml->ReadFlt ("delay",0,0.f),0.f); //ui-components m_wnd = xr_new<CUIStatic>(); m_wnd->SetAutoDelete (false); CUIXmlInit::InitStatic (*xml, "video_wnd", 0, m_wnd); bool bFullScreen = (1==xml->ReadAttribInt("video_wnd", 0, "fullscreen", 0)); if(!bFullScreen) { m_wnd->SetWndPos (Fvector2().set(512.0f,384.0f)); m_wnd->SetAlignment (waCenter); Frect texture_coords = m_wnd->GetUIStaticItem().GetOriginalRect(); bool is_16_9 = UI()->is_16_9_mode(); float kw_image = UI_BASE_WIDTH / texture_coords.width(); Fvector2 wnd_size; wnd_size.x = UI_BASE_WIDTH; wnd_size.y = texture_coords.height()*kw_image; if(is_16_9) wnd_size.y *= 1.328f; m_wnd->SetWndSize (wnd_size); } LPCSTR m_snd_name = xml->Read("sound",0,""); if (m_snd_name&&m_snd_name[0]) { string_path _l, _r; strconcat (sizeof(_l),_l, m_snd_name, "_l"); strconcat (sizeof(_r),_r, m_snd_name, "_r"); m_sound[0].create (_l,st_Effect,sg_Undefined); VERIFY(m_sound[0]._handle()); m_sound[1].create (_r,st_Effect,sg_Undefined); VERIFY(m_sound[1]._handle()); } xml->SetLocalRoot (_stored_root); }
void CUICellItem::Update() { if (m_pParentList) EnableHeading(m_pParentList->GetVerticalPlacement()); if(Heading()) { SetHeading ( 90.0f * (PI/180.0f) ); SetHeadingPivot (Fvector2().set(0.0f,0.0f), Fvector2().set(0.0f,GetWndSize().y), true); }else ResetHeadingPivot (); inherited::Update(); m_b_already_drawn=false; }
void CUIListWnd::InitListWnd(Fvector2 pos, Fvector2 size, float item_height) { inherited::SetWndPos(pos); inherited::SetWndSize(size); //добавить полосу прокрутки m_ScrollBar = xr_new<CUIScrollBar>(); m_ScrollBar->SetAutoDelete(true); AttachChild(m_ScrollBar); if (!!m_scrollbar_profile) m_ScrollBar->InitScrollBar(Fvector2().set(size.x,0.0f), size.y, false, *m_scrollbar_profile); else m_ScrollBar->InitScrollBar(Fvector2().set(size.x,0.0f), size.y, false); m_ScrollBar->SetWndPos( Fvector2().set(m_ScrollBar->GetWndPos().x - m_ScrollBar->GetWidth(), m_ScrollBar->GetWndPos().y)); SetItemWidth(size.x - m_ScrollBar->GetWidth()); m_iFirstShownIndex = 0; SetItemHeight(item_height); m_iRowNum = iFloor(size.y/m_iItemHeight); m_ScrollBar->SetRange(0,0); m_ScrollBar->SetPageSize(0); m_ScrollBar->SetScrollPos(s16(m_iFirstShownIndex)); m_ScrollBar->Show(false); m_ScrollBar->Enable(false); /* m_StaticActiveBackground.Init(ACTIVE_BACKGROUND,"hud\\default", 0,0,alNone); m_StaticActiveBackground.SetTile(iFloor(m_iItemWidth/ACTIVE_BACKGROUND_WIDTH), iFloor(m_iItemHeight/ACTIVE_BACKGROUND_HEIGHT), fmod(m_iItemWidth,float(ACTIVE_BACKGROUND_WIDTH)), fmod(m_iItemHeight,float(ACTIVE_BACKGROUND_HEIGHT))); */ UpdateList(); }
CUIListBoxItem* CUIListBox::AddItem() { CUIListBoxItem* item = xr_new<CUIListBoxItem>(m_def_item_height); item->InitFrameLineWnd (Fvector2().set(0,0), Fvector2().set(GetDesiredChildWidth()-5, m_def_item_height)); item->GetTextItem()->SetWidth (GetDesiredChildWidth()); item->SetWidth (GetDesiredChildWidth()); if(m_selection_texture.size()) item->InitTexture (m_selection_texture.c_str(), "hud\\default"); else item->InitDefault (); item->SetFont (GetFont()); item->SetSelected (false); item->SetMessageTarget (this); AddWindow (item, true); return item; }
CUIListBoxItem* CUIListBox::AddTextItem(LPCSTR text) { CUIListBoxItem* pItem = AddItem(); pItem->SetWndSize (Fvector2().set(GetDesiredChildWidth(), m_def_item_height)); pItem->SetTextColor (m_text_color); pItem->SetText (CStringTable().translate(text).c_str()); pItem->GetTextItem()->SetWidth (GetDesiredChildWidth()); return pItem; }
SHitMark::SHitMark( const ui_shader& sh, const Fvector& dir ) { m_StartTime = Device.fTimeGlobal; m_lanim = LALib.FindItem( "hud_hit_mark" ); m_HitDirection = dir.getH(); m_UIStaticItem = xr_new<CUIStaticItem>(); m_UIStaticItem->SetShader ( sh ); m_UIStaticItem->SetPos ( 256.0f, 128.0f ); m_UIStaticItem->SetSize (Fvector2().set( 512.0f, 512.0f) ); }
CUIListBoxItem* CUIListBox::AddItem(LPCSTR text) { if (!text) return NULL; CUIListBoxItem* pItem = new CUIListBoxItem(); pItem->InitFrameLineWnd (Fvector2().set(0,0), Fvector2().set(this->GetDesiredChildWidth()-5, m_def_item_height) ); if (!m_selection_texture) pItem->InitDefault (); else pItem->InitTexture (*m_selection_texture,"hud\\default"); pItem->SetSelected (false); pItem->m_text.SetText (*CStringTable().translate(text)); pItem->SetTextColor (m_text_color, m_text_color_s); pItem->SetMessageTarget (this); AddWindow (pItem, true); return pItem; }
void CUIMMShniaga::CreateList(xr_vector<CUIStatic*>& lst, CUIXml& xml_doc, LPCSTR path){ CGameFont* pF; u32 color; float button_height = xml_doc.ReadAttribFlt("button", 0, "h"); R_ASSERT (button_height); CUIXmlInit::InitFont (xml_doc, path, 0, color, pF); R_ASSERT (pF); int nodes_num = xml_doc.GetNodesNum(path, 0, "btn"); XML_NODE* tab_node = xml_doc.NavigateToNode(path,0); xml_doc.SetLocalRoot (tab_node); CUIStatic* st; for (int i = 0; i < nodes_num; ++i) { st = new CUIStatic(); st->SetWndPos (Fvector2().set(0,0)); st->SetWndSize (Fvector2().set(m_view->GetDesiredChildWidth(), button_height)); st->SetTextComplexMode (false); st->SetTextST (xml_doc.ReadAttrib ("btn", i, "caption")); if (pF) st->SetFont (pF); float font_height = st->GetFont()->GetHeight(); UI()->ClientToScreenScaledHeight(font_height); st->SetTextY ( (button_height-font_height)/2.0f ); st->SetTextColor (color); st->SetTextAlignment (CGameFont::alCenter); st->SetWindowName (xml_doc.ReadAttrib("btn", i, "name")); st->SetMessageTarget (this); lst.push_back(st); } xml_doc.SetLocalRoot(xml_doc.GetRoot()); }
void CUITrackBar::InitTrackBar(Fvector2 pos, Fvector2 size) { float item_height; float item_width; InitIB (pos, size); InitState (S_Enabled, "ui_inGame2_opt_slider_bar"); InitState (S_Disabled, "ui_inGame2_opt_slider_bar"); item_width = CUITextureMaster::GetTextureWidth("ui_inGame2_opt_slider_box_e"); item_height = CUITextureMaster::GetTextureHeight("ui_inGame2_opt_slider_box_e"); item_width *= UI().get_current_kx(); m_pSlider->InitButton( Fvector2().set(0.0f, 0.0f) /*(size.y - item_height)/2.0f)*/, Fvector2().set(item_width, item_height) ); //size m_pSlider->InitTexture("ui_inGame2_opt_slider_box"); SetCurrentState(S_Enabled); }
void CUIDragItem::Init(const ui_shader& sh, const Frect& rect, const Frect& text_rect) { SetWndRect (rect); m_static.SetShader (sh); m_static.SetTextureRect (text_rect); m_static.SetWndPos (Fvector2().set(0.0f,0.0f)); m_static.SetWndSize (GetWndSize()); m_static.TextureOn (); m_static.SetTextureColor (color_rgba(255,255,255,170)); m_static.SetStretchTexture (true); m_pos_offset.sub (rect.lt, GetUICursor().GetCursorPosition()); }
void UIInvUpgPropertiesWnd::set_upgrade_info( Upgrade_type& upgrade ) { if ( !upgrade.is_known() ) { SetWndSize( Fvector2().set( 0, 0 ) ); return; } m_temp_upgrade_vector.clear_not_free(); m_temp_upgrade_vector.push_back( upgrade.id() ); set_info( m_temp_upgrade_vector ); }
void CUIMessageBoxEx::InitMessageBox(LPCSTR xml_template) { //CUIDialogWnd::SetWndRect(Frect().set(0.0f,0.0f,1024.0f,768.0f)); m_pMessageBox->InitMessageBox(xml_template); SetWndPos( m_pMessageBox->GetWndPos() ); SetWndSize( m_pMessageBox->GetWndSize() ); m_pMessageBox->SetWndPos( Fvector2().set(0,0) ); AddCallback( m_pMessageBox->WindowName(), MESSAGE_BOX_YES_CLICKED, CUIWndCallback::void_function( this, &CUIMessageBoxEx::OnOKClicked ) ); }
void CUICustomSpin::InitSpin(Fvector2 pos, Fvector2 size) { CUIWindow::SetWndPos (pos); CUIWindow::SetWndSize (Fvector2().set(size.x,SPIN_HEIGHT)); m_pFrameLine->SetWndPos (Fvector2().set(0,0)); m_pFrameLine->SetWndSize (Fvector2().set(size.x, SPIN_HEIGHT)); m_pFrameLine->InitTexture ("ui_inGame2_spin_box","hud\\default"); m_pBtnUp->InitButton (Fvector2().set(size.x-BTN_SIZE_X-2.0f, 1.0f),Fvector2().set(BTN_SIZE_X, BTN_SIZE_Y)); m_pBtnUp->InitTexture ("ui_inGame2_spin_box_button_top"); m_pBtnDown->InitButton (Fvector2().set(size.x-BTN_SIZE_X-2.0f, BTN_SIZE_Y+2.0f),Fvector2().set(BTN_SIZE_X, BTN_SIZE_Y)); m_pBtnDown->InitTexture ("ui_inGame2_spin_box_button_bottom"); m_pLines->m_wndPos.set (Fvector2().set(0,0)); m_pLines->m_wndSize.set (Fvector2().set(size.x-BTN_SIZE_X-10.0f, SPIN_HEIGHT)); }
void CUICellItem::Update() { EnableHeading(m_pParentList->GetVerticalPlacement()); if(Heading()) { SetHeading ( 90.0f * (PI/180.0f) ); SetHeadingPivot (Fvector2().set(0.0f,0.0f), Fvector2().set(0.0f,GetWndSize().y), true); }else ResetHeadingPivot (); inherited::Update(); if ( CursorOverWindow() ) { Frect clientArea; m_pParentList->GetClientArea(clientArea); Fvector2 cp = GetUICursor().GetCursorPosition(); if(clientArea.in(cp)) GetMessageTarget()->SendMessage(this, DRAG_DROP_ITEM_FOCUSED_UPDATE, NULL); } PIItem item = (PIItem)m_pData; if ( item ) { m_has_upgrade = item->has_any_upgrades(); // Fvector2 size = GetWndSize(); // Fvector2 up_size = m_upgrade->GetWndSize(); // pos.x = size.x - up_size.x - 4.0f; Fvector2 pos; pos.set( m_upgrade_pos ); if ( ChildsCount() ) { pos.x += m_text->GetWndSize().x + 2.0f; } m_upgrade->SetWndPos( pos ); } m_upgrade->Show( m_has_upgrade ); }
void CUIActorInfoWnd::Init() { CUIXml uiXml; CUIXmlInit xml_init; uiXml.Load (CONFIG_PATH, UI_PATH,ACTOR_STATISTIC_XML); xml_init.InitWindow (uiXml, "main_wnd", 0, this); // Декоративное оформление UICharIconFrame = xr_new<CUIFrameWindow>(); UICharIconFrame->SetAutoDelete (true); xml_init.InitFrameWindow (uiXml, "chicon_frame_window", 0, UICharIconFrame); AttachChild (UICharIconFrame); UICharIconHeader = xr_new<CUIFrameLineWnd>(); UICharIconHeader->SetAutoDelete (true); xml_init.InitFrameLine (uiXml, "chicon_frame_line", 0, UICharIconHeader); UICharIconFrame->AttachChild (UICharIconHeader); UIAnimatedIcon = xr_new<CUIAnimatedStatic>(); UIAnimatedIcon->SetAutoDelete (true); xml_init.InitAnimatedStatic (uiXml, "a_static", 0, UIAnimatedIcon); UICharIconHeader->AttachChild (UIAnimatedIcon); UIInfoFrame = xr_new<CUIFrameWindow>(); UIInfoFrame->SetAutoDelete (true); xml_init.InitFrameWindow (uiXml, "info_frame_window", 0, UIInfoFrame); AttachChild (UIInfoFrame); UIInfoHeader = xr_new<CUIFrameLineWnd>();UIInfoHeader ->SetAutoDelete(true); xml_init.InitFrameLine (uiXml, "info_frame_line", 0, UIInfoHeader); UIInfoFrame->AttachChild (UIInfoHeader); UIDetailList = xr_new<CUIScrollView>();UIDetailList->SetAutoDelete(true); UIInfoFrame->AttachChild (UIDetailList); xml_init.InitScrollView (uiXml, "detail_list", 0, UIDetailList); UIMasterList = xr_new<CUIScrollView>();UIMasterList->SetAutoDelete(true); UICharIconFrame->AttachChild (UIMasterList); xml_init.InitScrollView (uiXml, "master_list", 0, UIMasterList); UICharacterWindow = xr_new<CUIWindow>();UICharacterWindow->SetAutoDelete(true); UICharIconFrame->AttachChild (UICharacterWindow); xml_init.InitWindow (uiXml, "character_info", 0, UICharacterWindow); UICharacterInfo = xr_new<CUICharacterInfo>(); UICharacterInfo->SetAutoDelete(true); UICharacterWindow->AttachChild (UICharacterInfo); UICharacterInfo->InitCharacterInfo (Fvector2().set(0,0),UICharacterWindow->GetWndSize(), ACTOR_CHARACTER_XML); //Элементы автоматического добавления xml_init.InitAutoStatic (uiXml, "right_auto_static", UICharIconFrame); xml_init.InitAutoStatic (uiXml, "left_auto_static", UIInfoFrame); }
CUISpeechMenu::CUISpeechMenu(LPCSTR section_name) { m_pList = xr_new<CUIScrollView>(); AttachChild (m_pList); m_pList->SetAutoDelete (true); CUIXml xml_doc; xml_doc.Load (CONFIG_PATH, UI_PATH, "maingame.xml"); CUIXmlInit::InitWindow (xml_doc, "speech_menu",0,this); CUIXmlInit::InitScrollView (xml_doc, "speech_menu",0,m_pList); m_pList->SetWndPos (Fvector2().set(0,0)); m_text_color = 0xffffffff; CUIXmlInit::InitFont (xml_doc, "speech_menu:text", 0, m_text_color, m_pFont); InitList (section_name); }
void UIProperty::init_from_xml( CUIXml& ui_xml ) { m_ui_icon = new CUIStatic(); m_ui_text = new CUIStatic(); AttachChild( m_ui_icon ); AttachChild( m_ui_text ); m_ui_icon->SetAutoDelete( true ); m_ui_text->SetAutoDelete( true ); CUIXmlInit::InitWindow( ui_xml, "properties", 0, this ); SetWndPos( Fvector2().set( 0, 0 ) ); CUIXmlInit::InitWindow( ui_xml, "properties:icon", 0, m_ui_icon ); CUIXmlInit::InitWindow( ui_xml, "properties:text", 0, m_ui_text ); }
void CServerList::AddServerToList (ServerInfo* pServerInfo) { if (!IsValidItem(*pServerInfo)) return; CUIListWnd& _list = m_list[LST_SERVER]; CUIListItemServer* item = GetFreeItem(); Fvector2 sz; sz.x = _list.GetItemWidth(); sz.y = _list.GetItemHeight(); SrvInfo2LstSrvInfo (pServerInfo); item->InitItemServer (m_itemInfo, Fvector2().set(0,0), sz); _list.AddItem<CUIListItemServer>(item); };
SGrenadeMark::SGrenadeMark( const ui_shader& sh, CGrenade* grn ) { p_grenade = grn; removed_grenade = false; m_LastTime = Device.fTimeGlobal; m_LightAnim = LALib.FindItem( "hud_hit_mark" ); m_Angle = 0.0f; m_UIStaticItem = xr_new<CUIStaticItem>(); m_UIStaticItem->SetShader ( sh ); float xs = 640.0f; float ys = 640.0f; m_UIStaticItem->SetPos ( ( UI_BASE_WIDTH - xs ) * 0.5f, ( UI_BASE_HEIGHT - ys ) * 0.5f ); m_UIStaticItem->SetSize (Fvector2().set(xs, ys)); }