Game Development Reference
In-Depth Information
/** Holds the image to use for the crosshair */
var Texture2D CrosshairImage;
/** Various colors */
var const color BlackColor;
/** color to use when drawing the crosshair */
var config color CrosshairColor;
We're going to use much of the same code that Epic uses for drawing the crosshair.
Rather than go through the convoluted processes of drawing the crosshair through
PostRender() and doing a number of checks, we're just going to draw the crosshair
at all times.
2.
We'll call our function, DrawWeaponCrosshair(); , and begin by defining the
local variables.
/**********************************************************
* Draws the crosshair
**********************************************************/
simulated function DrawWeaponCrosshair()
{
local vector2d CrosshairSize;
local float x,y,ScreenX, ScreenY;
local MyWeapon W;
local float TargetDist;
/** Set weapon and target distance */
W = MyWeapon(PawnOwner.Weapon);
TargetDist = W.GetTargetDistance();
/** Sets crosshair size */
CrosshairSize.Y = ConfiguredCrosshairScaling *
CrossHairCoordinates.VL * Canvas.ClipY/720;
CrosshairSize.X = CrosshairSize.Y *
( CrossHairCoordinates.UL / CrossHairCoordinates.VL );
/** Sets screen dimensions */
X = Canvas.ClipX * 0.5;
Y = Canvas.ClipY * 0.5;
ScreenX = X - (CrosshairSize.X * 0.5);
ScreenY = Y - (CrosshairSize.Y * 0.5);
 
Search Nedrilad ::




Custom Search