The crosshair is the graphic item in the center of your screen that you use to aim.
(a cross, a circle, a dot)
You can not use custom graphics for you crosshair.
But you can still have a custom crosshair.
This is my crosshair:
This is the code.
Just paste it after the line. #include "ui/menudef.h"
//--------------CUSTOM CROSSHAIRNew: a crosshair that changes color depending on your health value.
menuDef {
rect 10 10 620 360
fullScreen MENU_FALSE
visible MENU_TRUE
// horizontal line left
itemDef {
rect 100 229.5 200 1
style WINDOW_STYLE_FILLED
backcolor 1 1 0 1
visible 1
}
// horizontal line right
itemDef {
rect 320 229.5 200 1
style WINDOW_STYLE_FILLED
backcolor 1 1 0 1
visible 1
}
// vertical line top
itemDef {
rect 309.5 50 1 170
style WINDOW_STYLE_FILLED
backcolor 1 1 0 1
visible 1
}
// vertical line bottom
itemDef {
rect 309.5 240 1 130
style WINDOW_STYLE_FILLED
backcolor 1 1 0 1
visible 1
}
}
// little thin "+" custom crosshair
// changes color depending on your
// health value
menuDef {
rect 314.5 234.5 40 40
fullScreen MENU_FALSE
visible MENU_TRUE
//horizontal line
itemDef {
rect 0 5 10 .5
visible 1
ownerdraw CG_PLAYER_HEALTH
background "ui/assets/score/statsfillm.png"
addColorRange 0 50 1 0 0 1
addColorRange 51 100 1 1 0 1
addColorRange 101 200 0 1 0 1
}
//vertical line
itemDef {
rect 5 0 .5 10
visible 1
ownerdraw CG_PLAYER_HEALTH
background "ui/assets/score/statsfillm.png"
addColorRange 0 50 1 0 0 1
addColorRange 51 100 1 1 0 1
addColorRange 101 200 0 1 0 1
}
}
Another example (rather ugly):
In this case, I used the letter "x" and a dark background to improve contrast.
This is the code:
//--------------CUSTOM CROSSHAIR 2
menuDef {
rect 314.5 235 11 9
fullScreen MENU_FALSE
visible MENU_TRUE
//following two lines draw the dark background
style WINDOW_STYLE_FILLED
backcolor 0 0 0 .6
//letter x
itemDef {
rect 0 11 10 10
visible 1
textscale .4
text "x"
}
}
Animated crosshair that changes color (read & blue for team games, yellow for non-team games).
This is the code:
//--------------CUSTOM CROSSHAIR 3
menuDef {
rect 315 235 40 40
fullScreen MENU_FALSE
visible MENU_TRUE
itemDef {
rect 0 0 10 10
visible 1
style WINDOW_STYLE_FILLED
backcolor 1 1 0 .5
//this is the command that auto-changes color
ownerdraw CG_TEAM_COLORIZED
//this is the animated fan
background "textures/sfx/fan.png"
}
}
As you can see you can get creative and customize your crosshair.
hey , how rotate the lines ?
ReplyDeleteIt is NOT possible to make items rotate.
ReplyDeleteI simply used an animated image.