Skip to content
EvilEngine.Formats.Records

WeaponIcon record

public sealed record WeaponIcon

A weapon’s icon on the wheel: one character from a font, as Half-Life 2’s are, or an image, or a rectangle of one. A record’s icon, icon_selected and ammo_icon are each a table of these keys, and give a font and a character or an image, never both. The wheel draws font icons. An image icon is read and kept, but the wheel doesn’t draw one yet, so a weapon with only an image icon shows its title alone.

icon = { font = "mygun:fonts/icons.ttf", character = "R" }
icon_selected = { image = "mygun:materials/railgun", region = [0, 0, 128, 64] }
Assembly
EvilEngine.Formats
Commit
4ff877b1

Members

WeaponIcon constructor

public WeaponIcon()

Makes an icon with nothing set. Glyph and Picture make the two kinds a record can hold.

Image property

public ContentId? Image { get; init; }

The image drawn, from image, or null for a font icon.

Region property

public CrosshairRegion? Region { get; init; }

The rectangle of the Image drawn, from region, as [x, y, width, height] in whole texels with a size above 0, or null for the whole image. A font icon has none.

Font property

public ContentId? Font { get; init; }

The font the Character is drawn from, from font, or null for an image icon.

Character property

public string? Character { get; init; }

The one character drawn from the Font, from character, or null for an image icon. One character is one Unicode scalar value, so it can be outside the Basic Multilingual Plane.

Glyph method

public static WeaponIcon Glyph(ContentId font, string character)

Makes a font icon from a font and one character.

Picture method

public static WeaponIcon Picture(ContentId image, CrosshairRegion? region = null)

Makes an image icon from an image and, optionally, the rectangle of it to draw.