Hi root,

You may consider using surface()->DrawLine() instead of calling
DrawFilledRect() with a width of 1.

You might also want to draw the crosshair with an additive texture. To
do this, first add this to your CHudCrosshair class in
hud_crosshair.h:

        CPanelAnimationVarAliasType( int, m_nAdditiveTextureID,
"LineTexture", "vgui/white_additive", "textureid" );

And in CHudCrosshair::Paint():
..
        surface()->DrawSetTexture( m_nAdditiveTextureID );
        surface()->DrawSetColor( 0,255,0,200 );
..
Then use surface()->DrawTexturedLine(), which takes Vertex_t's as
arguments, to draw your lines.

Casey
epicar at dystopia-mod.com

On 4/21/05, r00t 3:16 <[EMAIL PROTECTED]> wrote:
> Ben,
>
> welcome...
>
>
> r00t 3:16
> CQC Gaming
> www.cqc-gaming.com
> ----- Original Message -----
> From: "Ben Davison" <[EMAIL PROTECTED]>
> To: <hlcoders@list.valvesoftware.com>
> Sent: Thursday, April 21, 2005 9:18 AM
> Subject: Re: [hlcoders] Drawing crosshair to the screen
>
> > Thanks for the contribution :) Might come in handy sometime :)
> >
> > On 4/21/05, r00t 3:16 <[EMAIL PROTECTED]> wrote:
> >> I had asked this awhile back and a couple of people had some suggestions
> >> like, animated textures etc.
> >>
> >> Well there isn't many people who know how to do this without using a
> >> texture
> >> or a font icon.
> >>
> >> Well CSS does not use a texture or an icon I do not believe because I
> >> searched just about every texture file and font file for CSS for a
> >> crosshair...
> >>
> >> Anyways you can draw the lines to the screen and once you get them drawn
> >> you
> >> can then animate the crosshair to do whatever...
> >>
> >> Here is the snippet of code so you can at least draw the crosshair to the
> >> screen..
> >> (I used CHudZoom to get an idea of how to draw lines to the hud...)
> >>
> >> (Valve if this is not the best way of going about this let me know)
> >>
> >> CHudCrosshair::Paint()
> >> {
> >> ....
> >> // Verticle Reticle -r00t
> >> surface()->DrawSetColor( 0,255,0,200 );
> >> surface()->DrawFilledRect(xpos , 287, xpos + 1, 287 + 10 );
> >> surface()->DrawFilledRect(xpos , 297, xpos, 297 + 6 );
> >> surface()->DrawFilledRect(xpos , 303 , xpos + 1, 303 + 10 );
> >> // Horizontal Reticle -r00t
> >> surface()->DrawFilledRect( 387 , ypos, 387 + 10, ypos + 1 );
> >> surface()->DrawFilledRect( 397 , ypos, 397 + 6, ypos);
> >> surface()->DrawFilledRect(403 , ypos , 403 + 10 , ypos + 1 );
> >> ....
> >> }
> >>
> >>                                     |
> >> This will just a draw ---- ----
> >>                                     |
> >>
> >> Hopefully someone finds this useful.
> >>
> >> r00t 3:16
> >> CQC Gaming
> >> www.cqc-gaming.com
> >>
> >> _______________________________________________
> >> To unsubscribe, edit your list preferences, or view the list archives,
> >> please visit:
> >> http://list.valvesoftware.com/mailman/listinfo/hlcoders
> >>
> >>
> >
> >
> > --
> > - Ben Davison
> > - http://www.shadow-phoenix.com
> >
> > _______________________________________________
> > To unsubscribe, edit your list preferences, or view the list archives,
> > please visit:
> > http://list.valvesoftware.com/mailman/listinfo/hlcoders
> >
> >
> >
>
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list archives, please 
> visit:
> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>
>

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to