I know you dev team have done it into the mod. Starcraft II as well as this HL2 Wars mod are the fewest RTS games that successfully got the click and drag box mouse cursor with a background shader. The mouse cursor is not responsible for the shading background, it's the language coding that works on that cursor. All recent versions of Windows and Mac OS have that type.
The question is, how can I apply it, if I want to use it into another mod, such as the one I want to apply this in Command & Conquer 3 or Red Alert 3 Mod SDK? None of the C&C games have that background shader on the click and drag box.
Click and drag box with background shader
Re: Click and drag box with background shader
You make it sound more complicated than it is. It simply checks for the conditions of drawing a selection box (left mouse button pressed) and then draws a filled rectangle with a border using the GUI functions provided by Source Engine. I have no idea how the Red Alert 3 SDK looks like and I have no idea of what's possible in that SDK, so I can't really answer your question.
Code: Select all
void HL2WarsViewport::DrawSelectBox()
{
C_HL2WarsPlayer* pPlayer = C_HL2WarsPlayer::GetLocalHL2WarsPlayer();
if( !pPlayer->IsLeftPressed() )
return;
// Must be higher than the threshold
if( (pPlayer->GetMouseDataLeftPressed().m_vEndPos - pPlayer->GetMouseData().m_vEndPos).Length2D() <= SELECTBOX_THRESHOLD )
return;
// Draw the selection box
short xmin, ymin, xmax, ymax;
xmin = MIN(pPlayer->GetMouseDataLeftPressed().m_iX, pPlayer->GetMouseData().m_iX);
xmax = MAX(pPlayer->GetMouseDataLeftPressed().m_iX, pPlayer->GetMouseData().m_iX);
ymin = MIN(pPlayer->GetMouseDataLeftPressed().m_iY, pPlayer->GetMouseData().m_iY);
ymax = MAX(pPlayer->GetMouseDataLeftPressed().m_iY, pPlayer->GetMouseData().m_iY);
vgui::surface()->DrawSetColor( Color( 0, 0, 0, 115 ) );
vgui::surface()->DrawOutlinedRect( xmin, ymin, xmax, ymax );
vgui::surface()->DrawSetColor( Color( 75, 75, 75, 90 ) );
vgui::surface()->DrawFilledRect( xmin, ymin, xmax, ymax );
}
Who is online
Users browsing this forum: No registered users and 8 guests