CombustUI
A Fast and Modern UI Library

Build efficient, blazingly fast interfaces in Mojo.

Get Started Learn More

What is CombustUI?

CombustUI is a GUI development library written in Mojo and built on top of the traditional C++ Library, FLTK (Fast Light Toolkit).

It's designed to be lightweight, high-performance, and to streamline your development process with direct FLTK bindings for precise control.

CombustUI follows the principle of simplicity - it's simple yet sufficiently low-level, allowing developers to create efficient and responsive user interfaces with minimal overhead.

Key Features

Low-Level Control

Direct invocation of FLTK functions for precise GUI management. It literally exposes pointers to enable programmers to access the memory.

Simple Yet Powerful

FLTK isn't the most diverse library nor is it the most popular. However, simplicity is the main selling point. CombustUI builds on the same principles.

MIT License

Free and open-source under the permissive MIT license, allowing you to use CombustUI in both personal and commercial projects.

Direct FLTK Calls

Make direct calls to FLTK functions, giving you full access to the underlying toolkit capabilities.

Super Lightweight

Minimal overhead and small footprint make CombustUI perfect for applications where performance and efficiency are critical.

Identifier System

A system that allows the app to specify certain IDs to different widgets so that they can be selected later upon requirement.

Current State Of CombustUI

  • Basic Event Handling: Supports fundamental event-driven programming paradigms.
  • Essential Widgets: Provides core GUI components such as input boxes, buttons, windows, and grids.
  • An Identifier System: A system that allows the app to specify certain IDs to different widgets so that they can be selected later upon requirement.

Why Not Built From The Ground Up?

  • No ecosystem: Starting from scratch would mean no existing ecosystem.
  • Everything would need to be built from scratch: Every component would require implementation.
  • Cross Platform compatibility: Would need to be implemented separately.
  • Extremely time consuming: Not immediately fruitful and would be complex.

Installation

Follow these steps to install CombustUI in your project:

  1. Ensure Mojo is installed on your machine.
  2. Run the following command to download and set up the script:
  3. curl https://raw.githubusercontent.com/Hammad-hab/CombustUI/main/create_new_app.sh -o ignite_app.sh && chmod +x ignite_app.sh && sudo mv ./ignite_app.sh /usr/local/bin/ignite_app
  4. Initialize a new CombustUI project:
  5. ignite_app MyApp
  6. Navigate to your project directory:
  7. cd MyApp
  8. Build and run your application using Mojo:
  9. magic shell

Window Demo

Here's a simple example of creating a window with CombustUI:

from mjui.fltk_bindings.bindings import *
from mjui._app import Application

fn main() raises:
   var app = Application()

   var window = mjuiSpawnWindow(1000, 500, 1, 0, 0, "Hello CombustUI".as_bytes())

   mjuiShowWidget(window)

   app.markWindowPTRAsMain(window)
   app.execute()

Understanding the Window Parameters

Essentially what markWindowPTRAsMain does is that it tells the app which widget (or window) is the main widget (or window) so that the app can exit once the widget or window is not visible or has been destroyed.

Another thing you might notice is the as_bytes method at the end of the title literal. For some reason, passing strings from Mojo to C wasn't actually working correctly. I'm currently investigating why this problem occurs, but essentially, the string gets corrupted and deformed, as it is passed from the Mojo end, to the C ffi functions.

var window = mjuiSpawnWindow(1000, 500, 1, 0, 0, "Hello CombustUI".as_bytes())
  ^     ^    ^  ^  ^
  0     1    2  3  4
0. Width
1. Height
2. Resize
3. No Frame (Setting this to true will remove the title bar)
4. Full Screen mode

Roadmap

Here's where CombustUI is headed in future releases: