CombustUI
A Fast and Modern UI Library
Build efficient, blazingly fast interfaces in Mojo.
Get Started Learn MoreWhat 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:
- Ensure Mojo is installed on your machine.
- Run the following command to download and set up the script:
- Initialize a new CombustUI project:
- Navigate to your project directory:
- Build and run your application using Mojo:
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
ignite_app MyApp
cd MyApp
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:
-
Struct Based API
As you can see, the current state of CombustUI is mostly functional and unsafe since the programmer gets limitless access to widget pointers. We're working on a more structured approach.
-
Adding more Widgets
Currently, CombustUI has a really sparse toolkit. That being said, more widgets will be added, including ones that aren't just bindings of FLTK widgets, but are built entirely in Mojo.
-
Focus on Core mechanics first
Before any of the aforementioned can be added, the core mechanics must be implemented. For example, for CombustUI to have its own custom, non-FLTK widgets, it must have access to the core drawing API of FLTK.
-
Updates to ignite_app
Ignite app is a small script which makes initializing CombustUI applications much more feasible. Over the next few versions, ignite app will get major updates and will mature as a CLI tool.