anyuianyui
anyui-LIVE
anyui
Feedback
  • English
  • 中文
anyui-LIVE
anyui
Feedback
  • English
  • 中文
  • Introduction

    • Introduction
  • Get Started

    • Get Started
  • Workspace

    • Workspace
  • Editor

    • Overview
    • Toolbar
    • Navigator
    • Inspector
    • Display Layers
    • Event Flow Overview
    • Statusbar
    • Settings
    • Keyboard shortcuts
    • Canvas
    • Preview
    • Resource management
    • Code Viewer
    • History
  • Agent
  • Desktop
  • Data safety
  • Subjects

    • Image
    • Font Library
    • Layout
    • Symbol
    • Animation
    • Global style
    • Dynamic LVGL version
    • Dynamic Display Size Change
    • Override screen size
    • Codegen
    • User custom code
    • Transplant
    • Simulator
    • Translation
  • FAQ

Codegen converts the canvas design into C source code that runs on the target device. This guide covers code generation features, configuration options, and integration points.

Overview

After designing screens in the editor, anyui-LIVE generates the screen implementations and converts assets into a generated/ directory of output artifacts. The generated code is self-contained and can be integrated into final firmware.

The pipeline is described here; the assets it consumes are defined in the image guide and the font library guide.

Generated output

Codegen produces the following:

OutputDescription
Screen source filesC files implementing each screen and the setup_ui() entry point, under generated/.
Asset sourcesConverted images and fonts under generated/.
Image filesThe picture behind each image whose source type is a file path, written at the path the source names with the drive letter dropped - S:images/logo.png becomes images/logo.png.
Header filesDeclarations for screens, components, and generated variables.
Custom event filescustom/custom_event.h and custom/custom_event.c for your own event declarations and handler code.
Project filesFiles at the export root, such as Makefile, lv_conf.h, and, on versions that size the window there, main.c.

Most of this output is generated automatically. As a rule, do not edit files under generated/; regenerate them from the editor instead. The files you are meant to write in are custom/custom_event.h, custom/custom_event.c, lv_conf.h and main.c, each of which keeps your code through later exports - see User custom code.

When you export, anyui-LIVE first regenerates the generated sources so the output always reflects the current design. In the desktop app, this also removes stale generated files from the project folder, so deleted screens, fonts, and images do not keep compiling.

Exporting

  • Web app - Export regenerates the source bundle and downloads it as a ZIP archive named after the project, target version, and export time.
  • Desktop app - Export writes the files into the export folder configured for the target version; the write happens in place, with no ZIP to unpack. See Settings and Desktop.

The desktop app can also compile the exported code and run the simulator; see Simulator.

An image authored as a file path travels as the file rather than as generated C: the export places it next to the generated sources, and a file the folder already holds is left untouched and reported instead of overwritten. The lv_conf.h written beside them registers the file drive and the decoder for each picture format the design reads from a file; an existing header is corrected in place. See File-path sources.

Configuration options

Codegen behavior is controlled through project configuration:

OptionDescription
ResolutionTarget resolution used when generating screen layout.
Color depthStored with the project for runtime configuration (8, 16, or 32 bits). Every picture is read against it: the firmware decodes the formats its generation supports, and one it cannot decode is reported rather than drawn.
LVGL versionLVGL version used for generated code.
Default image source / external file prefixHow a new image source is read, and the folder file paths are written under.
Export folderDesktop app only: where each version writes its generated sources.

See the Project Settings for where these options are configured.

Integration points

The generated code integrates with the rest of the system through well-defined entry points:

  • setup_ui() - call this to initialize the UI from your application.
  • generated/ - copy these files into your project build.

These integration points are the basis of the transplant guide, which explains moving generated code to a target device.

Related guides

  • Image - how image assets are converted.
  • Font library - how font libraries are converted.
  • Workspace - where projects are created and configured.
  • Overview - the screens that codegen compiles.
  • Code viewer - reading the generated source inside the editor.
  • Preview - the simulated code produced by codegen.
  • Transplant - integrate generated code into a target project.
  • User custom code - which files are yours to write in, and how exports keep what you put there.
  • Simulator - run generated code on a local machine.
Prev
Override screen size
Next
User custom code