bool VideoPlayerPanel::SetVideo( const char *pVideoFile )
{
	ClearVideo();

	// clearing the video?
	if ( pVideoFile == NULL || pVideoFile[0] == 0x00 )
	{
		return true;
	}

	// create the material
	m_VideoMaterial = g_pVideo->CreateVideoMaterial( "VideoPlayerMaterial", pVideoFile, "GAME",
													VideoPlaybackFlags::DEFAULT_MATERIAL_OPTIONS,
													VideoSystem::DETERMINE_FROM_FILE_EXTENSION, true );
	
	if ( m_VideoMaterial == NULL )
	{
		return false;
	}

	// save filename	
	int sLen = V_strlen( pVideoFile ) + 1;
	m_VideoFileName = new char[ sLen ];
	V_strncpy( m_VideoFileName, pVideoFile, sLen );
	
	// compute Playback dimensions
	
	int nWidth, nHeight;
	m_VideoMaterial->GetVideoImageSize( &nWidth, &nHeight );
	m_VideoMaterial->GetVideoTexCoordRange( &m_flU, &m_flV );

	float flFrameRatio = ( (float) GetWide() / (float) GetTall() );
	float flVideoRatio = ( (float) nWidth / (float) nHeight );

	if ( flVideoRatio > flFrameRatio )
	{
		m_nPlaybackWidth = GetWide();
		m_nPlaybackHeight = ( GetWide() / flVideoRatio );
		m_letterBox = 1;
	}
	else if ( flVideoRatio < flFrameRatio )
	{
		m_nPlaybackWidth = ( GetTall() * flVideoRatio );
		m_nPlaybackHeight = GetTall();
		m_letterBox = 2;
	}
	else
	{
		m_nPlaybackWidth = GetWide();
		m_nPlaybackHeight = GetTall();
		m_letterBox = 0;
	}
	
	m_pMaterial = m_VideoMaterial->GetMaterial();
	
	m_VideoDuration = m_VideoMaterial->GetVideoDuration();
	
	m_VideoLoaded = true;
	return true;
}
Пример #2
0
void CASW_HUD_Health_Cross::PerformLayout()
{
	BaseClass::PerformLayout();

	m_pHealthLabel->SetBounds( health_xpos, health_ypos, GetWide(), GetTall() );
	m_pHealthLabelShadow->SetBounds( health_xpos + 1, health_ypos + 1, GetWide(), GetTall() );
}
Пример #3
0
//-----------------------------------------------------------------------------
// Purpose: Begins playback of a movie
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
bool VideoPanel::BeginPlayback( const char *pFilename )
{
#ifdef _X360
	XVIDEO_MODE videoMode;
	XGetVideoMode( &videoMode );

	// for 50Hz PAL, load a 25Hz version of the ep1_recap movie.
	if( ( videoMode.RefreshRate < 59.0f ) && ( Q_stricmp( pFilename, "media/ep1_recap.bik" ) == 0 ) )
	{
		pFilename = "media/ep1_recap_25fps.bik";
	}
#endif

	// Destroy any previously allocated video
	if ( m_BIKHandle != BIKHANDLE_INVALID )
	{
		bik->DestroyMaterial( m_BIKHandle );
		m_BIKHandle = BIKHANDLE_INVALID;
	}

	// Load and create our BINK video
	m_BIKHandle = bik->CreateMaterial( "VideoBIKMaterial", pFilename, "GAME" );
	if ( m_BIKHandle == BIKHANDLE_INVALID )
		return false;

	// We want to be the sole audio source
	// FIXME: This may not always be true!
	enginesound->NotifyBeginMoviePlayback();

	int nWidth, nHeight;
	bik->GetFrameSize( m_BIKHandle, &nWidth, &nHeight );
	bik->GetTexCoordRange( m_BIKHandle, &m_flU, &m_flV );
	m_pMaterial = bik->GetMaterial( m_BIKHandle );

	float flFrameRatio = ( (float) GetWide() / (float) GetTall() );
	float flVideoRatio = ( (float) nWidth / (float) nHeight );

	if ( flVideoRatio > flFrameRatio )
	{
		m_nPlaybackWidth = GetWide();
		m_nPlaybackHeight = ( GetWide() / flVideoRatio );
	}
	else if ( flVideoRatio < flFrameRatio )
	{
		m_nPlaybackWidth = ( GetTall() * flVideoRatio );
		m_nPlaybackHeight = GetTall();
	}
	else
	{
		m_nPlaybackWidth = GetWide();
		m_nPlaybackHeight = GetTall();
	}

	return true;
}
//-----------------------------------------------------------------------------
// Purpose: Compute the size of the panel based upon the commander's zoom level
//-----------------------------------------------------------------------------
void CEntityImageHealthPanel::ComputeAndSetSize( void )
{
	BaseClass::ComputeAndSetSize();

	// Now update the bars
	if ( m_CommanderHealthBar )
		m_CommanderHealthBar->SetSize( GetWide(), m_CommanderHealthBar->GetTall() );
	if ( m_NormalHealthBar ) 
		m_NormalHealthBar->SetSize( GetWide(), m_CommanderHealthBar->GetTall() );
	if ( m_ResourceLevelBar )
		m_ResourceLevelBar->SetSize( GetWide(), m_CommanderHealthBar->GetTall() );
}
Пример #5
0
void SetUnixOwner(Archive &Arc,const wchar *FileName)
{
  char NameA[NM];
  WideToChar(FileName,NameA,ASIZE(NameA));

  // First, we try to resolve symbolic names. If they are missing or cannot
  // be resolved, we try to use numeric values if any. If numeric values
  // are missing too, function fails.
  FileHeader &hd=Arc.FileHead;
  if (*hd.UnixOwnerName!=0)
  {
    struct passwd *pw;
    if ((pw=getpwnam(hd.UnixOwnerName))==NULL)
    {
      if (!hd.UnixOwnerNumeric)
      {
        uiMsg(UIERROR_UOWNERGETOWNERID,Arc.FileName,GetWide(hd.UnixOwnerName));
        ErrHandler.SetErrorCode(RARX_WARNING);
        return;
      }
    }
    else
      hd.UnixOwnerID=pw->pw_uid;
  }
  if (*hd.UnixGroupName!=0)
  {
    struct group *gr;
    if ((gr=getgrnam(hd.UnixGroupName))==NULL)
    {
      if (!hd.UnixGroupNumeric)
      {
        uiMsg(UIERROR_UOWNERGETGROUPID,Arc.FileName,GetWide(hd.UnixGroupName));
        ErrHandler.SetErrorCode(RARX_WARNING);
        return;
      }
    }
    else
      hd.UnixGroupID=gr->gr_gid;
  }
#if defined(SAVE_LINKS) && !defined(_APPLE)
  if (lchown(NameA,hd.UnixOwnerID,hd.UnixGroupID)!=0)
#else
  if (chown(NameA,hd.UnixOwnerID,hd.UnixGroupID)!=0)
#endif
  {
    uiMsg(UIERROR_UOWNERSET,Arc.FileName,FileName);
    ErrHandler.SetErrorCode(RARX_CREATE);
  }
}
void ServerOptionsPanel::PerformLayout()
{
	BaseClass::PerformLayout();

	int sw, sh;
	vgui::surface()->GetScreenSize( sw, sh );
	float fScale = float(sh) / 768.0f;

	int w = GetParent()->GetWide();

	int padding = 8 * fScale;
	int option_spacing = 24 * fScale;
	int left_edge = padding * 3;
	int choice_left_edge = padding * 3;
	int option_width = w * 0.25f;
	int option_height = 20 * fScale;
	int ypos = option_spacing;
	
	m_HostNameLabel->SetBounds(left_edge, ypos, option_width, option_height); ypos+=option_height + padding;
	m_pHostNameEntry->SetBounds(choice_left_edge, ypos, option_width, option_height); ypos+=option_height + option_spacing;
	m_pPasswordLabel->SetBounds(left_edge, ypos, option_width, option_height); ypos+=option_height + padding;
	m_pServerPasswordEntry->SetBounds(choice_left_edge, ypos, option_width, option_height); ypos+=option_height + option_spacing;
	m_pMaxPlayersLabel->SetBounds(left_edge, ypos, option_width, option_height); ypos+=option_height + padding;
	m_pMaxPlayersCombo->SetBounds(choice_left_edge, ypos, option_width, option_height); ypos+=option_height + option_spacing;
	m_pLANCheck->SetBounds(left_edge, ypos, option_width, option_height); ypos+=option_height + padding;
	m_pCancelButton->SetTextInset(6.0f * fScale, 0);

	m_pCancelButton->GetTextImage()->ResizeImageToContent();
	m_pCancelButton->SizeToContents();
	int cancel_wide = m_pCancelButton->GetWide();
	int iFooterSize = 32 * fScale;	
	m_pCancelButton->SetSize(cancel_wide, iFooterSize - 4 * fScale);
	m_pCancelButton->SetPos(GetWide() - cancel_wide,
							GetTall() - iFooterSize);
}
Пример #7
0
void CASW_VGUI_Message_Log::PerformLayout()
{	
	BaseClass::PerformLayout();

	// sizes uses by baseclass
	int w = GetWide();
	int t = GetTall();
	m_fScale = ScreenWidth() / 1024.0f;
	float panel_y = ScreenHeight() * TEXT_BORDER_Y;
	int button_high = 40 * m_fScale;

	// how much space do we have for message buttons?
	int message_y_space = ( (t - button_high * 1.7f) - (ScreenHeight() * TEXT_BORDER_Y) ) - panel_y;
	int padding = 5 * m_fScale;
	int message_y_per_button = (message_y_space / float(ASW_MAX_LOGGED_MESSAGES));
	int pos_x = ScreenWidth() * TEXT_BORDER_X;

	// position message buttons
	for (int i=0;i<ASW_MAX_LOGGED_MESSAGES;i++)
	{
		if (!m_pMessageButton[i])
			continue;

		m_pMessageButton[i]->SetBounds(pos_x, panel_y, w - (pos_x * 2), message_y_per_button - padding);
		panel_y += message_y_per_button;
	}
}
void CASW_Medal_Collection_Frame::PerformLayout()
{
	BaseClass::PerformLayout();

	int sw, sh;
	vgui::surface()->GetScreenSize( sw, sh );
	float fScale = float(sh) / 768.0f;
	int padding = 5 * fScale;

	int x, y, wide, tall;
	GetClientArea(x, y, wide, tall);
	m_pSheet->SetBounds(x, 5, wide, GetTall());
	
	int iFooterSize = 32.0f * fScale;

	m_pCancelButton->GetTextImage()->ResizeImageToContent();
	m_pCancelButton->SizeToContents();
	int cancel_wide = m_pCancelButton->GetWide();
	//m_pCancelButton->SetSize(cancel_wide, iFooterSize - 4);
	m_pCancelButton->SetPos(GetWide() - (cancel_wide + padding * 2),
							GetTall() - iFooterSize);

	m_pCollectionPanel->SetBounds(0, y, wide, tall - iFooterSize);	// todo: reduce tall a bit?
	m_pMedalOffsetPanel->SetBounds(0, 0, wide, tall);	// todo: reduce tall a bit?
	m_pSwarmopediaPanel->SetBounds(x, y, wide, tall - iFooterSize);	// todo: reduce tall a bit?
	
}
Пример #9
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CAvatarImagePanel::SetPlayer( C_BasePlayer *pPlayer )
{
	if ( GetImage() )
	{
		((CAvatarImage*)GetImage())->ClearAvatarSteamID();
	}

	if ( pPlayer && steamapicontext->SteamUtils() )
	{
		int iIndex = pPlayer->entindex();
		player_info_t pi;
		if ( engine->GetPlayerInfo(iIndex, &pi) )
		{
			if ( pi.friendsID )
			{
				CSteamID steamIDForPlayer( pi.friendsID, 1, steamapicontext->SteamUtils()->GetConnectedUniverse(), k_EAccountTypeIndividual );

				if ( !GetImage() )
				{
					CAvatarImage *pImage = new CAvatarImage();
					SetImage( pImage );
				}

				((CAvatarImage*)GetImage())->SetAvatarSteamID( steamIDForPlayer );

				// Indent the image. These are deliberately non-resolution-scaling.
				int iIndent = 2;
				GetImage()->SetPos( iIndent, iIndent );
				GetImage()->SetSize( GetWide()-(iIndent*2), GetTall()-(iIndent*2) );
			}
		}
	}
}
void CASW_VGUI_Queen_Health_Panel::UpdateBars()
{	
	if (GetQueen() && GetQueen()->GetHealth() > 0 && !GetQueen()->IsDormant())
	{
		int w = GetWide();
		int h = GetTall();

		m_pBackdrop->SetBounds(0, 0, w, h);

		int padding = ScreenWidth() * 0.005f;
		int bar_width = (w - padding) / ASW_QUEEN_HEALTH_BARS;
		float health_per_bar = float(GetQueen()->GetMaxHealth()) / ASW_QUEEN_HEALTH_BARS;
		float queen_health = GetQueen()->GetHealth();
		static float flasthealth = 0;
		if (flasthealth != queen_health)
		{
			//Msg("Queen health changed.  health=%f / %d\n", queen_health, GetQueen()->GetMaxHealth());
			flasthealth = queen_health;
		}
		
		for (int i=0;i<ASW_QUEEN_HEALTH_BARS;i++)
		{
			float f = (queen_health > (health_per_bar * (i+1)) ) ? 1.0f :		// queen's health is more than this bar section, so full bar
						(queen_health - (health_per_bar * i)) / health_per_bar;		// find the health remainder into this bar and divide by the health per bar to get how full this bar should be
			m_pHealthBar[i]->SetBounds((bar_width * i + padding), padding, f * (bar_width - padding), h - (padding * 2));
		}
	}
}
Пример #11
0
void SwarmopediaPanel::PerformLayout()
{
	BaseClass::PerformLayout();

	int sw, sh;
	vgui::surface()->GetScreenSize( sw, sh );
	float fScale = float(sh) / 768.0f;

	int list_wide = 200.0f * fScale;
	int padding = 5 * fScale;
	int iFooterSize = 32.0f * fScale;
	
	int html_left = list_wide + padding;
	int html_wide = GetWide() - (html_left + padding);
	if (m_pHTML)
		m_pHTML->SetBounds(html_left, padding, html_wide, GetTall() - (iFooterSize + padding * 3));

	int text_high = fScale * 20;
	if (m_pTopicLabel)
		m_pTopicLabel->SetBounds(padding, padding, list_wide - padding * 2, text_high);

	Msg("SwarmopediaPanel::PerformLayout.  fscale=%f list_wide=%d padding=%d footer=%d\n", fScale, list_wide, padding, iFooterSize);

	if (m_pList)
	{
		m_pList->SetBounds(padding, padding + text_high, list_wide - padding * 2, GetTall() - (iFooterSize + padding * 3));
		m_pList->SetFirstColumnWidth(0);
	}
}
Пример #12
0
void CNB_Mission_Summary::PerformLayout()
{
	BaseClass::PerformLayout();

	//m_pObjectivesLabel->GetTextImage()->ResizeImageToContent();
	int nLabelWidth = YRES( 168 );

	m_pObjectivesLabel->SetSize( nLabelWidth, 400 );
	m_pObjectivesLabel->GetTextImage()->SetDrawWidth( nLabelWidth );
	m_pObjectivesLabel->InvalidateLayout( true );
	int texwide, texttall;	
	m_pObjectivesLabel->GetTextImage()->ResizeImageToContentMaxWidth( nLabelWidth );
	m_pObjectivesLabel->GetTextImage()->GetContentSize( texwide, texttall );	
	m_pObjectivesLabel->InvalidateLayout( true );

	int x, y, w, h;
	m_pObjectivesLabel->GetBounds( x, y, w, h );

	h = texttall;

	int dw, dh;
	m_pDetailsButton->GetSize( dw, dh );

	h += dh;

	int border = YRES( 10 );
	SetTall( y + h + border );
	m_pBackground->SetTall( y + h + border );

	int bx, by;
	m_pBackgroundInner->GetPos( bx, by );
	m_pBackgroundInner->SetTall( y + h + border - ( by * 2 ) );

	m_pDetailsButton->SetPos( GetWide() - ( dw + border ), GetTall() - ( dh + border ) );
}
Пример #13
0
void CNB_Weapon_Unlocked::PaintBackground()
{
	// fill background
	float flAlpha = 200.0f / 255.0f;
	vgui::surface()->DrawSetColor( Color( 16, 32, 46, 230 * flAlpha ) );
	vgui::surface()->DrawFilledRect( 0, 0, GetWide(), GetTall() );
}
void CASWSelectOverlayPulse::Initialize()
{
	vgui::HScheme scheme = vgui::scheme()->LoadSchemeFromFile("resource/swarm/SwarmSchemeNew.res", "SwarmSchemeNew");
	SetScheme(scheme);	

	m_pOverlayLabel = new vgui::ImagePanel( this, "SelectOverlayImage" );

	m_fStartTime = gpGlobals->curtime;

	int x, y;
	m_pParent->GetPos( x, y );

	int w, h;
	m_pParent->GetSize( w, h );

	SetSize( w * m_fScale, h * m_fScale );
	SetPos( x - ( GetWide() - w ) / 2, y - ( GetTall() - h ) / 2 );
	SetZPos( 100 );

	if ( m_pOverlayLabel )
	{
		m_pOverlayLabel->SetImage( "inventory/item_select_glow" );
		m_pOverlayLabel->SetShouldScaleImage( true );
		m_pOverlayLabel->SetAlpha( 255 );
		m_pOverlayLabel->SetPos( 0, 0 );
		m_pOverlayLabel->SetSize( w * m_fScale, h * m_fScale );

		m_bStarted = true;
	}
}
Пример #15
0
void ExtractUnixOwner20(Archive &Arc,const wchar *FileName)
{
  char NameA[NM];
  WideToChar(FileName,NameA,ASIZE(NameA));

  if (Arc.BrokenHeader)
  {
    Log(Arc.FileName,St(MOwnersBroken),FileName);
    ErrHandler.SetErrorCode(RARX_CRC);
    return;
  }

  struct passwd *pw;
  errno=0; // Required by getpwnam specification if we need to check errno.
  if ((pw=getpwnam(Arc.UOHead.OwnerName))==NULL)
  {
    Log(Arc.FileName,St(MErrGetOwnerID),GetWide(Arc.UOHead.OwnerName));
    ErrHandler.SysErrMsg();
    ErrHandler.SetErrorCode(RARX_WARNING);
    return;
  }
  uid_t OwnerID=pw->pw_uid;

  struct group *gr;
  errno=0; // Required by getgrnam specification if we need to check errno.
  if ((gr=getgrnam(Arc.UOHead.GroupName))==NULL)
  {
    Log(Arc.FileName,St(MErrGetGroupID),GetWide(Arc.UOHead.GroupName));
    ErrHandler.SysErrMsg();
    ErrHandler.SetErrorCode(RARX_CRC);
    return;
  }
  gid_t GroupID=gr->gr_gid;
#if defined(SAVE_LINKS) && !defined(_APPLE)
  if (lchown(NameA,OwnerID,GroupID)!=0)
#else
  if (chown(NameA,OwnerID,GroupID)!=0)
#endif
  {
    Log(Arc.FileName,St(MSetOwnersError),FileName);
    ErrHandler.SetErrorCode(RARX_CREATE);
  }
#ifndef NOFILECREATE
  uint Attr=GetFileAttr(FileName);
  SetFileAttr(FileName,Attr);
#endif
}
void CMOD_Build_Map_Frame::PerformLayout()
{
	int sw, sh;
	vgui::surface()->GetScreenSize( sw, sh );	

	int wide = 350;
	int tall = 128;

	SetSize(wide, tall);
	SetPos((sw * 0.5f) - (wide * 0.5f), (sh * 0.5f) - (tall * 0.5f));

	BaseClass::PerformLayout();

	int padding = 20;
	m_pStatusLabel->SetBounds(padding, padding + 20, GetWide() - padding * 2, 20);
	m_pProgressBar->SetBounds(padding, padding + 50, GetWide() - padding * 2, 20);
}
void CASW_Difficulty_Entry::PerformLayout()
{
	BaseClass::PerformLayout();

	int image_tall = GetTall() * 0.9f;
	int image_wide = image_tall * 1.3333f;
	m_pImagePanel->SetBounds(GetTall() * 0.05f, GetTall() * 0.05f, image_wide, image_tall);

	int font_tall = vgui::surface()->GetFontTall(m_hDefaultFont);
	m_pDifficultyLabel->SetBounds(image_wide * 1.2f, 0, GetWide() - (image_wide * 1.2f), font_tall);
	m_pDifficultyLabel->InvalidateLayout(true);
	m_pDifficultyLabel->GetTextImage()->RecalculateNewLinePositions();

	m_pDifficultyDescriptionLabel->SetBounds(image_wide * 1.2f, font_tall, GetWide() - (image_wide * 1.2f), GetTall() - font_tall);
	m_pDifficultyDescriptionLabel->InvalidateLayout(true);
	m_pDifficultyDescriptionLabel->GetTextImage()->RecalculateNewLinePositions();	
}
Пример #18
0
//-----------------------------------------------------------------------------
// Purpose: Begins playback of a movie
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
bool VideoPanel::Play( const char *pFilename )
{
	if ( m_bPlaying )
	{
		Stop();
	}

	// Load and create our BINK video
	m_BIKHandle = bik->CreateMaterial( "VideoBIKMaterial", pFilename, "GAME" );
	if ( m_BIKHandle == BIKHANDLE_INVALID )
	{
		m_bPlaying = false;
		return false;
	}

	int nWidth, nHeight;
	bik->GetFrameSize( m_BIKHandle, &nWidth, &nHeight );
	bik->GetTexCoordRange( m_BIKHandle, &m_flU, &m_flV );
	m_pMaterial = bik->GetMaterial( m_BIKHandle );

	float flFrameRatio = ( (float) GetWide() / (float) GetTall() );
	float flVideoRatio = ( (float) nWidth / (float) nHeight );

	if ( flVideoRatio > flFrameRatio )
	{
		m_nPlaybackWidth = GetWide();
		m_nPlaybackHeight = ( GetWide() / flVideoRatio );
	}
	else if ( flVideoRatio < flFrameRatio )
	{
		m_nPlaybackWidth = ( GetTall() * flVideoRatio );
		m_nPlaybackHeight = GetTall();
	}
	else
	{
		m_nPlaybackWidth = GetWide();
		m_nPlaybackHeight = GetTall();
	}

	m_bPlaying = true;
	Q_strncpy( m_czLastFile, pFilename, sizeof( m_czLastFile ) );

	return true;
}
Пример #19
0
void ExtractUnixOwner30(Archive &Arc,const wchar *FileName)
{
  char NameA[NM];
  WideToChar(FileName,NameA,ASIZE(NameA));

  char *OwnerName=(char *)&Arc.SubHead.SubData[0];
  int OwnerSize=strlen(OwnerName)+1;
  int GroupSize=Arc.SubHead.SubData.Size()-OwnerSize;
  char GroupName[NM];
  strncpy(GroupName,(char *)&Arc.SubHead.SubData[OwnerSize],GroupSize);
  GroupName[GroupSize]=0;

  struct passwd *pw;
  if ((pw=getpwnam(OwnerName))==NULL)
  {
    Log(Arc.FileName,St(MErrGetOwnerID),GetWide(OwnerName));
    ErrHandler.SetErrorCode(RARX_WARNING);
    return;
  }
  uid_t OwnerID=pw->pw_uid;

  struct group *gr;
  if ((gr=getgrnam(GroupName))==NULL)
  {
    Log(Arc.FileName,St(MErrGetGroupID),GetWide(GroupName));
    ErrHandler.SetErrorCode(RARX_WARNING);
    return;
  }
  gid_t GroupID=gr->gr_gid;
#if defined(SAVE_LINKS) && !defined(_APPLE)
  if (lchown(NameA,OwnerID,GroupID)!=0)
#else
  if (chown(NameA,OwnerID,GroupID)!=0)
#endif
  {
    Log(Arc.FileName,St(MSetOwnersError),FileName);
    ErrHandler.SetErrorCode(RARX_CREATE);
  }
#ifndef NOFILECREATE
  uint Attr=GetFileAttr(FileName);
  SetFileAttr(FileName,Attr);
#endif
}
//-----------------------------------------------------------------------------
// Purpose: Used by the intro to fake the pulsing of this icon
//-----------------------------------------------------------------------------
void CControlPointIcon::FakePulse( float flTime )
{
	if ( m_pCapPulseImage )
	{
		m_pCapPulseImage->SetVisible( true );
		m_pCapPulseImage->StartPulse( flTime, GetWide() );
		m_pBaseImage->StartPulsing( flTime + FINISHCAPANIM_SWOOP_LENGTH - gpGlobals->curtime, 0.8, false );

		InvalidateLayout();
	}
}
Пример #21
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CAvatarImagePanel::PaintBackground( void )
{
	// Paint the outline
	vgui::surface()->DrawSetColor( m_clrOutline );
	vgui::surface()->DrawFilledRect( 0, 0, GetWide(), GetTall() );

	if ( GetImage() )
	{
		GetImage()->Paint();
	}
}
HapticsGraph::HapticsGraph(vgui::VPANEL parent) :
BaseClass( NULL, 50, -3, 3) 
{
	// if created by VPanel, well need to put a frame behind us.
	vgui::Frame *frame = new vgui::Frame(NULL,"hdebug");
	frame->SetPos(24,24);
	SetWide(150);
	SetTall(75);
	frame->SetWide(GetWide());
	frame->SetTall(GetTall()+24);
	SetParent(frame);
}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CControlPointIcon::UpdateImage( void )
{
	int iOwner = ObjectiveResource()->GetOwningTeam( m_iCPIndex );

	if ( m_pBaseImage )
	{
		int iOwnerIcon = ObjectiveResource()->GetCPCurrentOwnerIcon( m_iCPIndex, iOwner );
		const char *szMatName = GetMaterialNameFromIndex( iOwnerIcon );

		if ( IsPointLocked() )
		{
			m_pBaseImage->SetImage( VarArgs("..\\%s_locked", szMatName ) );
		}
		else
		{
			m_pBaseImage->SetImage( VarArgs("..\\%s", szMatName ) );
		}
	}

	if ( m_pOverlayImage )
	{
		int iOverlayIcon = ObjectiveResource()->GetOverlayForTeam( m_iCPIndex, iOwner );
		if ( iOverlayIcon )
		{
			const char *szMatName = GetMaterialNameFromIndex( iOverlayIcon );
			m_pOverlayImage->SetImage( VarArgs("..\\%s", szMatName ) );
			m_pOverlayImage->SetVisible( true );
		}
		else
		{
			m_pOverlayImage->SetVisible( false );
		}
	}

	// Whenever a successful cap occurs, flash the cap point
	if ( m_pCapPulseImage )
	{
		if ( m_iPrevCappers != 0 && iOwner == m_iPrevCappers )
		{
			m_iPrevCappers = 0;

			if ( ShouldDraw() )
			{
				m_pCapPulseImage->SetVisible( true );
				m_pCapPulseImage->StartPulse( gpGlobals->curtime, GetWide() );
			}
			m_pBaseImage->StartPulsing( FINISHCAPANIM_SWOOP_LENGTH, 0.5, false );
		}
		
	}
}
Пример #24
0
void PlayerListPanel::PerformLayout()
{
    float fScale = (ScreenHeight() / 768.0f);
    int border = 12.0f * fScale;
    int middle_button_width = 160.0f * fScale;
    int player_list_top = YRES( 85 ); //border * 2 + mission_tall + default_tall * 2;
    int line_top = 35 * fScale + player_list_top;
    int line_height = 48 * fScale;
    int header_height = 32 * fScale;
    int padding = 5 * fScale;

    if (!GetParent())
        return;

    SetBounds(0, 0, GetParent()->GetWide(),GetParent()->GetTall());

    int left_edge = GetWide() * 0.5f - YRES( 250 );

    m_pPlayerHeader->SetBounds( left_edge + PLAYER_LIST_PLAYER_X * fScale, player_list_top, PLAYER_LIST_PLAYER_W * fScale, header_height);
    m_pMarinesHeader->SetBounds( left_edge + PLAYER_LIST_MARINES_X * fScale, player_list_top, PLAYER_LIST_MARINES_W * fScale, header_height);
    m_pPingHeader->SetBounds( left_edge + PLAYER_LIST_PING_X * fScale, player_list_top, PLAYER_LIST_PING_W * fScale, header_height);
    for (int i=0; i<m_PlayerLine.Count(); i++)
    {
        m_PlayerLine[i]->SetBounds( left_edge + border, line_top + i * (line_height + padding), YRES( 500 ) - 24.0f * fScale, line_height);
    }

    int button_height = 32.0f * fScale;
    int button_width = 140.0f * fScale;
    int wide_button_width = 285.0f * fScale;
    int button_padding = 8.0f * fScale;
    int button_y = YRES( 420 ) - (button_height + button_padding + border);
    int label_height = 32.0f * fScale;
    int button_x = button_padding + border;

    m_pStartSavedCampaignVoteButton->SetBounds( left_edge + button_x + button_width + middle_button_width + button_padding * 2, button_y, wide_button_width, button_height);
    int vote_y = YRES( 420 ) - (button_height * 2 + button_padding * 2 + border);

    bool bVoteActive = (ASWGameRules() && (ASWGameRules()->GetCurrentVoteType() != ASW_VOTE_NONE));
    int bg_top = button_y - (label_height + button_padding);
    if (bVoteActive)
        bg_top = vote_y - button_padding;

    m_pLeaderButtonsBackground->SetBounds( left_edge + border, bg_top - (button_height + border * 3), YRES( 500 ) - (border * 2),
                                           button_height + border * 2);
}
void CASW_Hotbar_Entry::ShowTooltip()
{
	if ( !m_hMarine.Get() )
		return;

	C_ASW_Weapon *pWeapon = m_hMarine->GetASWWeapon( m_iInventoryIndex );
	if ( !pWeapon )
		return;

	const CASW_WeaponInfo* pInfo = pWeapon->GetWeaponInfo();
	if ( !pInfo || !pInfo->m_bOffhandActivate )		// TODO: Fix for sentry guns
		return;

	int x = GetWide() * 0.8f;
	int y = GetTall() * 0.02f;
	LocalToScreen( x, y );
	g_hBriefingTooltip->SetTooltip( this, pInfo->szPrintName, " ", x, y, true );
}
Пример #26
0
void CAvatarImagePanel::SetAvatarBySteamID( CSteamID *friendsID )
{
	if ( !GetImage() )
	{
		CAvatarImage *pImage = new CAvatarImage();
		SetImage( pImage );
	}

	// Indent the image. These are deliberately non-resolution-scaling.
	int iIndent = 2;
	GetImage()->SetPos( iIndent, iIndent );
	int wide = GetWide() - (iIndent*2);

	((CAvatarImage*)GetImage())->SetAvatarSize( ( wide > 32 ) ? k_EAvatarSize64x64 : k_EAvatarSize32x32 );
	((CAvatarImage*)GetImage())->SetAvatarSteamID( *friendsID );

	GetImage()->SetSize( wide, GetTall()-(iIndent*2) );
}
Пример #27
0
void CIOSUpdatePanel::ApplySchemeSettings( IScheme *pScheme )
{
	m_pScheme = pScheme;
	BaseClass::ApplySchemeSettings( pScheme );

	SetTitle("IOS Updater", false);
	SetProportional(false);
	SetSizeable(false);
	SetBounds(0, 0, PANEL_WIDTH, PANEL_HEIGHT);
	//SetBgColor(Color(0, 0, 0, 255));
	SetPaintBackgroundEnabled(true);
	SetCloseButtonVisible(false);
	MoveToCenterOfScreen();

	m_pContent->SetBounds(PADDING, PADDING + TOP_PADDING, GetWide() - 2 * PADDING, GetTall() - 2 * PADDING - TOP_PADDING);
	
	m_pUpdateButton->SetBounds(m_pContent->GetWide() / 2 - UPDATE_BUTTON_WIDTH / 2, m_pContent->GetTall() - UPDATE_BUTTON_HEIGHT - BUTTON_MARGIN - BUTTON_HEIGHT, UPDATE_BUTTON_WIDTH, UPDATE_BUTTON_HEIGHT);
	m_pUpdateButton->SetContentAlignment(Label::a_center);
	
	m_pCloseButton->SetBounds(m_pContent->GetWide() / 2 - BUTTON_WIDTH / 2, m_pContent->GetTall() - BUTTON_HEIGHT, BUTTON_WIDTH, BUTTON_HEIGHT);
	m_pCloseButton->SetContentAlignment(Label::a_center);
	
	m_pInfoText->SetBounds(PADDING, 3 * PADDING, m_pContent->GetWide() - 2 * PADDING, INFO_HEIGHT); 
	m_pInfoText->SetFont(pScheme->GetFont("DefaultBig"));
	m_pInfoText->SetContentAlignment(Label::a_center);
	m_pInfoText->SetFgColor(Color(255, 255, 255, 255));

	m_pExtraInfoText->SetBounds(PADDING, 3 * PADDING + INFO_HEIGHT + PADDING, m_pContent->GetWide() - 2 * PADDING, INFO_HEIGHT); 
	m_pExtraInfoText->SetFont(pScheme->GetFont("DefaultBig"));
	m_pExtraInfoText->SetContentAlignment(Label::a_center);
	m_pExtraInfoText->SetFgColor(Color(255, 255, 255, 255));

	m_pExtraInfoText2->SetBounds(PADDING, 3 * PADDING + 2 * (INFO_HEIGHT + PADDING), m_pContent->GetWide() - 2 * PADDING, INFO_HEIGHT); 
	m_pExtraInfoText2->SetFont(pScheme->GetFont("DefaultBig"));
	m_pExtraInfoText2->SetContentAlignment(Label::a_center);
	m_pExtraInfoText2->SetFgColor(Color(255, 255, 255, 255));

	m_pProgressBar->SetBounds(m_pContent->GetWide() / 2 - PROGRESSBAR_WIDTH / 2, 3 * PADDING + 3 * (INFO_HEIGHT + PADDING), PROGRESSBAR_WIDTH, PROGRESSBAR_HEIGHT);

	m_pChangelog->SetBounds(m_pContent->GetWide() / 2 - CHANGELOG_WIDTH / 2, 4 * PADDING + 3 * (INFO_HEIGHT + PADDING) + PROGRESSBAR_HEIGHT, CHANGELOG_WIDTH, CHANGELOG_HEIGHT);
}
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : *pkv - 
//-----------------------------------------------------------------------------
void C_TFBaseHint::ParseFromData( KeyValues *pkv )
{
	int priority = pkv->GetInt( "priority", 100 );
	SetPriority( priority );
	int width = pkv->GetInt( "width", TFBASEHINT_DEFAULT_WIDTH );
	if ( !width && !stricmp( pkv->GetString( "width" ), "default" ) )
	{
		width = TFBASEHINT_DEFAULT_WIDTH;
	}
	SetSize( width, TFBASEHINT_DEFAULT_HEIGHT );
	const char *title = pkv->GetString( "title" );
	if ( title )
		SetTitle( title );

	const char *completionfunction = pkv->GetString( "completionfunction" );
	if ( completionfunction && strlen( completionfunction ) > 0 )
		SetCompletionFunction( LookupCompletionFunction( completionfunction ) );

	KeyValues *items = pkv->FindKey( "items" );
	if ( items )
	{
		KeyValues *pkvItem = items->GetFirstSubKey();
		for( ; pkvItem ; pkvItem = pkvItem->GetNextKey() )
		{
			CHintItemBase *item = CreateHintItem( this, pkvItem->GetName() );
			if ( item )
			{
				item->ParseItem( pkvItem );
				item->ComputeTitle();

				item->SetSize( GetWide(), 20 );
				
				AddHintItem( item );
			}
			else
			{
				Msg( "C_TFBaseHint::ParseFromData:  Failed to create hint item %s\n", pkvItem->GetName() );
			}
		}
	}
}
Пример #29
0
void CASW_VGUI_Door_Tooltip::Paint()
{	
	BaseClass::Paint();

	if (GetAlpha() > 0)
	{
		int padding = (2.0f / 1024.0f) * ScreenWidth();
		if (padding < 1)
			padding = 1;

		int bar_width = (96.0f / 1024.0f) * ScreenWidth();
		int bar_height = (12.0f / 1024.0f) * ScreenWidth();
		DrawHorizontalBar( padding, padding, bar_width, bar_height, m_fDoorHealthFraction, 255, 255, 255, 255 );

		if (GetWide() < bar_width + padding + padding)
		{
			SetWide(bar_width + padding + padding - 1);
		}
		SetTall( bar_height + padding + padding - 1);
	}
}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CControlPointProgressBar::PerformLayout( void )
{
	BaseClass::PerformLayout();

	if ( m_pAttachedToIcon && m_pTeardrop && m_pTeardropSide )
	{
		int iIconX, iIconY;
		ipanel()->GetAbsPos(m_pAttachedToIcon->GetVPanel(), iIconX, iIconY );
		int iDir = m_pAttachedToIcon->GetCapProgressDir();
		int iXPos = 0;
		int iYPos = 0;

		int iEdgeSpace = (GetWide() - m_pTeardrop->GetWide()) * 0.5;

		// Line up our middle with the middle of the icon
		switch ( iDir )
		{
		default:
		case CP_DIR_N:
			SetSize( GetWide(), m_iOrgHeight );
			m_pTeardrop->SetVisible( true );
			m_pTeardropSide->SetVisible( false );
			iXPos = iIconX - ((GetWide() - m_pAttachedToIcon->GetWide()) * 0.5);
			iYPos = iIconY - GetTall();
			break;

		case CP_DIR_NE:
			SetSize( GetWide(), YRES(53) );
			m_pTeardropSide->SetIcon( "cappoint_progressbar_teardrop_right" );
			m_pTeardrop->SetVisible( false );
			m_pTeardropSide->SetVisible( true );
			iXPos = iIconX + m_pAttachedToIcon->GetWide() - iEdgeSpace;
			iYPos = iIconY - GetTall();
			break;

		case CP_DIR_NW:
			SetSize( GetWide(), YRES(53) );
			m_pTeardropSide->SetIcon( "cappoint_progressbar_teardrop_left" );
			m_pTeardrop->SetVisible( false );
			m_pTeardropSide->SetVisible( true );
			iXPos = iIconX - GetWide() + iEdgeSpace;
			iYPos = iIconY - GetTall();
			break;
		}
		
		SetPos( iXPos, iYPos );
	}
}