Game Development Community

GuiVectorCrosshair

by Matt Huston · 06/07/2007 (11:11 am) · 6 comments

Download Code File

Tested with TGE 1.5.2 and 1.4.2 (Thanks Roland)

Add guiVectorCrosshair.cc to your project in the engine/game/fps directory.

Compile!

Replace the crosshair in playGui.gui with the following.

new GuiVectorCrossHairHud(CrossHair) {
      profile = "GuiDefaultProfile";
      horizSizing = "center";
      vertSizing = "center";
      position = "0 0";
      extent = "128 128";
      minExtent = "8 8";
      visible = "1";
      helpTag = "0";
      wrap = "0";
      friendlyFillColor = "0.000000 1.000000 0.000000 1.000000";
      hostileFillColor = "1.000000 0.000000 0.000000 1.000000";
      innerRadius = 4;
      outerRadius = 8;
   };

friendlyFillColor - the color used when there is no target.
hostileFillColor - the color used when you're aiming at a target.
innerRadius - the inner radius of the inner crosshair, if set to 0 the crosshair will make a distinct + sign, if set to more than 0 then there will be a gap in the middle.
outerRadius - the outer radius of the inner crosshair and the outer crosshair lengths in pixels.

#1
06/07/2007 (2:24 pm)
Nice job! I need a custom crosshair as well -- with a little tweaking, this will be perfect. Thanks!
#2
06/07/2007 (5:32 pm)
Nice resource mate. Works nicely on both 1.3 (after a few minor changes) and on 1.4.2.
#3
06/08/2007 (9:05 pm)
I just wanted to say thanks forthis resource. It's the very first one I've been able to use without some adjustments.

Thanks again:)
#4
06/15/2007 (10:09 pm)
Nice job!
#5
07/03/2009 (2:13 am)
nice resource, thanks.
#6
01/13/2010 (6:07 am)
Thanks! Good idea, and gives people a base to make their own crosshair types/shapes.