zsmith.co

FrugalWidgets: cross platform UI library

Revision 1
© 2013-2019 by Zack Smith. All rights reserved.

What is FrugalWidgets?

FrugalWidgets is a user-interface library, meaning it provides views, view controllers, and associated classes that are required to create GUI applications using the Model-View-Controller paradigm. FrugalWidgets has a hardware-abstration layer so that it can run on several platforms. I've coded it in C++.

FrugalWidgets is meant mainly for hobby projects.

What platforms?

FrugalWidgets currently runs on these platforms, including:

  • MacOS (using OpenGL or X)
  • Linux (using OpenGL or X)

Note that MacOS Catalina breaks both OpenGL and X and while there is an AppKit-based HAL as well, it is buggy.

Why is FrugalWidgets it needed?

Because good alternatives don't exist.

By good I mean:

  • Not enormously bloated. The library should take seconds to compile, not hours.
  • Written in a fast, compiled language: C++, not an interpreted (Python) or bytecode-based (Java) language.
  • Tiny runtime footprint, small enough to run in very low RAM environments e.g. Rpi0.

Overview

What is the scope of FrugalWidgets?

It provides the UI layer for applications.

What are the key components?

MVC stuff: View, Controller, ViewAnimator

Image stuff: (Mutable)Image

Basic UI stuff: Window, OutputDevice(s), Font, Application

Containers: (Mutable)Array

OO stuff: Object, Value, RECT, etc.

What are the issues when developing a cross-platform UI library?

Choice of language:
Must be fast, cross-platform, ideally produce small binaries.

Memory management:
Retain/release seems best to avoid garbage collection stutter.

Smooth animations:
This is difficult on low-resource platforms.

I/O differences:
Various platforms provide events, inputs and windows differently.

Display differences:
Need to support multiple DPIs, multiple pixel depths.

Font availability:
Need to provide scalable fonts plus fallback fonts.

How easily can FrugalWidgets be debugged and refactored?

Relatively easily because:

  1. Few apps exist.
  2. There is very little technical debt in FW because it is small.
  3. It didn't originate as a desktop UI library so lots of cruft isn't there.
  4. OutputDevice subclasses (mostly) rely on stable APIs.

Screenshots

MacOS

OpenGL (100 DPI)

MacOS OpenGL

X-Windows (100 DPI)

MacOS OpenGL

Download

Upon request.