Table of Contents

Class Renderer

Namespace
SharpPluginLoader.Core.Rendering
Assembly
SharpPluginLoader.Core.dll
public static class Renderer
Inheritance
Renderer
Inherited Members

Properties

IsDirectX12

Indicates whether the game is currently running in DirectX 12 mode.

public static bool IsDirectX12 { get; }

Property Value

bool

MenuShown

Indicates whether the main SPL menu is currently shown.

public static bool MenuShown { get; }

Property Value

bool

Methods

GetFont(string)

Retrieves a font by its name.

public static ImFontPtr GetFont(string name)

Parameters

name string

The name of the font.

Returns

ImFontPtr

The font with the specified name, or null if the font was not found.

Remarks

You can register custom fonts using RegisterFont(string, string, float, nint, bool, int, int). Registered fonts can only be retrieved after the first call to OnImGuiRender().

GetGlyphRanges(GlyphRanges)

public static nint GetGlyphRanges(GlyphRanges ranges)

Parameters

ranges GlyphRanges

Returns

nint

LoadTexture(string, out uint, out uint)

Loads a texture from the specified path.

public static TextureHandle LoadTexture(string path, out uint width, out uint height)

Parameters

path string

The path to the texture.

width uint

The width of the loaded texture.

height uint

The height of the loaded texture.

Returns

TextureHandle

A handle to the loaded texture.

Examples

var texture = Renderer.LoadTexture("./path/to/texture.png");
if (texture == TextureHandle.Invalid)
    // handle error
...
ImGui.Image(texture, new Vector2(100, 100));

Remarks

Textures can be any of the following formats: PNG, JPG, DDS

RegisterFont(string, string, float, nint, bool, int, int)

Registers a custom font to be used by ImGui. This font can later be retrieved using GetFont(string).

public static void RegisterFont(string name, string path, float size, nint glyphRanges = 0, bool merge = false, int oversampleV = 0, int oversampleH = 0)

Parameters

name string

The name of the font.

path string

The path to the font file.

size float

The size of the font, in pixels.

glyphRanges nint

The glyph ranges to include in the font.

merge bool

Whether to merge the font with the default fonts.

oversampleV int

The vertical oversampling factor.

oversampleH int

The horizontal oversampling factor.

Remarks

Fonts must be registered before the first call to OnImGuiRender(). Ideally, fonts should be registered in the OnLoad() method.