Nuclide
Software Development Kit for id Technology
Crosshair

Crosshair helper functions. More...

Detailed Description

Crosshair helper functions.

Helper functions for dealing with crosshairs in games. If you don't want to deal with handling accurate crosshairs in a variety of view modes (1st-person, 3rd-person, XR) then simply use one of the supplied functions.

Functions

vector Cross_GetPos (vector sizeXY)
 Returns the end-coordinates for a crosshair of a given size. More...
 
void Cross_Draw (string materialPath, vector sizeXY)
 Draws a crosshair on the screen with the desired material and size. More...
 
void Cross_DrawRGB (string materialPath, vector sizeXY, vector colorRGB)
 Draw a given crosshair on the screen, with variable color. More...
 
void Cross_DrawRGBA (string materialPath, vector sizeXY, vector colorRGB, float alphaValue)
 Draw a given crosshair on the screen, with variable color and alpha. More...
 
void Cross_DrawSub (string materialPath, vector sizeXY, vector sourcePosXY, vector sourceSizeXY)
 Draw a given crosshair on the screen, of only a section from a material. More...
 
void Cross_DrawSubRGB (string materialPath, vector sizeXY, vector sourcePosXY, vector sourceSizeXY, vector colorRGB)
 Draw a given crosshair on the screen, of only a section from a material, with variable color. More...
 
void Cross_DrawSubRGBA (string materialPath, vector sizeXY, vector sourcePosXY, vector sourceSizeXY, vector colorRGB, float alphaValue)
 Draw a given crosshair on the screen, of only a section from a material, with variable color/alpha. More...
 

Function Documentation

◆ Cross_Draw()

void Cross_Draw ( string  materialPath,
vector  sizeXY 
)

Draws a crosshair on the screen with the desired material and size.

Parameters
materialPathis the material to use.
sizeXYis the size in pixels it is meant to take up on screen.

◆ Cross_DrawRGB()

void Cross_DrawRGB ( string  materialPath,
vector  sizeXY,
vector  colorRGB 
)

Draw a given crosshair on the screen, with variable color.

Parameters
materialPathis the material to use.
sizeXYis the size in pixels it is meant to take up on screen.
colorRGBis the normalized color values to tint the surface with.

◆ Cross_DrawRGBA()

void Cross_DrawRGBA ( string  materialPath,
vector  sizeXY,
vector  colorRGB,
float  alphaValue 
)

Draw a given crosshair on the screen, with variable color and alpha.

Parameters
materialPathis the material to use.
sizeXYis the size in pixels it is meant to take up on screen.
colorRGBis the normalized color values to tint the surface with.
alphaValueis the alpha values to use on the whole surface.

◆ Cross_DrawSub()

void Cross_DrawSub ( string  materialPath,
vector  sizeXY,
vector  sourcePosXY,
vector  sourceSizeXY 
)

Draw a given crosshair on the screen, of only a section from a material.

Parameters
materialPathis the material to use.
sizeXYis the size in pixels it is meant to take up on screen.
sourcePosXYis a normalized starting position within the material from which we should start drawing from.
sourceSizeXYis the normalized size within the material from which we should draw from.

◆ Cross_DrawSubRGB()

void Cross_DrawSubRGB ( string  materialPath,
vector  sizeXY,
vector  sourcePosXY,
vector  sourceSizeXY,
vector  colorRGB 
)

Draw a given crosshair on the screen, of only a section from a material, with variable color.

Parameters
materialPathis the material to use.
sizeXYis the size in pixels it is meant to take up on screen.
sourcePosXYis a normalized starting position within the material from which we should start drawing from.
sourceSizeXYis the normalized size within the material from which we should draw from.
colorRGBis the normalized color values to tint the surface with.

◆ Cross_DrawSubRGBA()

void Cross_DrawSubRGBA ( string  materialPath,
vector  sizeXY,
vector  sourcePosXY,
vector  sourceSizeXY,
vector  colorRGB,
float  alphaValue 
)

Draw a given crosshair on the screen, of only a section from a material, with variable color/alpha.

Parameters
materialPathis the material to use.
sizeXYis the size in pixels it is meant to take up on screen.
sourcePosXYis a normalized starting position within the material from which we should start drawing from.
sourceSizeXYis the normalized size within the material from which we should draw from.
colorRGBis the normalized color values to tint the surface with.
alphaValueis the alpha values to use on the whole surface.

◆ Cross_GetPos()

vector Cross_GetPos ( vector  sizeXY)

Returns the end-coordinates for a crosshair of a given size.

Parameters
sizeXYis the size in pixels it is meant to take up on screen.