Now that you have set up your window, you need to set up your custom monitor as well.

Each GenericWindow class has a member variable of type GenericMonitor* named monitor. In your window's constructor, you need to set this pointer to point to a child of the GenericMonitor class. The base class looks like this:

class GenericMonitor
{
public:

    virtual FVector4 getWorkArea(MonitorData& data) noexcept = 0;
    virtual FVector2 getSize(MonitorData& data) noexcept = 0;

    virtual String getName(MonitorData& data) noexcept = 0;

    virtual double getContentScale(MonitorData& data) noexcept = 0;
    virtual float getPixelDensity(MonitorData& data) noexcept = 0;

    virtual void* getPlatformHandle(MonitorData& data) noexcept = 0;
};

Our monitor API is intentionally minimal, due to the fact that different libraries, APIs and operating systems provide very different monitor data from each other. Of course, you can cast back to your own monitor at any point to take advantage of additional functionality in your windowing system.

The functions are the same as in the Monitor class, but they must act on top of the provided monitor data instead.

C API

The C API for monitors looks like this:

 // Allocate a GenericMonitor instance to be used together with a corresponding GenericWindow
    // Event safety - Any time
    UIMGUI_PUBLIC_API UImGui_CGenericMonitor* UImGui_CGenericMonitor_allocate(
        UImGui_FVector4(*getWorkArea)(UImGui_MonitorData*),
        double(*getContentScale)(UImGui_MonitorData*),
        UImGui_String(*getName)(UImGui_MonitorData*),
        UImGui_FVector2(*getSize)(UImGui_MonitorData*),
        float(*getPixelDensity)(UImGui_MonitorData*),
        void*(*getPlatformHandle)(UImGui_MonitorData*)
    );

    // CGenericWindow instances automatically call this function in their destructor, but it is given for convenience
    // Event safety - Any time
    UIMGUI_PUBLIC_API void UImGui_CGenericMonitor_free(UImGui_CGenericMonitor* monitor);

Simply allocate a generic monitor with UImGui_CGenericMonitor_allocate() by providing the required C function pointers for each event. A UImGui_CGenericMonitor* will be returned that you can use as your handle.

You can also prematurely free your instance with UImGui_CGenericMonitor_free(), though this is not required in most cases, since GenericWindows created with the C API already free these types of monitors automatically.

To set a CGenericMonitor as your monitor with the C API assign it to the monitor variable of your UImGui_CGenericWindowInitInfo struct.