Пример #1
0
	bool __declspec(dllexport) SetupGameIcon(u32 icon, u32 cl, float width, float height) // позволяет расцветить иконку или изменить её размер
	{
		CUIMainIngameWnd *window = GetMainIngameWindow();
		if (!window)
		{
			log_script_error("SetupGameIcon failed due GetMainIngameWindow() returned NULL");
			return false;
		}


		CUIStatic *sIcon = warn_icon_list[icon & 7];
		
		if (sIcon)
		{			
			if (width > 0 && height > 0)
			{
				sIcon->SetWidth (width);
				sIcon->SetHeight (height);
				sIcon->SetStretchTexture(cl > 0);
			}
			else 
				window->SetWarningIconColor((CUIMainIngameWnd::EWarningIcons)icon, cl);

			external_icon_ctrl = true;
			return true;
		}
		return false;
	}
Пример #2
0
	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");
	}
Пример #3
0
float CUIPdaKillMessage::InitText(CUIStatic& refStatic, float x, PlayerInfo& info){

	if ( 0 == xr_strlen(info.m_name))
		return 0;

	float y								= 0;
	float selfHeight					= GetHeight();
	CGameFont* pFont					= GetFont();

	float width							= pFont->SizeOf_(*info.m_name);
	UI()->ClientToScreenScaledWidth		(width);

	float height						= pFont->CurrentHeight_();
	y = (selfHeight - height)/2;
	float __eps							= pFont->SizeOf_('o');//hack -(
	UI()->ClientToScreenScaledWidth		(__eps);

	clamp								(width, 0.0f, 120.0f);
	refStatic.Init						(x, 0/*y*/, width + __eps, height);
//.	refStatic.SetElipsis				(CUIStatic::eepEnd, 0);
	refStatic.SetText					(*info.m_name);
	refStatic.SetTextColor				(info.m_color);

	return		width;
}
Пример #4
0
void CUIMainIngameWnd::InitFlashingIcons(CUIXml* node)
{
	const char * const flashingIconNodeName = "flashing_icon";
	int staticsCount = node->GetNodesNum("", 0, flashingIconNodeName);

	CUIXmlInit xml_init;
	CUIStatic *pIcon = NULL;
	// Пробегаемся по всем нодам и инициализируем из них статики
	for (int i = 0; i < staticsCount; ++i)
	{
		pIcon = xr_new<CUIStatic>();
		xml_init.InitStatic(*node, flashingIconNodeName, i, pIcon);
		shared_str iconType = node->ReadAttrib(flashingIconNodeName, i, "type", "none");

		// Теперь запоминаем иконку и ее тип
		EFlashingIcons type = efiPdaTask;

		if		(iconType == "pda")		type = efiPdaTask;
		else if (iconType == "mail")	type = efiMail;
		else	R_ASSERT(!"Unknown type of mainingame flashing icon");

		R_ASSERT2(m_FlashingIcons.find(type) == m_FlashingIcons.end(), "Flashing icon with this type already exists");

		CUIStatic* &val	= m_FlashingIcons[type];
		val			= pIcon;

		AttachChild(pIcon);
		pIcon->Show(false);
	}
}
Пример #5
0
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;
}
Пример #6
0
float CUIPdaKillMessage::InitIcon(CUIStatic& refStatic, float x, IconInfo& info){
	if ( 0 == info.m_rect.width())
		return 0;

	if (info.m_shader == NULL)
		return 0;

	float		y = 0;
	float		selfHeight = GetHeight();
	float		scale = 0;
	Frect		rect = info.m_rect;

	float width = rect.width();
	float height = rect.height();
	
	scale = selfHeight/height;
	if (scale > 1)
		scale = 1;
	width  = width*scale;
	height = height*scale;
	y = (selfHeight - height) /2;
	refStatic.Init(x, y, width, height);
	refStatic.SetOriginalRect(info.m_rect);
	refStatic.SetShader(info.m_shader);
	refStatic.SetStretchTexture(true);

	return width;
}
Пример #7
0
void CUIStatsPlayerList::InitTeamHeader(CUIXml& xml_doc, LPCSTR path){
	string256 _path;
	m_header_team = new CUIWindow();
	m_header_team->SetAutoDelete(true);
	CUIXmlInit::InitWindow(xml_doc, strconcat(sizeof(_path),_path, path, ":team_header"), 0, m_header_team);
	m_header_team->SetWidth(this->GetDesiredChildWidth());

	CUIStatic* logo = new CUIStatic();
	logo->SetAutoDelete(true);
	CUIXmlInit::InitStatic(xml_doc, strconcat(sizeof(_path),_path, path, ":team_header:logo"), 0, logo);
	m_header_team->AttachChild(logo);

	if (1 == m_CurTeam)
        logo->InitTexture(pSettings->r_string("team_logo_small", "team1"));
	else if (2 == m_CurTeam)
		logo->InitTexture(pSettings->r_string("team_logo_small", "team2"));
	else
		R_ASSERT2(false, "invalid team");
	
	S_ELEMENT t;
	CUIXmlInit::InitFont(xml_doc, strconcat(sizeof(_path),_path, path, ":team_header:text_format"), 0, t.c, t.f);
	t.h = m_header_team->GetHeight();

	m_header_text = new CUIStatic();
	m_header_text->SetAutoDelete(true);
	CUIXmlInit::InitStatic(xml_doc, strconcat(sizeof(_path),_path, path, ":team_header:header"), 0, m_header_text);
	m_header_text->SetWidth(GetDesiredChildWidth());
	m_header_text->SetVTextAlignment(valCenter);
	m_header_team->AttachChild(m_header_text);
	if (t.f)
		m_header_text->SetFont(t.f);
	m_header_text->SetTextColor(t.c);
}
void CUIDragDropReferenceList::ReloadReferences(CInventoryOwner* pActor)
{
	if (!pActor)
		return;

	if(m_drag_item)
		DestroyDragItem();

	m_container->ClearAll(true);
	m_selected_item	= NULL;

	for(u8 i=0; i<m_container->CellsCapacity().x; i++)
	{
		CUIStatic* ref = m_references[i];
		LPCSTR item_name = ACTOR_DEFS::g_quick_use_slots[i];
		if(item_name && xr_strlen(item_name))
		{
			PIItem itm = pActor->inventory().GetAny(item_name);
			if(itm)
			{
				SetItem(create_cell_item(itm), Ivector2().set(i, 0));
			}
			else
			{
				LoadItemTexture(item_name, Ivector2().set(i, 0));
				ref->SetTextureColor(color_rgba(255,255,255,100));
			}
		}
		else
		{
			ref->SetTextureColor(color_rgba(255,255,255,0));
		}
	}
}
Пример #9
0
void GetStaticRaw(CUIMainIngameWnd *wnd, lua_State *L)
{
	using namespace luabind::detail;			
	// wnd->GetChildWndList();
	shared_str name = lua_tostring(L, 2);
	CUIWindow *child = wnd->FindChild(name, 2); 	
	if (!child)
	{
		CUIStatic *src = &wnd->GetUIZoneMap()->Background();		
		child = src->FindChild(name, 5);
		
		if (!child)
		{
			src = &wnd->GetUIZoneMap()->ClipFrame();
			child = src->FindChild(name, 5);
		}
		if (!child)
		{
			src = &wnd->GetUIZoneMap()->Compass();
			child = src->FindChild(name, 5);
		}
	}

	if (child)
	{	
		// if (test_push_window<CUIMotionIcon>  (L, child)) return;		
		if (test_push_window<CUIProgressBar> (L, child)) return;		
		if (test_push_window<CUIStatic>		 (L, child)) return;
		if (test_push_window<CUIWindow>	     (L, child)) return;						
	}
	lua_pushnil(L);
}
Пример #10
0
CUIStatic* UIHelper::CreateStatic( CUIXml& xml, LPCSTR ui_path, CUIWindow* parent )
{
	CUIStatic* ui			= new CUIStatic();
	parent->AttachChild		( ui );
	ui->SetAutoDelete		( true );
	CUIXmlInit::InitStatic	( xml, ui_path, 0, ui );
	return ui;
}
Пример #11
0
CUIStatic* CScriptXmlInit::InitStatic(LPCSTR path, CUIWindow* parent){
	CUIStatic* pWnd = xr_new<CUIStatic>();
	CUIXmlInit::InitStatic(m_xml, path, 0, pWnd);
	pWnd->SetAutoDelete(true);
	_attach_child(pWnd, parent);
//.	if(parent) parent->AttachChild(pWnd);
	return pWnd;
}
Пример #12
0
void CUIGameLog::Update()
{
	CUIScrollView::Update();
	toDelList.clear();	


	// REMOVE ITEMS WITH COMPLETED ANIMATION
	WINDOW_LIST_it end_it = m_pad->GetChildWndList().end();
	WINDOW_LIST_it begin_it = m_pad->GetChildWndList().begin();

	for(WINDOW_LIST_it it = begin_it; it!=end_it; ++it)
	{
		CUIStatic* pItem = smart_cast<CUIStatic*>(*it);
		VERIFY(pItem);
		pItem->Update();

		if (pItem->IsClrAnimStoped())
			toDelList.push_back(pItem);
	}

	// Delete elements
	{
		xr_vector<CUIWindow*>::iterator it;
		for (it = toDelList.begin(); it != toDelList.end(); it++)
			RemoveWindow(*it);
	}

	// REMOVE INVISIBLE AND PART VISIBLE ITEMS
	if(m_flags.test	(eNeedRecalc) )
		RecalcSize			();

	toDelList.clear();
	Frect visible_rect;
	GetAbsoluteRect(visible_rect);
	for(	WINDOW_LIST_it it = m_pad->GetChildWndList().begin(); 
			m_pad->GetChildWndList().end()!=it; 
			++it)
	{
		Frect	r;
		(*it)->GetAbsoluteRect(r);
		if(! (visible_rect.in(r.x1, r.y1) && visible_rect.in(r.x2, r.y1) && visible_rect.in(r.x1, r.y2) && visible_rect.in(r.x2, r.y2)))
		{
			toDelList.push_back(*it);			
		}
			
	}

	// Delete elements
	{
		xr_vector<CUIWindow*>::iterator it;
		for (it = toDelList.begin(); it != toDelList.end(); it++)
			RemoveWindow(*it);
	}

	if(m_flags.test	(eNeedRecalc) )
		RecalcSize			();
}
Пример #13
0
void CUICharacterInfo::Init_StrInfoItem( CUIXml& xml_doc, LPCSTR item_str, UIItemType type )
{
	if ( xml_doc.NavigateToNode( item_str, 0 ) )
	{
		CUIStatic*	pItem = m_icons[type] = xr_new<CUIStatic>();
		CUIXmlInit::InitStatic( xml_doc, item_str, 0, pItem );
		AttachChild( pItem );
		pItem->SetAutoDelete( true );
	}
}
Пример #14
0
	virtual void		OnDraw(CUIDragItem* drag_item)
	{
		Fvector2 pos = drag_item->GetWndPos();
		Fvector2 icon_sz = m_icon.GetWndSize();
		Fvector2 drag_sz = drag_item->GetWndSize();

		pos.x -= icon_sz.x;
		pos.y += drag_sz.y;

		m_icon.SetWndPos(pos);
		//		m_icon.SetWndSize(sz);
		m_icon.Draw();
	}
