GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - aptumfr/lv: C++ wrapper for lvgl with zero-cost abstractions

BranchesTags
Open more actions menu

Latest commit

 

History

50 Commits
50 Commits

Folders and files

NameName
Last commit message
Last commit date
demos
demos
 
 
docs
docs
 
 
examples
examples
 
 
fonts
fonts
 
 
include/lv
include/lv
 
 
scripts
scripts
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
CMakeLists.txt
CMakeLists.txt
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
lv_conf.h
lv_conf.h
 
 

Repository files navigation

lv:: Modern C++20 Bindings for LVGL

Zero-cost, type-safe C++20 wrapper for the LVGL embedded graphics library.

Quick Start

#include <lv/lv.hpp>

int main() {
    lv::init();
    lv::X11Display display("Hello", 480, 320);

    lv::Label::create(lv::screen_active())
        .text("Hello, LVGL!")
        .center();

    lv::run();
}

Features

  • Zero-cost abstractions - Every wrapper is sizeof(void*), producing identical assembly to C
  • Type-safe events - Compile-time verified callbacks with member function pointers
  • Fluent API - Method chaining for declarative, readable UI code
  • Reactive state - State<T> with automatic UI updates via LVGL's observer system
  • Modern C++20 - Concepts, [[nodiscard]], noexcept, no exceptions
  • Header-only - Easy integration, just add to include path
  • 35 widgets wrapped - Full coverage of LVGL widget set
  • UI automation ready - Built-in name() for widget identification in testing and debugging

Example: Counter App

class CounterApp : public lv::Component<CounterApp> {
    lv::State<int> m_count{0};

public:
    lv::ObjectView build(lv::ObjectView parent) {
        auto root = lv::vbox(parent).fill().center_content();

        lv::Label::create(root)
            .bind_text(m_count, "Count: %d");

        auto buttons = lv::hbox(root).gap(10);

        lv::Button::create(buttons)
            .text("-")
            .on_click<&CounterApp::decrement>(this);

        lv::Button::create(buttons)
            .text("+")
            .on_click<&CounterApp::increment>(this);

        return root;
    }

private:
    void increment(lv::Event) { ++m_count; }
    void decrement(lv::Event) { --m_count; }
};

Building

Directory Structure

Place LVGL as a sibling directory:

parent/
├── lvgl/          # LVGL 9.4 source (git clone -b release/v9.4 https://github.com/lvgl/lvgl)
└── lv/            # This project

Or specify a custom path with -DLVGL_DIR.

Build Commands

cd lv
cmake -B build
cmake --build build
./build/examples/hello

With custom LVGL path:

cmake -B build -DLVGL_DIR=/path/to/lvgl

Requirements

  • C++20 compiler (GCC 11+, Clang 14+, MSVC 2022+)
  • CMake 3.20+
  • LVGL 9.4
  • X11 or SDL2 (for display backend in examples/demos)

Documentation

  • Architecture - Design principles and patterns
  • API Guide - Complete API reference with C comparison
  • Naming Conventions - Consistent naming rules

Design Philosophy

C++ is the only UI language - no DSL, no XML, no code generation, no moc. Just pure C++20.

// Type-safe: compiler verifies method exists and signature matches
button.on_click<&MyApp::handle_click>(this);

// Zero allocation: stateless lambdas decay to function pointers
button.on_click([](lv::Event e) { /* ... */ });

// Reactive: UI auto-updates when state changes
lv::State<int> value{0};
label.bind_text(value, "Value: %d");
value.set(42);  // Label updates automatically

License

AGPL-3.0-only

About

C++ wrapper for lvgl with zero-cost abstractions

Topics

cpp20embeddedlvgllvgl-esp32lvgl-uilvgl9

Resources

Readme
AGPL-3.0 license
Activity
Custom properties

Stars

24 stars

Watchers

2 watching

Forks

8 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.