Introduction to layouts

Because dear imgui supports floating windows(and in our case, docking and viewports too), the library has implemented a system for managing the layout of the different widgets on the screen. On top of this, dear imgui also implements loading/saving such layouts from/to files in the ini format.

Default behaviour and configuration

The default behaviour of the framework follows dear imgui's default behaviour: saving/loading files from/to a specific file location. In our case a file with the following path: <Application config directory>/Core/<layout name>.ini

However, you do have the ability to change this behaviour using 3 settings in your <Application config directory>/Core/Window.yaml file:

layout-location: DefaultLayout
load-layout: true
save-layout: true

These settings affect the following:

  1. layout-location - Sets the file name of the layout file, prefixed with <Application config directory/Core/ and postfixed with .ini(defaults to DefaultLayout if not set)
  2. load-layout - Whether to automatically load the layout file(defaults to true if not set)
  3. save-layout - Whether to automatically save any changes to the layout file(defaults to true if not set)

Interface

One can also programmatically access these 3 settings, as well as deal with manually loading and saving layouts through the Layouts interface:

class Layouts
{
public:
    static bool& getLoadLayout() noexcept;
    static bool& getSaveLayout() noexcept;
    static FString& layoutLocation() noexcept;

    static void loadLayout(String layout) noexcept;
    static void saveLayout(String layout) noexcept;
};

The function names should be self-explanatory.

Tip

The loadLayout and saveLayout functions don't apply any string manipulation, and are equivalent to a call to ImGui::LoadIniSettingsFromDisk and ImGui::SaveIniSettingsToDisk.

C API

A C API is also provided. It follows the basic C API development conventions, as defined here.