Example #1
0
void CGUILoader::InitPanels()
{
	creditspanel->Create( m_GameUI ); 
	webwindowpanel->Create( m_GameUI );
	mp3windowpanel->Create( m_GameUI );
	binkwindowpanel->Create( m_GameUI );
	tutorialspanel->Create( m_GameUI );
	communitypanel->Create( m_GameUI );
	titlescreen->Create( m_GameUI );
	sidemenupanel->Create( m_GameUI );
	optionspanel->Create( m_GameUI );
	listenserver->Create( m_GameUI );
	guieditor->Create( m_GameUI );
	message->Create( m_GameUI );
	reportbug->Create( m_GameUI );

	// Main menu parents CBaseGamePanel
	const int BasePanelIndex = 1; // Bit of debugging to figure this out :/
	VPANEL BaseGamePanel = ipanel()->GetChild( m_GameUI, BasePanelIndex );
	
	mainmenupanel->Create( BaseGamePanel );

	// Bootstrap Gwen
	gwenbootstrap->Create( m_GameUI );

	gwenupdate->Create( m_GameUI );
}
//=============================================================================
void ControllerOptionsButtons::OnHybridButtonNavigatedTo( VPANEL defaultButton )
{
	Panel *panel = ipanel()->GetPanel( defaultButton, GetModuleName() );

	if ( panel )
	{
		OnCommand( panel->GetName() );
	}
}
Example #3
0
void CGUILoader::InitPanels()
{
	// Main menu parents CBaseGamePanel
	const int BasePanelIndex = 1; // Bit of debugging to figure this out :/
	VPANEL BaseGamePanel = ipanel()->GetChild( m_GameUI, BasePanelIndex );

	// Bootstrap Gwen
	gwenbootstrap->Create( m_GameUI );
}
//-----------------------------------------------------------------------------
// 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 );
	}
}
Example #5
0
	virtual void PerformLayout()
	{
		TextImage *textImage = GetTextImage();
		if (m_bSelected)
		{
			VPANEL focus = input()->GetFocus();
			// if one of the children of the SectionedListPanel has focus, then 'we have focus' if we're selected
			if (HasFocus() || (focus && ipanel()->HasParent(focus, GetVParent())))
			{
				textImage->SetColor(m_ArmedFgColor2);
			}
			else
			{
				textImage->SetColor(m_FgColor2);
			}
		}
		else
		{
			textImage->SetColor(GetFgColor());					
		}
		BaseClass::PerformLayout();
		Repaint();
	}
