Jump to content


Selection box with background shader help


2 replies to this topic

#1 Zocom7

    Visitor

  • Member
  • 29 posts

Posted 20 April 2011 - 18:41

I don't know if this works for the C&C3 Mod SDK as well as the RA3 Mod SDK. This is a new function I really want to apply into both C&C3 and RA3.

None of the C&C games have this sort of cursor function (what a shame EALA), but Starcraft II and even HL2 Wars do. The original concept of C&C3 by ex-Westwood did use a selection box with a background shader. I even asked for a coding source in the HL2 Wars forums and I got the code I was looking for.

The complete coding clue for the selection box with background shader, from the HL2 Wars mod (thanks to Sandern for this):

void HL2WarsViewport::DrawSelectBox()
{
   C_HL2WarsPlayer* pPlayer = C_HL2WarsPlayer::GetLocalHL2WarsPlayer();

   if( !pPlayer->IsLeftPressed() )
	  return;

   // Must be higher than the threshold
   if&#40; &#40;pPlayer->GetMouseDataLeftPressed&#40;&#41;.m_vEndPos - pPlayer->GetMouseData&#40;&#41;.m_vEndPos&#41;.Length2D&#40;&#41; <= SELECTBOX_THRESHOLD &#41;
	  return;

   // Draw the selection box
   short xmin, ymin, xmax, ymax;
   xmin = MIN&#40;pPlayer->GetMouseDataLeftPressed&#40;&#41;.m_iX, pPlayer->GetMouseData&#40;&#41;.m_iX&#41;;
   xmax = MAX&#40;pPlayer->GetMouseDataLeftPressed&#40;&#41;.m_iX, pPlayer->GetMouseData&#40;&#41;.m_iX&#41;;
   ymin = MIN&#40;pPlayer->GetMouseDataLeftPressed&#40;&#41;.m_iY, pPlayer->GetMouseData&#40;&#41;.m_iY&#41;;
   ymax = MAX&#40;pPlayer->GetMouseDataLeftPressed&#40;&#41;.m_iY, pPlayer->GetMouseData&#40;&#41;.m_iY&#41;;

   vgui&#58;&#58;surface&#40;&#41;->DrawSetColor&#40; Color&#40; 0, 0, 0, 115 &#41; &#41;;
   vgui&#58;&#58;surface&#40;&#41;->DrawOutlinedRect&#40; xmin, ymin, xmax, ymax &#41;;
   vgui&#58;&#58;surface&#40;&#41;->DrawSetColor&#40; Color&#40; 75, 75, 75, 90 &#41; &#41;;
   vgui&#58;&#58;surface&#40;&#41;->DrawFilledRect&#40; xmin, ymin, xmax, ymax &#41;;
}


Now.... how can I apply this to C&C3 and RA3 anyway? Some modder told me (in the official C&C forums) I can edit and modify the selection box coding through a AptUI. I need the name of the UI that has the Apt files used for the mouse selection box. Perhaps maybe some of you modders could be interested in this.

I do know that this type of C++ coding does not necessarily work under the C&C3 Mod SDK since it's mostly in xml coding.

#2 Slye_Fox

    FOXTec Leader

  • Project Leader
  • 2351 posts
  • Projects: CnC: Condition Red, Sigma Invasion, Armoured Sky: Ethereal Dawn

Posted 20 April 2011 - 19:23

I'm still not sure what you mean by selection box background.
Posted Image

#3 Zocom7

    Visitor

  • Member
  • 29 posts

Posted 20 April 2011 - 21:10

View PostSlye_Fox, on 20 Apr 2011, 19:23, said:

I'm still not sure what you mean by selection box background.


The selection box is actually the click and drag box when you use the mouse. I want to put in a colored background shader in the selection box.



1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users