open source · MIT

mydear: Dear ImGui apps on every platform.

You write one frame(). It brings the rest.

A small C++20 toolkit around Dear ImGui. No browser engine, no runtime.

* macOS, iOS, Windows, Linux, Android, web* Metal, Direct3D 11, OpenGL, WebGL 2* components you can try in the browser

mydear opens the window, sets up the graphics backend and the Dear ImGui backends, runs a frame loop that idles when nothing changes, and fills the gaps between ImGui and each operating system: a title bar with the real OS buttons, touch and the soft keyboard on phones and tablets, native views in the layout, fonts, file dialogs, haptics and auto-update. Dear ImGui stays yours, compiled once by your project. It grew out of DearSQL, a SQL client for desktop, iPad and iPhone, where it runs everything between the OS and the UI.

> Platforms

what differs

* macOSGLFW + Metal, native traffic lights
* iOS & iPadOSUIKit + Metal, touch, the soft keyboard and IME
* WindowsGLFW + Direct3D 11, snap layouts
* LinuxGTK 4 + OpenGL, GTK's frame clock
* AndroidNativeActivity + OpenGL ES 3, an APK without Gradle
* WebEmscripten + WebGL 2, any static host

## The whole app

A delegate draws a frame; mydear::Run does the rest. The same file builds for every platform above.

#include "mydear/app.hpp"
#include "mydear/button.hpp"

struct Hello : mydear::Delegate {
    int clicks = 0;
    void frame() override {
        const mydear::Rect r = mydear::ContentRect(); // under the title bar, inside the safe area
        ImGui::SetNextWindowPos(r.pos);
        ImGui::SetNextWindowSize(r.size);
        ImGui::Begin("hello", nullptr, ImGuiWindowFlags_NoDecoration);
        if (mydear::Button("Click me", mydear::ButtonVariant::Primary))
            ++clicks;
        ImGui::Text("Clicked %d times", clicks);
        ImGui::End();
    }
};

int main() {
    static Hello hello;
    return mydear::Run({.title = "Hello", .titleBar = true}, hello);
}

In CMake, next to your own Dear ImGui:

set(MYDEAR_IMGUI_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/imgui)
add_subdirectory(external/mydear)
add_executable(app main.cpp ${IMGUI_SOURCES})
target_link_libraries(app PRIVATE mydear::mydear) # + mydear::components, optional

Getting started →

## What it has