logo

CrossWindow

A cross platform system abstraction C++ library for managing windows and performing OS tasks.

Github Docs Demos

#include "CrossWindow/CrossWindow.h"

void xmain(int argc, const char** argv)
{
    // 🖼️ Create Window Description
    xwin::WindowDesc windowDesc;
    windowDesc.name = "Test";
    windowDesc.title = "My Title";
    windowDesc.visible = true;
    windowDesc.width = 1280;
    windowDesc.height = 720;

    bool closed = false;

    // 🌟 Initialize
    xwin::Window window;
    xwin::EventQueue eventQueue;

    if (!window.create(windowDesc, eventQueue))
    { return; }

    // 🏁 Engine loop
    bool isRunning = true;

    while (isRunning)
    {
        // ♻️ Update the event queue
        eventQueue.update();

        // 🎈 Iterate through that queue:
        while (!eventQueue.empty())
        {
            const xwin::Event& event = eventQueue.front();

            if (event.type == xwin::EventType::MouseMove)
            {
                const xwin::MouseData mouse = event.data.mouseMove;
            }
            if (event.type == xwin::EventType::Close)
            {
                window.close();
                isRunning = false;
            }

            eventQueue.pop();
        }
    }
}
# ⤵️ Add your dependency as a git submodule:
git submodule add https://github.com/alaingalvan/crosswindow.git
# ⤵️ Add to your CMake Project:
add_subdirectory(external/crosswindow)
# 🔗 Link CrossWindow to your project:
target_link_libraries(
    "${PROJECT_NAME}"
    CrossWindow
)

Cross Window is a cross platform system abstraction library for managing windows and performing OS tasks. It's designed to be easy to integrate, intuitive, and support everything you might need for your apps.

CrossWindow supports a variety of platforms, including:

Windows Win32 Mac Cocoa iOS / iPad OS UIKit Linux XCB Android WebAssembly Emscripten Noop (Headless)

Developed by Alain Galvan (@alainxyz), feel free to DM me your feedback.