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
name
stringThe 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
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
stringThe path to the texture.
width
uintThe width of the loaded texture.
height
uintThe 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
stringThe name of the font.
path
stringThe path to the font file.
size
floatThe size of the font, in pixels.
glyphRanges
nintThe glyph ranges to include in the font.
merge
boolWhether to merge the font with the default fonts.
oversampleV
intThe vertical oversampling factor.
oversampleH
intThe horizontal oversampling factor.
Remarks
Fonts must be registered before the first call to OnImGuiRender(). Ideally, fonts should be registered in the OnLoad() method.