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
MenuShown
Indicates whether the main SPL menu is currently shown.
public static bool MenuShown { get; }
Property Value
Methods
GetFont(string)
Retrieves a font by its name.
public static ImFontPtr GetFont(string name)
Parameters
namestringThe name of the font.
Returns
- ImFontPtr
The font with the specified name, or
nullif 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
rangesGlyphRanges
Returns
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
pathstringThe path to the texture.
widthuintThe width of the loaded texture.
heightuintThe 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
namestringThe name of the font.
pathstringThe path to the font file.
sizefloatThe size of the font, in pixels.
glyphRangesnintThe glyph ranges to include in the font.
mergeboolWhether to merge the font with the default fonts.
oversampleVintThe vertical oversampling factor.
oversampleHintThe horizontal oversampling factor.
Remarks
Fonts must be registered before the first call to OnImGuiRender(). Ideally, fonts should be registered in the OnLoad() method.