Beispiel #1
0
void CServerList::Update()
{
	//	browser().Update();
	
	if (m_need_refresh_fr<Device.dwFrame+10)
		RefreshList_internal();

	if (m_bAnimation)
	{
		m_pAnimation->Update();

		m_frame[LST_SRV_PROP].SetColor(subst_alpha(0xffffffff, color_get_A(m_pAnimation->GetColor())));
		m_frame[LST_PLAYERS].SetColor(subst_alpha(0xffffffff, color_get_A(m_pAnimation->GetColor())));


		if (m_pAnimation->Done())
		{
			m_bAnimation = false;
			if (m_bShowServerInfo)
				AfterAppear();
			else
				AfterDisappear();
		}
	}
	CUIWindow::Update();
}
Beispiel #2
0
void CUITextBanner::EffectFlicker()
{
	EffectParams	&flicker = m_StyleParams[tbsFlicker];

	// Проверям включена ли анимация
	if (!flicker.bOn) return;

	// Если пришло время, показать/спрятать надпись
	if (flicker.fTimePassed > flicker.fPeriod)
	{
		if (!flicker.bCyclic)
		{ 
			flicker.bOn = false;
			return;
		}
		
		if (0 == flicker.iEffectStage)
			flicker.iEffectStage = 1;
		else
			flicker.iEffectStage = 0;
		flicker.fTimePassed = 0;
	}

	if (flicker.iEffectStage)
	{
		m_Cl = subst_alpha(GetTextColor(), 0);
	}
	else
	{
		m_Cl = subst_alpha(GetTextColor(), 255);
	}
}
Beispiel #3
0
void CUITextBanner::EffectFade()
{
	EffectParams	&fade = m_StyleParams[tbsFade];

	// Проверям включена ли анимация
	if (!fade.bOn) return;

	// Если пришло время сменить направление фейда
	if (fade.fTimePassed > fade.fPeriod)
	{
		if (!fade.bCyclic)
		{
			fade.bOn = false;
			return;
		}

		if (0 == fade.iEffectStage)
			fade.iEffectStage = 1;
		else
			fade.iEffectStage = 0;
		fade.fTimePassed = 0;
	}

	if (fade.iEffectStage)
	{
		m_Cl = subst_alpha(GetTextColor(), u8(iFloor(255.f*(fade.fTimePassed / fade.fPeriod))));
	}
	else
	{
		m_Cl = subst_alpha(GetTextColor(), u8(iFloor(255.f*(1 - (fade.fTimePassed / fade.fPeriod)))));
	}
}
void CRenderTarget::phase_pp		()
{
	// combination/postprocess
	u_setrt				( Device.dwWidth,Device.dwHeight,HW.pBaseRT,NULL,NULL,HW.pBaseZB);
	//	Element 0 for for normal post-process
	//	Element 4 for color map post-process
	bool	bCMap = u_need_CM();
	//RCache.set_Element	(s_postprocess->E[bCMap ? 4 : 0]);
	if( !RImplementation.o.dx10_msaa )
	{
		//		RCache.set_Shader	(s_postprocess	);
		RCache.set_Element	(s_postprocess->E[bCMap ? 4 : 0]);
	}
	else
	{
		//		RCache.set_Shader( s_postprocess_msaa );
		RCache.set_Element	(s_postprocess_msaa->E[bCMap ? 4 : 0]);
	}

	int		gblend		= clampr		(iFloor((1-param_gray)*255.f),0,255);
	int		nblend		= clampr		(iFloor((1-param_noise)*255.f),0,255);
	u32					p_color			= subst_alpha		(param_color_base,nblend);
	u32					p_gray			= subst_alpha		(param_color_gray,gblend);
	Fvector				p_brightness	= param_color_add	;
	// Msg				("param_gray:%f(%d),param_noise:%f(%d)",param_gray,gblend,param_noise,nblend);
	// Msg				("base: %d,%d,%d",	color_get_R(p_color),		color_get_G(p_color),		color_get_B(p_color));
	// Msg				("gray: %d,%d,%d",	color_get_R(p_gray),		color_get_G(p_gray),		color_get_B(p_gray));
	// Msg				("add:  %d,%d,%d",	color_get_R(p_brightness),	color_get_G(p_brightness),	color_get_B(p_brightness));
	
	// Draw full-screen quad textured with our scene image
	u32		Offset;
	float	_w			= float(Device.dwWidth);
	float	_h			= float(Device.dwHeight);
	
	Fvector2			n0,n1,r0,r1,l0,l1;
	u_calc_tc_duality_ss	(r0,r1,l0,l1);
	u_calc_tc_noise			(n0,n1);

	// Fill vertex buffer
	float				du	= ps_r1_pps_u, dv = ps_r1_pps_v;
	TL_2c3uv* pv			= (TL_2c3uv*) RCache.Vertex.Lock	(4,g_postprocess.stride(),Offset);
	pv->set(du+0,			dv+float(_h),	p_color, p_gray, r0.x, r1.y, l0.x, l1.y, n0.x, n1.y);	pv++;
	pv->set(du+0,			dv+0,			p_color, p_gray, r0.x, r0.y, l0.x, l0.y, n0.x, n0.y);	pv++;
	pv->set(du+float(_w),	dv+float(_h),	p_color, p_gray, r1.x, r1.y, l1.x, l1.y, n1.x, n1.y);	pv++;
	pv->set(du+float(_w),	dv+0,			p_color, p_gray, r1.x, r0.y, l1.x, l0.y, n1.x, n0.y);	pv++;
	RCache.Vertex.Unlock										(4,g_postprocess.stride());

	// Actual rendering
	static	shared_str	s_brightness	= "c_brightness";
	static	shared_str	s_colormap		= "c_colormap";
	RCache.set_c		( s_brightness, p_brightness.x, p_brightness.y, p_brightness.z, 0 );
	RCache.set_c		(s_colormap, param_color_map_influence,param_color_map_interpolate,0,0);
	RCache.set_Geometry	(g_postprocess);
	RCache.Render		(D3DPT_TRIANGLELIST,Offset,0,4,0,2);
}
void CUIStalkerRankingInfoItem::SetSelected	(bool b)
{
	CUISelectable::SetSelected				(b);
	m_text1->SetTextColor( subst_alpha(m_text1->GetTextColor(), b?255:m_stored_alpha ));
	m_text2->SetTextColor( subst_alpha(m_text2->GetTextColor(), b?255:m_stored_alpha ));
	m_text3->SetTextColor( subst_alpha(m_text3->GetTextColor(), b?255:m_stored_alpha ));
	if(b){ 
		m_StalkersRankingWnd->ShowHumanInfo			(m_humanID);
	}

}
Beispiel #6
0
void CLight::Render(int priority, bool strictB2F)
{
	inherited::Render(priority,strictB2F);
    if ((1==priority)&&(false==strictB2F)){
        Device.SetShader		(Device.m_WireShader);
        RCache.set_xform_world	(Fidentity);
    	u32 clr = Locked()?LOCK_COLOR:(Selected()?SEL_COLOR:(m_Flags.is(ELight::flAffectDynamic)?NORM_DYN_COLOR:NORM_COLOR));
    	switch (m_Type){
        case ELight::ltPoint:
            if (Selected()) 	DU.DrawLineSphere( PPosition, m_Range, clr, true );
            DU.DrawPointLight(PPosition,VIS_RADIUS, clr);
            if (m_Flags.is(ELight::flPointFuzzy)){
            	VERIFY(m_FuzzyData);
			    for (FvectorIt it=m_FuzzyData->m_Positions.begin(); it!=m_FuzzyData->m_Positions.end(); it++){
                	Fvector tmp; _Transform().transform_tiny(tmp,*it);
		            DU.DrawPointLight(tmp,VIS_RADIUS/6, clr);
	            }
			}
        break;
        case ELight::ltSpot:{
//			Fvector dir;
//			dir.setHP		(PRotation.y,PRotation.x);
//			DU.DrawCone		(Fidentity, PPosition, dir, Selected()?m_Range:VIS_RADIUS, radius2, clr, true, false);
        	if (Selected())	DU.DrawSpotLight( PPosition, FTransformR.k, m_Range, m_Cone, clr );
            else			DU.DrawSpotLight( PPosition, FTransformR.k, VIS_RADIUS, m_Cone, clr );
        }break;
        default: THROW;
        }
    	ESceneLightTools* lt = dynamic_cast<ESceneLightTools*>(ParentTools); VERIFY(lt);
        if (lt->m_Flags.is(ESceneLightTools::flShowControlName)){ 
            Fvector D;	D.sub(Device.vCameraPosition,PPosition);
            float dist 	= D.normalize_magn();
        	if (!Scene->RayPickObject(dist,PPosition,D,OBJCLASS_SCENEOBJECT,0,0))
	        	DU.OutText (PPosition,AnsiString().sprintf(" %s",GetLControlName()).c_str(),0xffffffff,0xff000000);
        }
    }else if ((1==priority)&&(true==strictB2F)){
        Device.SetShader		(Device.m_SelectionShader);
        RCache.set_xform_world	(Fidentity);
    	switch (m_Type){
        case ELight::ltPoint:
            if (m_Flags.is(ELight::flPointFuzzy)){
		    	u32 clr = Locked()?LOCK_COLOR:(Selected()?SEL_COLOR:(m_Flags.is(ELight::flAffectDynamic)?NORM_DYN_COLOR:NORM_COLOR));
                clr 	= subst_alpha(clr,0x40);
            	const Fvector zero={0.f,0.f,0.f};
                VERIFY(m_FuzzyData);
                switch (m_FuzzyData->m_ShapeType){
                case CLight::SFuzzyData::fstSphere: 
                	DU.DrawSphere	(_Transform(),zero,m_FuzzyData->m_SphereRadius,clr,clr,true,true);
                break;
                case CLight::SFuzzyData::fstBox:
                	DU.DrawAABB		(_Transform(),zero,m_FuzzyData->m_BoxDimension,clr,clr,true,true);
                break;
                }
			}
        break;
        case ELight::ltSpot:		break;
        default: THROW;
        }
	}
}
Beispiel #7
0
void ELightAnimLibrary::Load()
{
	string_path fn;
    FS.update_path(fn,_game_data_,"lanims.xr");
	IReader* fs=FS.r_open(fn);
    if (fs){
    	u16 version	= 0;
    	if (fs->find_chunk(CHUNK_VERSION)){
        	version	= fs->r_u16();
        }
        IReader* OBJ = fs->open_chunk(CHUNK_ITEM_LIST);
        if (OBJ){
	        IReader* O   = OBJ->open_chunk(0);
    	    for (int count=1; O; count++) {
        	    CLAItem* I = xr_new<CLAItem>();
                I->Load(*O);
                if (version==0){
                    for (CLAItem::KeyPairIt it=I->Keys.begin(); it!=I->Keys.end(); it++)
                        it->second	= subst_alpha(bgr2rgb(it->second),color_get_A(it->second));
                }
                Items.push_back(I);
            	O->close();
	            O = OBJ->open_chunk(count);
    	    }
	        OBJ->close();
        }

		FS.r_close(fs);
    }
}
Beispiel #8
0
void CUIActorStaticticHeader::SetSelected(bool b)
{
	CUISelectable::SetSelected(b);
	m_text1->SetTextColor( subst_alpha(m_text1->GetTextColor(), b?255:m_stored_alpha ));
	if(b){ 
		m_actorInfoWnd->FillPointsDetail			(m_id);
	}
}
Beispiel #9
0
void SHitMark::Draw( float cam_dir )
{
	int frame;
	u32 clr	= m_lanim->CalculateRGB( Device.fTimeGlobal - m_StartTime,frame );
	m_UIStaticItem->SetTextureColor( subst_alpha( m_UIStaticItem->GetTextureColor(), color_get_A(clr) ) );

	m_UIStaticItem->Render( cam_dir + m_HitDirection );
}
Beispiel #10
0
void SGrenadeMark::Draw( float cam_dir )
{
	int frame;
	u32 clr = m_LightAnim->CalculateRGB( 2.0f*(Device.fTimeGlobal - m_LastTime), frame );
	m_UIStaticItem->SetTextureColor( subst_alpha( m_UIStaticItem->GetTextureColor(), color_get_A(clr) ) );

	m_UIStaticItem->Render( cam_dir + m_Angle );
}
Beispiel #11
0
void CUIMoneyIndicator::Update(){
	if (m_money_change.GetVisible())
        if (!m_pAnimChange->Done())
		{
			m_pAnimChange->Update();
			m_money_change.SetTextColor(subst_alpha(m_money_change.GetTextColor(), m_pAnimChange->GetColor()));
		}
		else
			m_money_change.SetVisible(false);

	CUIWindow::Update();
}
Beispiel #12
0
void CUIEditKeyBind::Update()
{
	CUILabel::Update();

	m_bTextureAvailable = m_bCursorOverWindow;
	if (m_bEditMode)
	{
		m_pAnimation->Update();
		m_lines.SetTextColor((subst_alpha(m_lines.GetTextColor(), color_get_A(m_pAnimation->GetColor()))));
	}
	
}
Beispiel #13
0
void __fastcall TfrmEditLightAnim::OnIdle()
{
	if (form){
		if (form->m_CurrentItem){
        	int 	frame;
            u32 C 	= form->m_CurrentItem->CalculateBGR(Device.fTimeGlobal,frame);
			form->paColor->Color		= TColor(subst_alpha(C,0));
            form->lbCurFrame->Caption	= AnsiString().sprintf("%d",frame);
            form->lbAlpha->Caption		= AnsiString().sprintf("[%d]",color_get_A(C));
        }
        UI->RedrawScene();
    }
}
Beispiel #14
0
CUILine* CUILines::ParseTextToColoredLine(const xr_string& str) {
    CUILine* line = xr_new<CUILine>();
    xr_string tmp = str;
    xr_string entry;
    u32 color;

    do
    {
        CutFirstColoredTextEntry(entry, color, tmp);
        line->AddSubLine(entry, subst_alpha(color, color_get_A(GetTextColor())));
    }
    while (tmp.size()>0);

    return line;
}
Beispiel #15
0
void CPortalTraverser::fade_render	()
{
	if (f_portals.empty())			return;

	// re-sort, back to front
	std::sort						(f_portals.begin(),f_portals.end(),psort_pred);
	
	// calc poly-count
	u32		_pcount					= 0;
	for		(u32 _it = 0; _it<f_portals.size(); _it++)	_pcount	+= f_portals[_it].first->getPoly().size()-2;

	// fill buffers
	u32			_offset				= 0;
	FVF::L*		_v					= (FVF::L*)RCache.Vertex.Lock(_pcount*3,f_geom.stride(),_offset);
	float		ssaRange			= r_ssaLOD_A - r_ssaLOD_B;
	Fvector		_ambient_f			= g_pGamePersistent->Environment().CurrentEnv.ambient;
	u32			_ambient			= color_rgba_f	(_ambient_f.x,_ambient_f.y,_ambient_f.z,0);
	for (u32 _it = 0; _it<f_portals.size(); _it++)
	{
		std::pair<CPortal*, float>&	fp		= f_portals	[_it]	;
		CPortal*					_P		= fp.first	;
		float						_ssa	= fp.second	;
		float		ssaDiff					= _ssa-r_ssaLOD_B	;
		float		ssaScale				= ssaDiff/ssaRange	;
		int			iA						= iFloor((1-ssaScale)*255.5f);	clamp(iA,0,255);
		u32							_clr	= subst_alpha(_ambient,u32(iA));	

		// fill polys
		u32			_polys					= _P->getPoly().size()-2;
		for			(u32 _pit=0; _pit<_polys; _pit++)	{
			_v->set	(_P->getPoly()[0],		_clr);	_v++;
			_v->set (_P->getPoly()[_pit+1],_clr);	_v++;
			_v->set (_P->getPoly()[_pit+2],_clr);	_v++;
		}
	}
	RCache.Vertex.Unlock			(_pcount*3,f_geom.stride());

	// render
	RCache.set_xform_world			(Fidentity);
	RCache.set_Shader				(f_shader);
	RCache.set_Geometry				(f_geom);
	RCache.set_CullMode				(CULL_NONE);
	RCache.Render					(D3DPT_TRIANGLELIST,_offset,_pcount);
	RCache.set_CullMode				(CULL_CCW);

	// cleanup
	f_portals.clear					();
}
Beispiel #16
0
void CEditShape::Render(int priority, bool strictB2F)
{
	inherited::Render(priority, strictB2F);
    if (1==priority){
        if (strictB2F){
	        Device.SetShader			(Device.m_WireShader);
            Device.SetRS				(D3DRS_CULLMODE,D3DCULL_NONE);
            u32 clr 					= Selected()?subst_alpha(m_DrawTranspColor, color_get_A(m_DrawTranspColor)*2):m_DrawTranspColor;
                
            Fvector zero				={0.f,0.f,0.f};
            for (ShapeIt it=shapes.begin(); it!=shapes.end(); ++it)
            {
                switch(it->type)
                {
                case cfSphere:
                {
                    Fsphere& S			= it->data.sphere;
                    Fmatrix B;
                    B.scale				(S.R,S.R,S.R);
                    B.translate_over	(S.P);
                    B.mulA_43			(_Transform());
                    RCache.set_xform_world(B);
                    Device.SetShader	(Device.m_WireShader);
                    DU_impl.DrawCross	(zero,1.f,m_DrawEdgeColor,false);
                    DU_impl.DrawIdentSphere	(true,true,clr,m_DrawEdgeColor);
                }break;
                case cfBox:
                {
                    Fmatrix B			= it->data.box;
                    B.mulA_43			(_Transform());
                    RCache.set_xform_world(B);
                    DU_impl.DrawIdentBox(true,true,clr,m_DrawEdgeColor);
                }break;
                }
            }
            Device.SetRS(D3DRS_CULLMODE,D3DCULL_CCW);
        }else{
            if( Selected()&&m_Box.is_valid() ){
		        Device.SetShader		(Device.m_SelectionShader);
                RCache.set_xform_world	(_Transform());
                u32 clr 				= 0xFFFFFFFF;
                Device.SetShader		(Device.m_WireShader);
                DU_impl.DrawSelectionBox(m_Box,&clr);
            }
        }
    }
}
Beispiel #17
0
void CMapLocation::UpdateSpotPointer(CUICustomMap* map, CMapSpotPointer* sp )
{
	if(sp->GetParent()) return ;// already is child
	float		heading;
	Fvector2	pointer_pos;
	if( map->GetPointerTo(m_position_on_map, sp->GetWidth()/2, pointer_pos, heading) )
	{
		sp->SetWndPos(pointer_pos);
		sp->SetHeading(heading);

		Frect clip_rect = map->GetClipperRect();
		sp->SetClipRect( clip_rect );
		map->AttachChild(sp);

		Fvector2 tt = map->ConvertLocalToReal(m_position_on_map);
		Fvector ttt;
		ttt.set		(tt.x, 0.0f, tt.y);

		if (IsGameTypeSingle())
		{
			float dist_to_target = Level().CurrentEntity()->Position().distance_to(ttt);
			CGameTask*	T = Level().GameTaskManager().HasGameTask(this, true);
			if(T && T->GetTaskType()==eTaskTypeStoryline)
			{
				map->SetPointerDistance	(dist_to_target);
			}

			u32 clr = sp->GetColor();
			u32 a	= 0xff;
			if(dist_to_target>=0.0f && dist_to_target<10.0f)
				a=255;
			else
			if(dist_to_target>=10.0f && dist_to_target<50.0f)
				a=200;
			else
			if(dist_to_target>=50.0f && dist_to_target<100.0f)
				a=150;
			else
				a=100;

			sp->SetColor( subst_alpha(clr,a));
		}
	}
}
Beispiel #18
0
void CHUDTarget::Render()
{
	VERIFY		(g_bRendering);

	CObject*	O		= Level().CurrentEntity();
	if (0==O)	return;
	CEntity*	E		= smart_cast<CEntity*>(O);
	if (0==E)	return;

	Fvector p1				= Device.vCameraPosition;
	Fvector dir				= Device.vCameraDirection;
	
	// Render cursor
	u32 C				= C_DEFAULT;
	
	FVF::TL				PT;
	Fvector				p2;
	p2.mad				(p1,dir,RQ.range);
	PT.transform		(p2,Device.mFullTransform);
	float				di_size = C_SIZE/powf(PT.p.w,.2f);

	CGameFont* F		= HUD().Font().pFontGraffiti19Russian;
	F->SetAligment		(CGameFont::alCenter);
	F->OutSetI			(0.f,0.05f);

	if (psHUD_Flags.test(HUD_CROSSHAIR_DIST)){
		F->SetColor		(C);
		F->OutNext		("%4.1f",RQ.range);
	}

	if (psHUD_Flags.test(HUD_INFO)){ 
		if (RQ.O){
			CEntityAlive*	E		= smart_cast<CEntityAlive*>	(RQ.O);
			CEntityAlive*	pCurEnt = smart_cast<CEntityAlive*>	(Level().CurrentEntity());
			PIItem			l_pI	= smart_cast<PIItem>		(RQ.O);

			if (IsGameTypeSingle())
			{
				CInventoryOwner* our_inv_owner		= smart_cast<CInventoryOwner*>(pCurEnt);
				if (E && E->g_Alive() && !E->cast_base_monster())
				{
//.					CInventoryOwner* our_inv_owner		= smart_cast<CInventoryOwner*>(pCurEnt);
					CInventoryOwner* others_inv_owner	= smart_cast<CInventoryOwner*>(E);

					if(our_inv_owner && others_inv_owner){

						switch(RELATION_REGISTRY().GetRelationType(others_inv_owner, our_inv_owner))
						{
						case ALife::eRelationTypeEnemy:
							C = C_ON_ENEMY; break;
						case ALife::eRelationTypeNeutral:
							C = C_ON_NEUTRAL; break;
						case ALife::eRelationTypeFriend:
							C = C_ON_FRIEND; break;
						}

					if (fuzzyShowInfo>0.5f){
						CStringTable	strtbl		;
						F->SetColor	(subst_alpha(C,u8(iFloor(255.f*(fuzzyShowInfo-0.5f)*2.f))));
						F->OutNext	("%s", *strtbl.translate(others_inv_owner->Name()) );
						F->OutNext	("%s", *strtbl.translate(others_inv_owner->CharacterInfo().Community().id()) );
					}
					}

					fuzzyShowInfo += SHOW_INFO_SPEED*Device.fTimeDelta;
				}
				else 
					if (l_pI && our_inv_owner && RQ.range < 2.0f*our_inv_owner->inventory().GetTakeDist())
					{
						if (fuzzyShowInfo>0.5f){
							F->SetColor	(subst_alpha(C,u8(iFloor(255.f*(fuzzyShowInfo-0.5f)*2.f))));
							F->OutNext	("%s",l_pI->Name/*Complex*/());
						}
						fuzzyShowInfo += SHOW_INFO_SPEED*Device.fTimeDelta;
					}
			}
			else
			{
				if (E && (E->GetfHealth()>0))
				{
					if (pCurEnt && GameID() == GAME_SINGLE){	
						if (GameID() == GAME_DEATHMATCH)			C = C_ON_ENEMY;
						else{	
							if (E->g_Team() != pCurEnt->g_Team())	C = C_ON_ENEMY;
							else									C = C_ON_FRIEND;
						};
						if (RQ.range >= recon_mindist() && RQ.range <= recon_maxdist()){
							float ddist = (RQ.range - recon_mindist())/(recon_maxdist() - recon_mindist());
							float dspeed = recon_minspeed() + (recon_maxspeed() - recon_minspeed())*ddist;
							fuzzyShowInfo += Device.fTimeDelta/dspeed;
						}else{
							if (RQ.range < recon_mindist()) fuzzyShowInfo += recon_minspeed()*Device.fTimeDelta;
							else fuzzyShowInfo = 0;
						};

						if (fuzzyShowInfo>0.5f){
							clamp(fuzzyShowInfo,0.f,1.f);
							int alpha_C = iFloor(255.f*(fuzzyShowInfo-0.5f)*2.f);
							u8 alpha_b	= u8(alpha_C & 0x00ff);
							F->SetColor	(subst_alpha(C,alpha_b));
							F->OutNext	("%s",*RQ.O->cName());
						}
					}
				};
			};

		}else{
			fuzzyShowInfo -= HIDE_INFO_SPEED*Device.fTimeDelta;
		}
		clamp(fuzzyShowInfo,0.f,1.f);
	}

	//отрендерить кружочек или крестик
	if(!m_bShowCrosshair){
		// actual rendering
		u32			vOffset;
		FVF::TL*	pv		= (FVF::TL*)RCache.Vertex.Lock(4,hGeom.stride(),vOffset);
		
		float			size_x = float(Device.dwWidth)	* di_size;
		float			size_y = float(Device.dwHeight) * di_size;
		size_y = size_x;

		float			w_2		= Device.fWidth_2;
		float			h_2		= Device.fHeight_2;

		// Convert to screen coords
		float cx		    = (PT.p.x+1)*w_2;
		float cy		    = (PT.p.y+1)*h_2;

		pv->set				(cx - size_x, cy + size_y, C, 0, 1); ++pv;
		pv->set				(cx - size_x, cy - size_y, C, 0, 0); ++pv;
		pv->set				(cx + size_x, cy + size_y, C, 1, 1); ++pv;
		pv->set				(cx + size_x, cy - size_y, C, 1, 0); ++pv;

		// unlock VB and Render it as triangle LIST
		RCache.Vertex.Unlock(4,hGeom.stride());
		RCache.set_Shader	(hShader);
		RCache.set_Geometry	(hGeom);
		RCache.Render		(D3DPT_TRIANGLELIST,vOffset,0,4,0,2);
	}else{
		//отрендерить прицел
		HUDCrosshair.cross_color	= C;
		HUDCrosshair.OnRender		();
	}
}
Beispiel #19
0
void __fastcall TfrmEditLightAnim::pbGPaint(TObject *Sender)
{
	TRect R 	= pbG->ClientRect;
    Graphics::TBitmap* B 	= xr_new<Graphics::TBitmap>();
    B->Width 	= R.Width()-2;
    B->Height	= R.Height()-2;
	pbG->Canvas->Brush->Style 	= bsSolid;
    pbG->Canvas->Brush->Color	= clBlack;
    pbG->Canvas->FrameRect		(R);
    R.right		-= 2;
    R.bottom	-= 2;
    B->Canvas->Brush->Color		= TColor(0x00707070);
    B->Canvas->FillRect(R);
    if (m_CurrentItem){
    	float segment 	= float(R.Width())/(float(m_CurrentItem->iFrameCount));
        int half_segment= iFloor(segment/2);
        // draw gradient
        CLAItem::KeyMap& Keys=m_CurrentItem->Keys;
        int last=m_CurrentItem->iFrameCount;
        Keys[last]=Keys.rbegin()->second;
        CLAItem::KeyPairIt prev_key=Keys.begin();
        CLAItem::KeyPairIt it=prev_key; it++;
        float x_prev=(float(prev_key->first)/float(m_CurrentItem->iFrameCount))*R.Width();
		TRect cb;
        cb.Top 		= R.Top;
        cb.Bottom	= R.Bottom-R.Height()*0.3f;
	    for (; it!=Keys.end(); it++){
		    float x		= (it->first/float(m_CurrentItem->iFrameCount))*R.Width();
        	float g_cnt	= it->first-prev_key->first;
            for (int k=0; k<g_cnt; k++){
	            cb.Left		= iFloor(x_prev+k*segment);
    	        cb.Right	= iFloor(x_prev+k*segment+segment+1);
			    B->Canvas->Brush->Color	= TColor(subst_alpha(m_CurrentItem->InterpolateBGR(prev_key->first+k),0));
		    	B->Canvas->FillRect(cb);
            }
            prev_key 	= it;
            x_prev		= x;
        }
        Keys.erase(Keys.find(last));
        // draw keys
	    B->Canvas->Brush->Color= TColor(0x00BFFFFF);
        cb.Top 		= R.Bottom-R.Height()*0.1f;
        cb.Bottom	= R.Bottom;
	    for (it=m_CurrentItem->Keys.begin(); it!=m_CurrentItem->Keys.end(); it++){
		    int t		= iFloor((it->first/float(m_CurrentItem->iFrameCount))*R.Width());
            cb.Left		= t-1+half_segment;
   	        cb.Right	= t+2+half_segment;
			B->Canvas->FillRect(cb);
        }
	    // draw pointer
	    int t=iFloor((sePointer->Value/float(m_CurrentItem->iFrameCount))*R.Width())+half_segment;
	    B->Canvas->Pen->Color= TColor(0x0000FF00);
    	B->Canvas->MoveTo(t,R.Bottom);
    	B->Canvas->LineTo(t,R.Top+R.Height()*0.75f);
	    if ((iMoveKey>=0)&&(iTgtMoveKey!=iMoveKey))
        	t=iFloor((iTgtMoveKey/float(m_CurrentItem->iFrameCount))*R.Width())+half_segment;
        TRect rp=R;
        rp.Left 	= t-2;
        rp.Right 	= t+3;
        rp.Top		= R.Top+1;
        rp.Bottom	= R.Bottom-R.Height()*0.3f-1;
	    B->Canvas->Brush->Color	= TColor(0x00AAAAAA);
	    B->Canvas->FrameRect(rp);
        rp.Left 	-=1;
        rp.Right 	+=1;
        rp.Top		-=1;
        rp.Bottom	+=1;
	    B->Canvas->Brush->Color	= TColor(0x00000000);
	    B->Canvas->FrameRect(rp);
        //
    }
	pbG->Canvas->Draw(1,1,B);
    xr_delete(B);
}
Beispiel #20
0
void CUIEditKeyBind::OnFocusLost()
{
	CUILabel::OnFocusLost		();
	m_bEditMode					= false;
	m_lines.SetTextColor		((subst_alpha(m_lines.GetTextColor(), color_get_A(0xffffffff))));
}