Jazz2::UI::Windows::Skin class

Texture the interface is drawn with.

All shapes are generated, no file is needed. The rounded shapes are drawn at the interface scale, so their edges are smooth at any scale, the icons are pixel art enlarged to the size of an icon at that scale, all of them, the stock ones and those registered, see Icons. The shapes, the icons and a white patch for plain rectangles are all in one texture, so everything but text and images drawn in a slot of the interface can be batched together.

Public types

struct NineSlice
Part of a texture drawn as nine slices, its corners keep their size.

Public static functions

static void DrawIcon(const IconArt& art, std::int32_t size, std::uint8_t* pixels, std::int32_t stride)
Draws an icon into a square of RGBA pixels of a side in pixels, as it's drawn into the texture.

Constructors, destructors, conversion operators

Skin()
~Skin()

Public functions

void Build(float scale)
Generates the texture for an interface scale, does nothing if it's for that scale already.
auto GetAtlas() const -> const Texture&
Returns the texture with all the shapes and icons.
auto GetWhiteTexCoords() const -> Vector4f
Returns the texture coordinates that give plain white, for a rectangle of any size.
auto GetIconSize() const -> std::int32_t
Returns the size of an icon in pixels, as it's drawn.
auto GetRoundFill() const -> const NineSlice&
Returns a filled rounded rectangle.
auto GetRoundRing() const -> const NineSlice&
Returns the border of a rounded rectangle.
auto GetShadow() const -> const NineSlice&
Returns a soft shadow, its corners include the part outside of what casts it.
auto GetShadowSpread() const -> std::int32_t
Returns how far the shadow reaches out in pixels.
auto GetCircle(float diameter) const -> const Recti&
Returns a filled circle to draw one of a diameter in pixels with.
auto GetShapeTexCoords(const Recti& rect) const -> Vector4f
Converts a part of the texture to texture coordinates.
auto GetIconTexCoords(IconId icon) const -> Vector4f
Returns the texture coordinates of an icon.