Пример #15
0
void CUIRankIndicator::InitFromXml(CUIXml& xml_doc)
{
	CUIXmlInit::InitWindow(xml_doc, "rank_wnd", 0,	this);
	string256	str;
	for(u8 i=0; i<max_rank;++i){
		CUIStatic*&	s	= m_ranks[i];
		s				= xr_new<CUIStatic>();
		xr_sprintf(str, "rank_wnd:rank_%d", i);
		CUIXmlInit::InitStatic(xml_doc, str, 0,	s);
	}
	CUIStatic* back	= xr_new<CUIStatic>(); back->SetAutoDelete(true);
	CUIXmlInit::InitStatic(xml_doc, "rank_wnd:background", 0,	back);
	AttachChild	(back);
}
Пример #16
0
void CUIStatix::OnFocusLost()
{
	CUIStatic::OnFocusLost	();
	CUIStatic* child = smart_cast<CUIStatic* >(FindChild("auto_static_0"));
	if(child)
		child->SetTextureColor(0x00ffffff);
	else
		SetTextureColor(0xffffffff);

	if (!IsEnabled())
	{
		SetTextureColor(0x80ffffff);
	};
}
Пример #17
0
void CUIArtefactDetectorElite::construct(CEliteDetector* p)
{
	m_parent							= p;
	CUIXml								uiXml;
	uiXml.Load							(CONFIG_PATH, UI_PATH, "ui_detector_artefact.xml");

	CUIXmlInit							xml_init;
	string512							buff;
	xr_strcpy							(buff, p->ui_xml_tag());

	xml_init.InitWindow					(uiXml, buff, 0, this);

	m_wrk_area							= xr_new<CUIWindow>();

	xr_sprintf							(buff, "%s:wrk_area", p->ui_xml_tag());

	xml_init.InitWindow					(uiXml, buff, 0, m_wrk_area);
	m_wrk_area->SetAutoDelete			(true);
	AttachChild							(m_wrk_area);

	xr_sprintf							(buff, "%s", p->ui_xml_tag());
	int num = uiXml.GetNodesNum			(buff,0,"palette");
	XML_NODE* pStoredRoot				= uiXml.GetLocalRoot();
	uiXml.SetLocalRoot					(uiXml.NavigateToNode(buff,0));
	for(int idx=0; idx<num;++idx)
	{
		CUIStatic* S					= xr_new<CUIStatic>();
		shared_str name					= uiXml.ReadAttrib("palette",idx,"id");
		m_palette[name]					= S;
		xml_init.InitStatic				(uiXml, "palette", idx, S);
		S->SetAutoDelete				(true);
		m_wrk_area->AttachChild			(S);
		S->SetCustomDraw				(true);
	}
	uiXml.SetLocalRoot					(pStoredRoot);

	Fvector _map_attach_p				= pSettings->r_fvector3(m_parent->cNameSect(), "ui_p");
	Fvector _map_attach_r				= pSettings->r_fvector3(m_parent->cNameSect(), "ui_r");
	
	_map_attach_r.mul					(PI/180.f);
	m_map_attach_offset.setHPB			(_map_attach_r.x, _map_attach_r.y, _map_attach_r.z);
	m_map_attach_offset.translate_over	(_map_attach_p);
}
Пример #18
0
void CUIStatix::Update()
{
	CUIStatic* child = smart_cast<CUIStatic* >(FindChild("auto_static_0"));
	if(child)
		child->SetTextureColor(0x00ffffff);
	SetTextureColor(0xffffffff);

	if (m_bCursorOverWindow)
	{
		if(child)
			child->SetTextureColor(0xff349F06);
		else
			SetTextureColor(0xff349F06);
	}

	if (!IsEnabled())
	{
		SetTextureColor(0x80ffffff);
	};
	
	CUIStatic::Update();
}
Пример #19
0
CUIStatic* CUIListBoxItem::AddField(LPCSTR txt, float len, LPCSTR key)
{
	fields.push_back		(xr_new<CUIStatic>());
	CUIStatic* st			= fields.back();
	AttachChild				(st);
	st->Init				(FieldsLength(),0, GetWidth(), len);
	st->SetFont				(GetFont());
	st->SetTextAlignment	(GetTextAlignment());
	st->SetVTextAlignment	(m_lines.GetVTextAlignment());
	st->SetTextColor		(GetTextColor());
	st->SetText				(txt);	
	st->SetWindowName		(key);

	return st;
}
Пример #20
0
void CUIGameLog::AddChatMessage(LPCSTR msg, LPCSTR author){
	string256 fullLine;
	sprintf_s(fullLine, "%s %s", author, msg);
	_TrimRight	(fullLine);
    
	CUIStatic* pItem = NULL;

	pItem = xr_new<CUIStatic>();
	pItem->SetTextComplexMode		(true);
	pItem->SetText(fullLine);
    pItem->m_pLines->SetCutWordsMode(true);
	pItem->SetFont(GetFont());
	pItem->SetTextColor(txt_color);
	pItem->SetClrAnimDelay(5000.0f);
	pItem->SetClrLightAnim(CHAT_LOG_ITEMS_ANIMATION, false, true, true, true);	
	pItem->SetWidth(this->GetDesiredChildWidth());
	pItem->AdjustHeightToText();
	AddWindow(pItem, true);	
}
Пример #21
0
void RearrangeTabButtons(CUITabControl* pTab, xr_vector<Fvector2>& vec_sign_places)
{
	TABS_VECTOR *	btn_vec		= pTab->GetButtonsVector();
	TABS_VECTOR::iterator it	= btn_vec->begin();
	TABS_VECTOR::iterator it_e	= btn_vec->end();
	vec_sign_places.clear		();
	vec_sign_places.resize		(btn_vec->size());

	Fvector2					pos;
	pos.set						((*it)->GetWndPos());
	Fvector2					sign_sz;
	sign_sz.set					(9.0f+3.0f, 11.0f);
	u32 idx						= 0;
	float	btn_text_len		= 0.0f;
	CUIStatic* st				= NULL;

	for(;it!=it_e;++it,++idx)
	{
		if(idx!=0)
		{
			st = xr_new<CUIStatic>(); st->SetAutoDelete(true);pTab->AttachChild(st);
			st->SetFont((*it)->GetFont());
			st->SetTextColor	(color_rgba(90,90,90,255));
			st->SetText("//");
			st->SetWndSize		((*it)->GetWndSize());
			st->AdjustWidthToText();
			st->SetWndPos		(pos);
			pos.x				+= st->GetWndSize().x;
		}

		vec_sign_places[idx].set(pos);
		vec_sign_places[idx].y	+= iFloor(((*it)->GetWndSize().y - sign_sz.y)/2.0f);
		vec_sign_places[idx].y	= (float)iFloor(vec_sign_places[idx].y);
		pos.x					+= sign_sz.x;

		(*it)->SetWndPos		(pos);
		(*it)->AdjustWidthToText();
		btn_text_len			= (*it)->GetWndSize().x;
		pos.x					+= btn_text_len+3.0f;
	}

}
Пример #22
0
void CUIMpTradeWnd::UpdateMoneyIndicator()
{
	if(m_bIgnoreMoneyAndRank)
	{
		m_static_player_money->SetText	("---");
	}else
	{
		u32 _cost						= 0;
		string128						buff;
		sprintf_s							(buff, "%d", m_money);
		m_static_player_money->SetText	(buff);
		//update preset money
		for(u32 i=_preset_idx_last; i<=_preset_idx_3; ++i)
		{
			CUIStatic* st				= m_static_preset_money[i];
			_cost						= GetPresetCost((ETradePreset)i);
			sprintf_s						(buff, "%d", _cost);
			st->SetText					(buff);
			bool b_has_enought_money	= _cost<=GetMoneyAmount();
			u32 clr						= (b_has_enought_money)?m_text_color_money_positive:m_text_color_money_negative;
			st->SetTextColor			(clr);
			const preset_items&		v	=  GetPreset((ETradePreset)i);
			m_btns_preset[i]->Enable	(b_has_enought_money && v.size()!=0);
		}
	}

	if( !(Device.dwFrame%30) )
	{
		u32 _cost						= 0;
		string128						buff;
		StorePreset						(_preset_idx_temp, true, false, false);
		_cost							= GetPresetCost(_preset_idx_temp);
		sprintf_s							(buff, "%d", _cost);
		m_static_curr_items_money->SetText(buff);
	}
}
Пример #23
0
void tweaker::init()
{
	options.apply();

	fullyInited = false;

	visible = false;

	dialog = new CUIDialog();
	dialog->enableNonUserEvents( true );
	dialog->setCallback( dlgCallback );
	dialog->setBackgroundColors( 0x80303030 );
	dialog->setLocation( 420, 20 );
	dialog->setSize( 200, 340 );
	dialog->setFont( 1, "Verdana", 22, 50 );
	dialog->setFont( 2, "Verdana", 14, 50 );

	int yline;
	const float HC = 18;
	const float DYLINE = HC+2;

	CUIStatic* lab;

	const int xcol = 30;
	yline = 10;
	dialog->addStatic( 0, "Graphics options", xcol-10, yline, 200, 22, false, &lab );
	lab->getElement(0)->setFont( 1, false, DT_LEFT | DT_VCENTER );
	yline += DYLINE/2;

	dialog->addCheckBox( GID_CHK_WIREFRAME, "Wireframe", xcol, yline+=DYLINE, 130, HC, options.wireframe );
	dialog->addCheckBox( GID_CHK_SHADOWS, "Shadows", xcol, yline+=DYLINE, 130, HC, options.shadows );
	dialog->addCheckBox( GID_CHK_REFLECTIONS, "Reflections", xcol, yline+=DYLINE, 130, HC, options.reflections );
	dialog->addCheckBox( GID_CHK_DOF, "Depth of field", xcol, yline+=DYLINE, 130, HC, options.dof );
	dialog->addCheckBox( GID_CHK_NORMALMAPS, "Normal mapping", xcol, yline+=DYLINE, 130, HC, options.normalmaps );
	dialog->addCheckBox( GID_CHK_AO, "Ambient occlusion", xcol, yline+=DYLINE, 130, HC, options.ao );
	
	dialog->addStatic( 0, "Various", xcol-10, yline+=DYLINE+5, 200, 22, false, &lab );
	lab->getElement(0)->setFont( 2, false, DT_LEFT | DT_VCENTER );
	
	dialog->addCheckBox( GID_CHK_SHOWFPS, "Display FPS", xcol, yline+=DYLINE+5, 130, HC, options.showFPS );
	dialog->addCheckBox( GID_CHK_FUNKY, "I want more colors!", xcol, yline+=DYLINE, 130, HC, options.funky );
	
	dialog->addStatic( 0, "Interactive mode", xcol-10, yline+=DYLINE+DYLINE/2, 200, 22, false, &lab );
	lab->getElement(0)->setFont( 1, false, DT_LEFT | DT_VCENTER );
	yline += DYLINE/2;

	dialog->addCheckBox( GID_CHK_HIDEWALLS, "Hide room walls", xcol, yline+=DYLINE, 130, HC, options.hideWalls );
	
	// buttons
	dialog->addStatic( 0, "[f1] hides/shows this dialog", 0, dialog->getHeight()-DYLINE-DYLINE/2, dialog->getWidth()-14, HC, false, &lab );
	lab->getElement(0)->setFont( 0, false, DT_RIGHT | DT_VCENTER );
	lab->setTextColor( 0xA0ffffff );

	fullyInited = true;
}
Пример #24
0
CUIStatic* CUIGameLog::AddLogMessage(LPCSTR msg)
{
	CUIStatic* pItem				= NULL;
	ADD_TEXT_TO_VIEW3				(msg, pItem, this);
	pItem->SetTextComplexMode		(true);
	pItem->SetFont					(GetFont());
	pItem->SetTextColor				(txt_color);
	pItem->SetClrAnimDelay			(5000.0f);
	pItem->SetClrLightAnim			(CHAT_LOG_ITEMS_ANIMATION, false, true, true, true);
	ForceUpdate						();
	return							pItem;
}
Пример #25
0
float CUIPdaKillMessage::InitText(CUIStatic& refStatic, float x, PlayerInfo& info)
{

	if ( 0 == xr_strlen(info.m_name))
		return 0.0f;

	CGameFont* pFont					= GetFont();
	float _eps							= pFont->SizeOf_(' ');
	UI()->ClientToScreenScaledWidth		(_eps); //add one letter

	float height						= pFont->CurrentHeight_();
	float y								= (GetHeight() - height)/2;

	refStatic.SetWndPos					(Fvector2().set(x, y));
	refStatic.SetHeight					(GetHeight());
	refStatic.SetEllipsis				(1, 0);
	refStatic.SetText					(info.m_name.c_str());
	refStatic.AdjustWidthToText			();
	refStatic.SetWidth					(refStatic.GetWidth()+_eps);
	refStatic.SetTextColor				(info.m_color);

	return		refStatic.GetWidth		();
}
void CUIDragDropReferenceList::LoadItemTexture(LPCSTR section, Ivector2 cell_pos)
{
	CUIStatic* ref = m_references[cell_pos.x];
	ref->SetShader(InventoryUtilities::GetEquipmentIconsShader());
	Frect texture_rect;
	texture_rect.x1	= pSettings->r_float(section, "inv_grid_x")		*INV_GRID_WIDTH;
	texture_rect.y1	= pSettings->r_float(section, "inv_grid_y")		*INV_GRID_HEIGHT;
	texture_rect.x2	= pSettings->r_float(section, "inv_grid_width")	*INV_GRID_WIDTH;
	texture_rect.y2	= pSettings->r_float(section, "inv_grid_height")*INV_GRID_HEIGHT;
	texture_rect.rb.add(texture_rect.lt);
	ref->SetTextureRect(texture_rect);
	ref->TextureOn();
	ref->SetTextureColor(color_rgba(255,255,255,255));
	ref->SetStretchTexture(true);
}
void CUIDragDropReferenceList::SetItem(CUICellItem* itm, Ivector2 cell_pos)
{
	CUIStatic* ref = m_references[cell_pos.x];
	ref->SetShader(itm->GetShader());
	ref->SetTextureRect(itm->GetTextureRect());
	ref->TextureOn();
	ref->SetTextureColor(color_rgba(255,255,255,255));
	ref->SetStretchTexture(true);

	CUICell& C = m_container->GetCellAt(cell_pos);
	if(C.m_item!=itm)
	{
		m_container->PlaceItemAtPos(itm, cell_pos);
		itm->SetWindowName("cell_item");
		Register(itm);
		itm->SetOwnerList(this);
	}
}
Пример #28
0
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;
}
Пример #29
0
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);
	}
}
Пример #30
0
void CUIDebugFonts::FillUpList(){
	CFontManager::FONTS_VEC& v = UI()->Font()->m_all_fonts;
	CFontManager::FONTS_VEC_IT it	= v.begin();
	CFontManager::FONTS_VEC_IT it_e = v.end();
	Fvector2 pos, sz;
	pos.set			(0,0);
	sz.set			(UI_BASE_WIDTH,UI_BASE_HEIGHT);
	string256		str;
	for(;it!=it_e;++it){
		CGameFont* F			= *(*it);
		CUIStatic* pItem		= xr_new<CUIStatic>();
		pItem->SetWndPos		(pos);
		pItem->SetWndSize		(sz);
		sprintf_s					(str, "%s:%s", *F->m_font_name, *CStringTable().translate("Test_Font_String"));
		pItem->SetFont			(F);
		pItem->SetText			(str);
		pItem->SetTextComplexMode(false);
		pItem->SetVTextAlignment(valCenter);
		pItem->SetTextAlignment	(CGameFont::alCenter);
		pItem->AdjustHeightToText();
		pos.y					+= pItem->GetHeight()+20.0f;
		pItem->SetAutoDelete	(true);
		AttachChild				(pItem);
	}

}