コード例 #1
0
ファイル: HUDManager.cpp プロジェクト: OLR-xray/XRay-NEW
void  CHUDManager::RenderUI()
{
	if(!b_online)					return;

	BOOL bAlready					= FALSE;
	if (true || psHUD_Flags.is(HUD_DRAW | HUD_DRAW_RT))
	{
		HitMarker.Render			();
		bAlready					= ! (pUI && !pUI->Render());
		Font().Render();
	}

	if (psHUD_Flags.is(HUD_CROSSHAIR|HUD_CROSSHAIR_RT|HUD_CROSSHAIR_RT2) && !bAlready)	
		m_pHUDTarget->Render();

	draw_wnds_rects		();

	if( Device.Paused() && bShowPauseString){
		CGameFont* pFont	= Font().pFontGraffiti50Russian;
		pFont->SetColor		(0x80FF0000	);
		LPCSTR _str			= CStringTable().translate("st_game_paused").c_str();
		
		Fvector2			_pos;
		_pos.set			(UI_BASE_WIDTH/2.0f, UI_BASE_HEIGHT/2.0f);
		UI()->ClientToScreenScaled(_pos);
		pFont->SetAligment	(CGameFont::alCenter);
		pFont->Out			(_pos.x, _pos.y, _str);
		pFont->OnRender		();
	}

}
コード例 #2
0
void CUICellItemTradeMenuDraw::OnDraw(CUICellItem* cell)
{
	Fvector2							pos;
	cell->GetAbsolutePos				(pos);
	UI().ClientToScreenScaled			(pos, pos.x, pos.y);

	int acc									= cell->GetAccelerator();
	if(acc!=0)
	{
		if(acc==11)							
			acc = 1;
		string64							buff;

		xr_sprintf							(buff," %d", acc - DIK_ESCAPE);
		CGameFont* pFont					= UI().Font().pFontLetterica16Russian;
		pFont->SetAligment					(CGameFont::alCenter);
		pFont->SetColor						(color_rgba(135,123,116,255));
		pFont->Out							(pos.x, pos.y, buff);
		pFont->OnRender						();
	}

	bool b_can_buy_rank		= m_trade_wnd->CheckBuyPossibility(m_info_item->m_name_sect, CUIMpTradeWnd::bf_check_rank_restr, true);

	if(!b_can_buy_rank)
	{
		cell->SetTextureColor			(m_trade_wnd->m_item_color_restr_rank);
		return;
	}
	bool b_can_buy_money	= m_trade_wnd->CheckBuyPossibility(m_info_item->m_name_sect, CUIMpTradeWnd::bf_check_money, true);
	if(!b_can_buy_money)
	{
		cell->SetTextureColor			(m_trade_wnd->m_item_color_restr_money);
		return;
	}
	cell->SetTextureColor				(m_trade_wnd->m_item_color_normal);

}
コード例 #3
0
ファイル: UICustomEdit.cpp プロジェクト: AntonioModer/xray-16
void  CUICustomEdit::Draw()
{
	Fvector2 pos, out;
	GetAbsolutePos		(pos);
	CGameFont* font		= TextItemControl()->m_pFont;
	
	if ( ec().need_update() || m_force_update )
	{
		float ui_width   = GetWidth();

		LPCSTR cursor_str   = ec().str_before_cursor();
		u32 cursor_str_size = xr_strlen( cursor_str );

		LPCSTR istr			= cursor_str;
		float str_length	= font->SizeOf_( istr );
		UI().ClientToScreenScaledWidth( str_length );

		u32 ix = 0;
		while ( (str_length > ui_width) && (ix < cursor_str_size) )
		{
			istr			= cursor_str + ix;
			str_length		= font->SizeOf_( istr );
			UI().ClientToScreenScaledWidth( str_length );
			++ix;
		}
		istr				= cursor_str + ix;
		LPCSTR astr			= ec().str_edit() + ix;
		u32 str_size		= xr_strlen( ec().str_edit() );

		u32 jx = 1;
		strncpy_s			(m_out_str, sizeof(m_out_str), astr, jx);

		str_length			= font->SizeOf_(m_out_str);
		UI().ClientToScreenScaledWidth(str_length);

		while((str_length < ui_width) && (jx < str_size-ix))
		{
			strncpy_s		(m_out_str, sizeof(m_out_str), astr, jx);
			str_length		= font->SizeOf_(m_out_str);
			UI().ClientToScreenScaledWidth(str_length);
			++jx;
		}
		strncpy_s			(m_out_str, sizeof(m_out_str), astr, jx);

		TextItemControl()->SetText(m_out_str);

		if(TextItemControl()->IsPasswordMode())
		{
			string256 passText;
			shared_str str(istr);
			int sz = (int)str.size();
			for (int i = 0; i < sz; i++)
				passText[i] = '*';
			passText[sz] = 0;
			m_dx_cur			= font->SizeOf_(passText); // cursor_str
		}
		else
			m_dx_cur			= font->SizeOf_(istr); // cursor_str

		m_force_update		= false;
	}

	inherited::Draw();

	if (m_bInputFocus) //draw cursor here
	{
		out.x = pos.x + 0.0f + TextItemControl()->m_TextOffset.x + TextItemControl()->GetIndentByAlign();
		out.y = pos.y + 2.0f + TextItemControl()->m_TextOffset.y + TextItemControl()->GetVIndentByAlign();
		UI().ClientToScreenScaled( out );

		out.x += m_dx_cur; // cursor_str

		font->Out				(out.x, out.y, "_");
	}
	font->OnRender				();
}
コード例 #4
0
ファイル: UICustomEdit.cpp プロジェクト: 2asoft/xray
void  CUICustomEdit::Draw()
{
	VERIFY( m_pLines );

	Fvector2 pos, out;
	GetAbsolutePos( pos );
	CGameFont* font = m_pLines->m_pFont;
	
	if ( ec().need_update() || m_force_update )
	{
		float ui_width   = GetWidth();

		LPCSTR cursor_str   = ec().str_before_cursor();
		u32 cursor_str_size = xr_strlen( cursor_str );

		LPCSTR istr = cursor_str;
		float str_length = font->SizeOf_( istr );
		UI()->ClientToScreenScaledWidth( str_length );

		u32 ix = 0;
		while ( (str_length > ui_width) && (ix < cursor_str_size) )
		{
			istr = cursor_str + ix;
			str_length = font->SizeOf_( istr );
			UI()->ClientToScreenScaledWidth( str_length );
			++ix;
		}
		istr = cursor_str + ix;
		LPCSTR astr = ec().str_edit() + ix;
		u32 str_size = xr_strlen( ec().str_edit() );

		u32 jx = 1;
		strncpy_s( m_out_str, sizeof(m_out_str), astr, jx );

		str_length = font->SizeOf_( m_out_str );
		UI()->ClientToScreenScaledWidth( str_length );
		while ( (str_length < ui_width) && (jx < str_size-ix) )
		{
			strncpy_s( m_out_str, sizeof(m_out_str), astr, jx );
			str_length = font->SizeOf_( m_out_str );
			UI()->ClientToScreenScaledWidth( str_length );
			++jx;
		}
		strncpy_s( m_out_str, sizeof(m_out_str), astr, jx );

		inherited::SetText( m_out_str );
		m_dx_cur = font->SizeOf_( istr ); // cursor_str

		m_force_update = false;
	}

	inherited::Draw();

	if ( m_bInputFocus ) //draw cursor here
	{
		out.x = pos.x + 0.0f + GetTextX() + m_pLines->GetIndentByAlign();
		out.y = pos.y + 2.0f + GetTextY() + m_pLines->GetVIndentByAlign();
		UI()->ClientToScreenScaled( out );

		out.x += m_dx_cur; // cursor_str

		font->Out( out.x, out.y, "_" );
	}
	font->OnRender();
}