A semi-complete and configurable crosshair system built for s&box
Drag the ui
folder into the code
folder of your gamemode. Ex. minimal/code/ui
Add the following to the setup of your main gamemode hud.
RootPanel.AddChild<Crosshair>();
public MinimalHudEntity()
{
if ( IsClient )
{
RootPanel.SetTemplate( "/minimalhud.html" );
RootPanel.AddChild<ChatBox>();
RootPanel.AddChild<Crosshair>();
}
}
Call SetupCrosshair
and optionally provide some properties
. The properties
follow a very similar structure to CS:GO.
Crosshair.Current?.SetupCrosshair(new Crosshair.Properties(
true,
false,
false,
25,
2,
2,
-25,
new Color(0.1f, 1f, 0.3f, 1f)
));
Full usage...
public MinimalHudEntity()
{
if ( IsClient )
{
RootPanel.SetTemplate( "/minimalhud.html" );
RootPanel.AddChild<ChatBox>();
RootPanel.AddChild<Crosshair>().SetupCrosshair(new Crosshair.Properties());
}
}