# LCUI **Repository Path**: lc-soft/LCUI ## Basic Information - **Project Name**: LCUI - **Description**: 用于开发图形用户界面的 C 库 - **Primary Language**: C - **License**: MIT - **Default Branch**: develop - **Homepage**: http://lcui.lc-soft.io - **GVP Project**: Yes ## Statistics - **Stars**: 518 - **Forks**: 87 - **Created**: 2015-09-28 - **Last Updated**: 2025-10-18 ## Categories & Tags **Categories**: desktop-ui **Tags**: None ## README
The C library for build user interfaces
## Introduction [中文版说明文档](README.zh-cn.md) LCUI is a library written in C for building graphical user interfaces. Its goal is to explore and practice new ways of developing user interfaces, characterized by its small size, ease of use, and provision of convenient development tools to help developers quickly create desktop applications with graphical user interfaces. **LC** originates from the initials of the author's name. The library was initially designed to help the author develop small projects and gain development experience. However, the author did not gain a competitive advantage in the job market, which is crowded with C/C++ experts, and thus had to work in web front-end development. As a result, LCUI now leans towards integrating technologies from the web front-end domain. ### Key Features - **Cross-platform:** Supports Windows and Linux. - **Fully custom-drawn components:** Ensures consistent appearance and behavior of components across platforms. - **DPI awareness:** Automatically scales the UI on high-resolution screens to maintain a clear display. - **Built-in CSS engine:** Enables the use of CSS for defining UI styles and layouts, making it easier for developers with web development experience to get started. - **Modern development tools:** Includes tools that allow you to build user interfaces using [TypeScript](https://lcui-dev.github.io/docs/guide/typescript) with JSX syntax, the React library, and other web frontend technologies. ### Development Experience Preview You can get an overview of the development experience for LCUI applications from the following image:  - **Component Development in React-like Style:** Writing UI configuration files using TypeScript. With the combined advantages of TypeScript, JSX syntax, and the LCUI React library, you can succinctly describe UI structure, resource dependencies, component states, data binding, and event binding. - **Various Stylesheet Writing Methods:** [Tailwind CSS](https://tailwindcss.com/), [CSS Modules](https://github.com/css-modules/css-modules), [Sass](https://sass-lang.com/), and global CSS. - **File-system based router:** Organize application pages in directory form, with each page corresponding to a directory. The path of the directory serves as the route for that page. With the built-in application router, you can easily implement page switching and navigation without manual route configuration. - **User-friendly and Modern Icon Library:** Icons are sourced from the [fluentui-system-icons](https://github.com/microsoft/fluentui-system-icons) library, with partial customization to fit LCUI's characteristics, offering similar usage patterns. - **Command-line Development Tool:** Run the `lcui build` command to preprocess configuration files within the app directory, then generate corresponding C source code and resource files. ### Architecture Over time LCUI has been built up to be based on various libraries: - [lib/yutil](./lib/yutil): Utility library providing common data structures and functions. - [lib/pandagl](./lib/pandagl): PandaGL (Panda Graphics Library), a graphics library offering font management, text layout, image processing, and rendering capabilities. - [lib/css](./lib/css): CSS parser and selector engine, enabling CSS parsing and selection functionalities. - [lib/ptk](./lib/ptk): Platform Toolkit library offering cross-platform unified system-related APIs, including message loops, window management, timers, worker threads, and input methods. - [lib/thread](./lib/thread): Thread library offering cross-platform multithreading capabilities. - [lib/router](./lib/ui-router): Router manager offering routing and navigation functionalities. - [lib/worker](./lib/worker): Worker thread library providing simple communication and management for worker threads. - [lib/ui](./lib/ui): Core UI library that manages UI components, event queues, style computation, drawing, and other essential UI functionalities. - [lib/ui-xml](./lib/ui-xml): XML parsing library enabling the creation of UI components from XML file content. - [lib/ui-cursor](./lib/ui-cursor): Cursor library providing cursor rendering capabilities. - [lib/ui-server](./lib/ui-server): UI server that maps UI components to system windows. The core source code of LCUI is located in the `src/` directory and is divided into the following modules: - **app:** Application lifecycle, event, and UI management. - **fonts:** Default font settings. - **settings:** Global settings, providing switches and parameter configurations for certain features. - **ui:** UI and window management. - **widgets:** Predefined components. - **worker:** Asynchronous task management. ## Quick Start Before you begin, you need to install the following software on your computer: - [Git](https://git-scm.com/download/): Version control tool used to download the source code of the example project. - [XMake](https://xmake.io/#/zh-cn/?id=%e5%ae%89%e8%a3%85): Build tool used to build the project. - [Node.js](https://nodejs.org/): JavaScript runtime environment used to run the LCUI command-line development tool. Then, run the following commands in a command-line window: ```shell # Install the LCUI command-line development tool npm install -g @lcui/cli # Create an LCUI application project lcui create my-lcui-app ``` Follow the prompts provided by the commands afterward. ## Documentation - [Online Documentation](https://lcui-dev.github.io/docs/next/guides/base/) - [Request for Comments (RFC)](https://lcui-dev.github.io/docs/next/rfcs/) - [Changelog](CHANGELOG.md) - [Contribution Guidelines](.github/CONTRIBUTING.md) ### Tutorials| Title | Preview | Summary |
|---|---|---|
| Image Viewer | ![]() |
Develop an image viewer program based on the LCUI library, build its graphical interface with web technologies, implement the interface interaction logic and various functions with C language, and deeply explore the features and development techniques of LCUI in the UI aspect. |
| Todo List | ![]() |
Learn the basic concepts and usage of LCUI, as well as how to use it to build UI and implement state management, UI updates, and interactions. |
| Fabric | ![]() |
Rewrite the existing fabric simulation program's JavaScript source code in C language, and use the cairo graphics library for fabric rendering. Then, apply LCUI to implement fabric animation playback and interaction. |
| Browser (Outdated) | ![]() |
Referencing a web browser, use LCUI to implement similar UI structure, layout, style, and multi-tab management features. Utilize LCUI's routing management functionality to implement multi-tab page state management and navigation, as well as a simple file browsing page. |