void CEditorRoot::EndPaintWorld( bool bValid )
{
	input()->SetMouseCapture( NULL );
	input()->SetCursorOveride( dc_user );
	m_bPainting = false;

	if ( bValid && !m_pLastFullCompiledShader )
		return;

	if ( input()->GetMouseOver() &&
		( input()->GetMouseOver() == GetVPanel() ||
		ipanel()->HasParent( input()->GetMouseOver(), GetVPanel() ) ) )
		return;

	if ( !sEditMRender )
		return;

	sEditMRender->DestroyCharPtrList( &m_pszMaterialList );
	m_iNumMaterials = sEditMRender->MaterialPicker( &m_pszMaterialList );

	gShaderEditorSystem->BeginMaterialReload( !bValid );
	//ReloadGameShaders( m_pLastFullCompiledShader, m_pszMaterialList, m_iNumMaterials );
}
void CEditorRoot::OnCommand(const char* pcCommand)
{
	if( !Q_stricmp(pcCommand, "quit") )
	{
		engine->ClientCmd( "quit" );
		return;
	}
	if( !Q_stricmp(pcCommand, "resetview") )
	{
		CNodeView *pView = GetActiveFlowGraph();
		if ( pView )
			pView->ResetView_User();
		return;
	}
	if( !Q_stricmp(pcCommand, "options") )
	{
		if ( !enginevgui->IsGameUIVisible() )
		{
			vgui::VPANEL GameUIRoot = enginevgui->GetPanel( PANEL_GAMEUIDLL );
			ipanel()->SetVisible( GameUIRoot, true );
		}
		engine->ClientCmd( "gamemenucommand OpenOptionsDialog" );
		return;
	}
	if( !Q_stricmp(pcCommand, "preview") )
	{
		CreatePreview();
		return;
	}
	if( !Q_stricmp(pcCommand, "pv_closed") )
	{
		if (pPreview)
			pPreview->GetBounds( px, py, psx, psy );
		return;
	}
	BaseClass::OnCommand( pcCommand );
}
Example #8
0
	virtual void PaintBackground()	
	{
		int wide, tall;
		GetSize(wide, tall);

		if ( m_bSelected )
		{
            VPANEL focus = input()->GetFocus();
            // if one of the children of the SectionedListPanel has focus, then 'we have focus' if we're selected
            if (HasFocus() || (focus && ipanel()->HasParent(focus, GetVParent())))
            {
			    surface()->DrawSetColor(m_ArmedBgColor);
            }
            else
            {
			    surface()->DrawSetColor(m_SelectionBG2Color);
            }
		}
		else
		{
			surface()->DrawSetColor(GetBgColor());
		}
		surface()->DrawFilledRect(0, 0, wide, tall);
	}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CControlPointIcon::PerformLayout( void )
{
	BaseClass::PerformLayout();

	int iBaseXPos, iBaseYPos;
	ipanel()->GetAbsPos(GetVPanel(), iBaseXPos, iBaseYPos );

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

	if ( m_pCapImage->IsVisible() )
	{
		m_pCapImage->SetBounds( 0, 0, GetWide(), GetTall() );
	}

	if ( m_pCapHighlightImage->IsVisible() )
	{
		int iHeight = ScreenHeight() * 0.75;
		m_pCapHighlightImage->SetBounds( iBaseXPos + CAP_BOX_INDENT_X, iBaseYPos - iHeight, GetWide() - (CAP_BOX_INDENT_X*2), iHeight + GetTall() -CAP_BOX_INDENT_Y );
	}

	int iCappingTeam = ObjectiveResource()->GetCappingTeam( m_iCPIndex );
	int iPlayers = ObjectiveResource()->GetNumPlayersInArea( m_iCPIndex, iCappingTeam );
	if ( !m_pCapPlayerImage->IsVisible() && iPlayers )
	{
		m_pCapPlayerImage->SetVisible(true);
	}
	if ( m_pCapPlayerImage->IsVisible() )
	{
		if ( !iPlayers )
		{
			// We're a deteriorating point
			m_pCapPlayerImage->SetVisible( false );
			m_pCapNumPlayers->SetVisible( false );
		}
		else
		{
			int iXPos, iYPos;
			if ( iPlayers < 2 || !m_pCapNumPlayers )
			{
				iXPos = (GetWide() - m_pCapPlayerImage->GetWide()) * 0.5;
			}
			else
			{
				iXPos = (GetWide() - m_pCapPlayerImage->GetWide()) * 0.5 - XRES(4);
			}
			iYPos = (GetTall() - m_pCapPlayerImage->GetTall()) * 0.5;

			m_pCapPlayerImage->SetPos( iXPos, iYPos );

			if ( m_pCapNumPlayers )
			{
				m_pCapNumPlayers->SetVisible( (iPlayers>1) );
				SetDialogVariable( "numcappers", iPlayers );

				m_pCapNumPlayers->SetFgColor( Color(0,0,0,255) );
			}
		}
	}

	if ( m_pCapPulseImage )
	{
		int iSize = GetWide() * 3;
		int iXpos = iBaseXPos - ((iSize-GetWide()) * 0.5);
		int iYpos = iBaseYPos - ((iSize-GetTall()) * 0.5);
		m_pCapPulseImage->SetBounds( iXpos, iYpos, iSize, iSize );
	}
}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CControlPointIconCapArrow::Paint( void )
{
	if ( !m_pArrowMaterial || !m_pAttachedToIcon )
		return;

	int x = 0;
	int y = 0;
	ipanel()->GetAbsPos(GetVPanel(), x,y );
	int iWidth = GetWide();
	int iHeight = GetTall();

	// Position the arrow based on the cap percentage
	float flXa = 0;
	float flXb = 1.0;
	float flYa = 0;
	float flYb = 1.0;

	int iCappingTeam = ObjectiveResource()->GetCappingTeam( m_pAttachedToIcon->GetCapIndex() );
	float flCapPercentage = ObjectiveResource()->GetCPCapPercentage( m_pAttachedToIcon->GetCapIndex() );

	// The image needs to be remapped to the width of the underlying box,
	// because we want the arrow head to move off the box at the exact time the cap ends.
	float flArrowHeadPixelWidth = 15.0;
	float flArrowBodyPixelWidth = 54.0;
	float flBoxSize = 33.0;

	// HACK: The arrow has an arrowhead portion that looks like this: >
	// We want to start with the arrow entering the image, but we want to keep
	// going until the arrow is fully off the edge. So we include extra width for it.
	float flImageSize = (flArrowHeadPixelWidth+flArrowBodyPixelWidth);
	float flMovementInTextureSpace = ( (flBoxSize+flArrowHeadPixelWidth) / flImageSize );
	float flArrowSizeInTextureSpace = ( flArrowHeadPixelWidth / flImageSize );

	// To help players spot the start & end of a cap, we indent a little on either side.
	float flIndent = 0.07;

	if ( m_pAttachedToIcon->ShouldSwipeUp() )
	{
		flYa = RemapVal( flCapPercentage, 0.0, 1.0, -flMovementInTextureSpace - flIndent, flArrowSizeInTextureSpace - flIndent );
		flYb = RemapVal( flCapPercentage, 0.0, 1.0, flIndent, flMovementInTextureSpace - flIndent );
	}
	else
	{
		flIndent = 0.1;

		float flStart = 1.0 - flIndent;
		float flEnd = 1.0 + flIndent;

		bool bSwipeLeftToRight = ( iCappingTeam % 2 ) ? false : true;
		if ( bSwipeLeftToRight )
		{
			flXa = RemapVal( flCapPercentage, 0.0, 1.0, flStart + flMovementInTextureSpace, flEnd - flArrowSizeInTextureSpace );
			flXb = RemapVal( flCapPercentage, 0.0, 1.0, flStart, 0.0 );
		}
		else
		{
			flXa = RemapVal( flCapPercentage, 0.0, 1.0, flStart, 0.0 );
			flXb = RemapVal( flCapPercentage, 0.0, 1.0, flStart + flMovementInTextureSpace, flEnd - flArrowSizeInTextureSpace );
		}
	}

	CMatRenderContextPtr pRenderContext( materials );
	pRenderContext->Bind( m_pArrowMaterial );
	IMesh* pMesh = pRenderContext->GetDynamicMesh( true );

	CMeshBuilder meshBuilder;
	meshBuilder.Begin( pMesh, MATERIAL_QUADS, 1 );

	meshBuilder.Position3f( x, y, 0.0f );
	meshBuilder.TexCoord2f( 0, flXa, flYa );
	meshBuilder.TexCoord2f( 1, 0.0f, 0.0f );
	meshBuilder.Color4ub( 255, 255, 255, 255 );
	meshBuilder.AdvanceVertex();

	meshBuilder.Position3f( x + iWidth, y, 0.0f );
	meshBuilder.TexCoord2f( 0, flXb, flYa );
	meshBuilder.TexCoord2f( 1, 1.0f, 0.0f );
	meshBuilder.Color4ub( 255, 255, 255, 255 );
	meshBuilder.AdvanceVertex();

	meshBuilder.Position3f( x + iWidth, y + iHeight, 0.0f );
	meshBuilder.TexCoord2f( 0, flXb, flYb );
	meshBuilder.TexCoord2f( 1, 1.0f, 1.0f );
	meshBuilder.Color4ub( 255, 255, 255, 255 );
	meshBuilder.AdvanceVertex();

	meshBuilder.Position3f( x, y + iHeight, 0.0f );
	meshBuilder.TexCoord2f( 0, flXa, flYb );
	meshBuilder.TexCoord2f( 1, 0.0f, 1.0f );
	meshBuilder.Color4ub( 255, 255, 255, 255 );
	meshBuilder.AdvanceVertex();

	meshBuilder.End();
	pMesh->Draw();
}
Example #11
0
void __fastcall hkPaintTraverse(void* ecx, void* edx, unsigned int vguiPanel, bool forceRepaint, bool allowForce)
{
	oPaintTraverse(ecx, vguiPanel, forceRepaint, allowForce);

	static unsigned int MatSystemTopPanel;
	static vgui::HFont s_HFontPlayer;

	if (!MatSystemTopPanel)
	{
		const char* szName = ipanel()->GetName(vguiPanel);
		g_pCVar->ConsoleColorPrintf(Color::Blue(), "panel: %s\n", szName);

		if (_V_stricmp(szName, "MatSystemTopPanel") == 0) // MatSystemTopPanel
		{
			MatSystemTopPanel = vguiPanel;

			engine->GetScreenSize(screenWidth, screenHeight);
			s_HFontPlayer = g_pMatSurface->CreateFont();
			g_pMatSurface->SetFontGlyphSet(s_HFontPlayer, "Tahoma", 14, 150, 0, 0, FONTFLAG_OUTLINE);
		}
	}
	

	if (MatSystemTopPanel == vguiPanel)
	{
		if (GetAsyncKeyState(VK_F9) & 1)
		{
			name = !name;
			if (name) Beep(0x367, 200);
			else Beep(0x255, 200);
		}

		if (engine->IsInGame() && engine->IsConnected() && !engine->IsTakingScreenshot())
		{

			if (GetAsyncKeyState(VK_F11) & 1)
			{
				g_pCVar->ConsoleColorPrintf(Color::Red(), "Hello World!");
			}

			C_BaseEntity *pLocalEntity = (C_BaseEntity*)entitylist->GetClientEntity(engine->GetLocalPlayer());
			if (!pLocalEntity)
				return;


			for (int i = 0; i < entitylist->GetHighestEntityIndex(); i++)
			{
				C_BaseEntity* pBaseEntity = (C_BaseEntity*)entitylist->GetClientEntity(i);
				if (!pBaseEntity)
					continue;
				if (pBaseEntity->health() < 1)
					continue;
				if (pBaseEntity == pLocalEntity)
					continue;
				if (pLocalEntity->team() == pBaseEntity->team())
					continue;

				if (name)
				{
					Vector out;
					if (WorldToScreen(pBaseEntity->GetAbsOrigin(), out))
					{
						if (name)
						{
							player_info_t info;
							engine->GetPlayerInfo(i, &info);
							DrawString(out.x - 5, out.y, Color::Red(), s_HFontPlayer, info.name);
						}
					}
				}
			}
		}
	}
}